FredZhang7 commited on
Commit
2eb6d99
·
1 Parent(s): a889323

update example x 3

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -15,7 +15,7 @@ I built EfficientNetV2.5 s to outperform the existing EfficientNet b0 to b4, Eff
15
  - Params: 16.64 M
16
  - Multiply-Add Operations: 5.32 G
17
  - Image size: train = 299x299 / 304x304, test = 304x304
18
- - Classification layer: defaults to 1,000 classes, but is empty
19
  - **Papers:**
20
  - EfficientNetV2: Smaller Models and Faster Training: https://arxiv.org/abs/2104.00298
21
  - Layer-adaptive sparsity for the Magnitude-based Pruning: https://arxiv.org/abs/2010.07611
@@ -42,7 +42,7 @@ print_layer_stats = True # prints the statistics for each layer of the model
42
  verbose = True # prints additional info about the MAC calculation
43
 
44
  # Download the model. Skip this step if already downloaded
45
- base_model = "efficientnetv2.5_rw_s_16.64M_5.27G_in3"
46
  url = f"https://huggingface.co/FredZhang7/efficientnetv2.5_rw_s/resolve/main/{model_name}.pth"
47
  file_name = f"./{base_model}.pth"
48
  urllib.request.urlretrieve(url, file_name)
@@ -52,8 +52,8 @@ model.classifier = torch.nn.Linear(in_features=1984, out_features=nclass, bias=T
52
  macs, nparams = get_model_complexity_info(model, input_size, as_strings=False, print_per_layer_stat=print_layer_stats, verbose=verbose)
53
  traced_model = torch.jit.trace(model, example_inputs)
54
 
55
- # model_name = f'{base_model}_{"{:.2f}".format(nparams / 1e6)}M_{"{:.2f}".format(macs / 1e9)}G.pth'
56
- traced_model.save(base_model)
57
 
58
  # Load the trainable model
59
  model = torch.load(model_name)
 
15
  - Params: 16.64 M
16
  - Multiply-Add Operations: 5.32 G
17
  - Image size: train = 299x299 / 304x304, test = 304x304
18
+ - Classification layer: defaults to 1,000 classes
19
  - **Papers:**
20
  - EfficientNetV2: Smaller Models and Faster Training: https://arxiv.org/abs/2104.00298
21
  - Layer-adaptive sparsity for the Magnitude-based Pruning: https://arxiv.org/abs/2010.07611
 
42
  verbose = True # prints additional info about the MAC calculation
43
 
44
  # Download the model. Skip this step if already downloaded
45
+ base_model = "efficientnetv2.5_base_in1k.pth"
46
  url = f"https://huggingface.co/FredZhang7/efficientnetv2.5_rw_s/resolve/main/{model_name}.pth"
47
  file_name = f"./{base_model}.pth"
48
  urllib.request.urlretrieve(url, file_name)
 
52
  macs, nparams = get_model_complexity_info(model, input_size, as_strings=False, print_per_layer_stat=print_layer_stats, verbose=verbose)
53
  traced_model = torch.jit.trace(model, example_inputs)
54
 
55
+ model_name = f'{base_model}_{"{:.2f}".format(nparams / 1e6)}M_{"{:.2f}".format(macs / 1e9)}G.pth'
56
+ traced_model.save(model_name)
57
 
58
  # Load the trainable model
59
  model = torch.load(model_name)