|
1 | 1 | from torchbench.image_classification import ImageNet |
2 | | -from timm import create_model, list_models |
| 2 | +from timm import create_model |
3 | 3 | from timm.data import resolve_data_config, create_transform |
| 4 | +from timm.models import TestTimePoolHead |
4 | 5 | import os |
5 | 6 |
|
6 | 7 | NUM_GPU = 1 |
7 | 8 | BATCH_SIZE = 256 * NUM_GPU |
8 | 9 |
|
9 | 10 |
|
10 | | -def _attrib(paper_model_name='', paper_arxiv_id='', batch_size=BATCH_SIZE): |
| 11 | +def _entry(model_name, paper_model_name, paper_arxiv_id, batch_size=BATCH_SIZE, ttp=False, args=dict()): |
11 | 12 | return dict( |
| 13 | + model=model_name, |
12 | 14 | paper_model_name=paper_model_name, |
13 | 15 | paper_arxiv_id=paper_arxiv_id, |
14 | | - batch_size=batch_size) |
| 16 | + batch_size=batch_size, |
| 17 | + ttp=ttp, |
| 18 | + args=args) |
15 | 19 |
|
16 | | -model_map = dict( |
17 | | - #adv_inception_v3=_attrib(paper_model_name='Adversarial Inception V3', paper_arxiv_id=), |
18 | | - #densenet121=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
19 | | - #densenet161=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
20 | | - #densenet169=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
21 | | - #densenet201=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
22 | | - dpn68=_attrib( |
23 | | - paper_model_name='DPN-68', paper_arxiv_id='1707.01629'), |
24 | | - dpn68b=_attrib( |
25 | | - paper_model_name='DPN-68b', paper_arxiv_id='1707.01629'), |
26 | | - dpn92=_attrib( |
27 | | - paper_model_name='DPN-92', paper_arxiv_id='1707.01629'), |
28 | | - dpn98=_attrib( |
29 | | - paper_model_name='DPN-98', paper_arxiv_id='1707.01629'), |
30 | | - dpn107=_attrib( |
31 | | - paper_model_name='DPN-107', paper_arxiv_id='1707.01629'), |
32 | | - dpn131=_attrib( |
33 | | - paper_model_name='DPN-131', paper_arxiv_id='1707.01629'), |
34 | | - efficientnet_b0=_attrib( |
35 | | - paper_model_name='EfficientNet-B0', paper_arxiv_id='1905.11946'), |
36 | | - efficientnet_b1=_attrib( |
37 | | - paper_model_name='EfficientNet-B1', paper_arxiv_id='1905.11946'), |
38 | | - efficientnet_b2=_attrib( |
39 | | - paper_model_name='EfficientNet-B2', paper_arxiv_id='1905.11946'), |
40 | | - #ens_adv_inception_resnet_v2=_attrib(paper_model_name=, paper_arxiv_id=), |
41 | | - fbnetc_100=_attrib( |
42 | | - paper_model_name='FBNet-C', paper_arxiv_id='1812.03443'), |
43 | | - gluon_inception_v3=_attrib( |
44 | | - paper_model_name='Inception V3', paper_arxiv_id='1512.00567'), |
45 | | - gluon_resnet18_v1b=_attrib( |
46 | | - paper_model_name='ResNet-18', paper_arxiv_id='1812.01187'), |
47 | | - gluon_resnet34_v1b=_attrib( |
48 | | - paper_model_name='ResNet-34', paper_arxiv_id='1812.01187'), |
49 | | - gluon_resnet50_v1b=_attrib( |
50 | | - paper_model_name='ResNet-50', paper_arxiv_id='1812.01187'), |
51 | | - gluon_resnet50_v1c=_attrib( |
52 | | - paper_model_name='ResNet-50-C', paper_arxiv_id='1812.01187'), |
53 | | - gluon_resnet50_v1d=_attrib( |
54 | | - paper_model_name='ResNet-50-D', paper_arxiv_id='1812.01187'), |
55 | | - gluon_resnet50_v1s=_attrib( |
56 | | - paper_model_name='ResNet-50-S', paper_arxiv_id='1812.01187'), |
57 | | - gluon_resnet101_v1b=_attrib( |
58 | | - paper_model_name='ResNet-101', paper_arxiv_id='1812.01187'), |
59 | | - gluon_resnet101_v1c=_attrib( |
60 | | - paper_model_name='ResNet-101-C', paper_arxiv_id='1812.01187'), |
61 | | - gluon_resnet101_v1d=_attrib( |
62 | | - paper_model_name='ResNet-101-D', paper_arxiv_id='1812.01187'), |
63 | | - gluon_resnet101_v1s=_attrib( |
64 | | - paper_model_name='ResNet-101-S', paper_arxiv_id='1812.01187'), |
65 | | - gluon_resnet152_v1b=_attrib( |
66 | | - paper_model_name='ResNet-152', paper_arxiv_id='1812.01187'), |
67 | | - gluon_resnet152_v1c=_attrib( |
68 | | - paper_model_name='ResNet-152-C', paper_arxiv_id='1812.01187'), |
69 | | - gluon_resnet152_v1d=_attrib( |
70 | | - paper_model_name='ResNet-152-D', paper_arxiv_id='1812.01187'), |
71 | | - gluon_resnet152_v1s=_attrib( |
72 | | - paper_model_name='ResNet-152-S', paper_arxiv_id='1812.01187'), |
73 | | - gluon_resnext50_32x4d=_attrib( |
74 | | - paper_model_name='ResNeXt-50 32x4d', paper_arxiv_id='1812.01187'), |
75 | | - gluon_resnext101_32x4d=_attrib( |
76 | | - paper_model_name='ResNeXt-101 32x4d', paper_arxiv_id='1812.01187'), |
77 | | - gluon_resnext101_64x4d=_attrib( |
78 | | - paper_model_name='ResNeXt-101 64x4d', paper_arxiv_id='1812.01187'), |
79 | | - gluon_senet154=_attrib( |
80 | | - paper_model_name='SENet-154', paper_arxiv_id='1812.01187'), |
81 | | - gluon_seresnext50_32x4d=_attrib( |
82 | | - paper_model_name='SE-ResNeXt-50 32x4d', paper_arxiv_id='1812.01187'), |
83 | | - gluon_seresnext101_32x4d=_attrib( |
84 | | - paper_model_name='SE-ResNeXt-101 32x4d', paper_arxiv_id='1812.01187'), |
85 | | - gluon_seresnext101_64x4d=_attrib( |
86 | | - paper_model_name='SE-ResNeXt-101 64x4d', paper_arxiv_id='1812.01187'), |
87 | | - gluon_xception65=_attrib( |
88 | | - paper_model_name='Modified Aligned Xception', paper_arxiv_id='1802.02611', batch_size=BATCH_SIZE//2), |
89 | | - ig_resnext101_32x8d=_attrib( |
90 | | - paper_model_name='ResNeXt-101 32x8d', paper_arxiv_id='1805.00932'), |
91 | | - ig_resnext101_32x16d=_attrib( |
92 | | - paper_model_name='ResNeXt-101 32x16d', paper_arxiv_id='1805.00932'), |
93 | | - ig_resnext101_32x32d=_attrib( |
94 | | - paper_model_name='ResNeXt-101 32x32d', paper_arxiv_id='1805.00932', batch_size=BATCH_SIZE//2), |
95 | | - ig_resnext101_32x48d=_attrib( |
96 | | - paper_model_name='ResNeXt-101 32x48d', paper_arxiv_id='1805.00932', batch_size=BATCH_SIZE//4), |
97 | | - inception_resnet_v2=_attrib( |
98 | | - paper_model_name='Inception ResNet V2', paper_arxiv_id='1602.07261'), |
99 | | - #inception_v3=dict(paper_model_name='Inception V3', paper_arxiv_id=), # same weights as torchvision |
100 | | - inception_v4=_attrib( |
101 | | - paper_model_name='Inception V4', paper_arxiv_id='1602.07261'), |
102 | | - mixnet_l=_attrib( |
103 | | - paper_model_name='MixNet-L', paper_arxiv_id='1907.09595'), |
104 | | - mixnet_m=_attrib( |
105 | | - paper_model_name='MixNet-M', paper_arxiv_id='1907.09595'), |
106 | | - mixnet_s=_attrib( |
107 | | - paper_model_name='MixNet-S', paper_arxiv_id='1907.09595'), |
108 | | - mnasnet_100=_attrib( |
109 | | - paper_model_name='MnasNet-B1', paper_arxiv_id='1807.11626'), |
110 | | - mobilenetv3_100=_attrib( |
111 | | - paper_model_name='MobileNet V3(1.0)', paper_arxiv_id='1905.02244'), |
112 | | - nasnetalarge=_attrib( |
113 | | - paper_model_name='NASNet-A Large', paper_arxiv_id='1707.07012', batch_size=BATCH_SIZE//4), |
114 | | - pnasnet5large=_attrib( |
115 | | - paper_model_name='PNASNet-5', paper_arxiv_id='1712.00559', batch_size=BATCH_SIZE//4), |
116 | | - resnet18=_attrib( |
117 | | - paper_model_name='ResNet-18', paper_arxiv_id='1812.01187'), |
118 | | - resnet26=_attrib( |
119 | | - paper_model_name='ResNet-26', paper_arxiv_id='1812.01187'), |
120 | | - resnet26d=_attrib( |
121 | | - paper_model_name='ResNet-26-D', paper_arxiv_id='1812.01187'), |
122 | | - resnet34=_attrib( |
123 | | - paper_model_name='ResNet-34', paper_arxiv_id='1812.01187'), |
124 | | - resnet50=_attrib( |
125 | | - paper_model_name='ResNet-50', paper_arxiv_id='1812.01187'), |
126 | | - #resnet101=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
127 | | - #resnet152=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
128 | | - resnext50_32x4d=_attrib( |
129 | | - paper_model_name='ResNeXt-50 32x4d', paper_arxiv_id='1812.01187'), |
130 | | - resnext50d_32x4d=_attrib( |
131 | | - paper_model_name='ResNeXt-50-D 32x4d', paper_arxiv_id='1812.01187'), |
132 | | - #resnext101_32x8d=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
133 | | - semnasnet_100=_attrib( |
134 | | - paper_model_name='MnasNet-A1', paper_arxiv_id='1807.11626'), |
135 | | - senet154=_attrib( |
136 | | - paper_model_name='SENet-154', paper_arxiv_id='1709.01507'), |
137 | | - seresnet18=_attrib( |
138 | | - paper_model_name='SE-ResNet-18', paper_arxiv_id='1709.01507'), |
139 | | - seresnet34=_attrib( |
140 | | - paper_model_name='SE-ResNet-34', paper_arxiv_id='1709.01507'), |
141 | | - seresnet50=_attrib( |
142 | | - paper_model_name='SE-ResNet-50', paper_arxiv_id='1709.01507'), |
143 | | - seresnet101=_attrib( |
144 | | - paper_model_name='SE-ResNet-101', paper_arxiv_id='1709.01507'), |
145 | | - seresnet152=_attrib( |
146 | | - paper_model_name='SE-ResNet-152', paper_arxiv_id='1709.01507'), |
147 | | - seresnext26_32x4d=_attrib( |
148 | | - paper_model_name='SE-ResNeXt-26 32x4d', paper_arxiv_id='1709.01507'), |
149 | | - seresnext50_32x4d=_attrib( |
150 | | - paper_model_name='SE-ResNeXt-50 32x4d', paper_arxiv_id='1709.01507'), |
151 | | - seresnext101_32x4d=_attrib( |
152 | | - paper_model_name='SE-ResNeXt-101 32x4d', paper_arxiv_id='1709.01507'), |
153 | | - spnasnet_100=_attrib( |
154 | | - paper_model_name='Single-Path NAS', paper_arxiv_id='1904.02877'), |
155 | | - tf_efficientnet_b0=_attrib( |
156 | | - paper_model_name='EfficientNet-B0', paper_arxiv_id='1905.11946'), |
157 | | - tf_efficientnet_b1=_attrib( |
158 | | - paper_model_name='EfficientNet-B1', paper_arxiv_id='1905.11946'), |
159 | | - tf_efficientnet_b2=_attrib( |
160 | | - paper_model_name='EfficientNet-B2', paper_arxiv_id='1905.11946'), |
161 | | - tf_efficientnet_b3=_attrib( |
162 | | - paper_model_name='EfficientNet-B3', paper_arxiv_id='1905.11946', batch_size=BATCH_SIZE//2), |
163 | | - tf_efficientnet_b4=_attrib( |
164 | | - paper_model_name='EfficientNet-B4', paper_arxiv_id='1905.11946', batch_size=BATCH_SIZE//2), |
165 | | - tf_efficientnet_b5=_attrib( |
166 | | - paper_model_name='EfficientNet-B5', paper_arxiv_id='1905.11946', batch_size=BATCH_SIZE//4), |
167 | | - tf_efficientnet_b6=_attrib( |
168 | | - paper_model_name='EfficientNet-B6', paper_arxiv_id='1905.11946', batch_size=BATCH_SIZE//8), |
169 | | - tf_efficientnet_b7=_attrib( |
170 | | - paper_model_name='EfficientNet-B7', paper_arxiv_id='1905.11946', batch_size=BATCH_SIZE//8), |
171 | | - tf_efficientnet_es=_attrib( |
172 | | - paper_model_name='EfficientNet-EdgeTPU-S', paper_arxiv_id='1905.11946'), |
173 | | - tf_efficientnet_em=_attrib( |
174 | | - paper_model_name='EfficientNet-EdgeTPU-M', paper_arxiv_id='1905.11946'), |
175 | | - tf_efficientnet_el=_attrib( |
176 | | - paper_model_name='EfficientNet-EdgeTPU-L', paper_arxiv_id='1905.11946', batch_size=BATCH_SIZE//2), |
177 | | - tf_inception_v3=_attrib( |
178 | | - paper_model_name='Inception V3', paper_arxiv_id='1512.00567'), |
179 | | - tf_mixnet_l=_attrib( |
180 | | - paper_model_name='MixNet-L', paper_arxiv_id='1907.09595'), |
181 | | - tf_mixnet_m=_attrib( |
182 | | - paper_model_name='MixNet-M', paper_arxiv_id='1907.09595'), |
183 | | - tf_mixnet_s=_attrib( |
184 | | - paper_model_name='MixNet-S', paper_arxiv_id='1907.09595'), |
185 | | - #tv_resnet34=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
186 | | - #tv_resnet50=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
187 | | - #tv_resnext50_32x4d=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
188 | | - #wide_resnet50_2=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
189 | | - #wide_resnet101_2=_attrib(paper_model_name=, paper_arxiv_id=), # same weights as torchvision |
190 | | - xception=_attrib( |
191 | | - paper_model_name='Xception', paper_arxiv_id='1610.02357'), |
192 | | -) |
193 | 20 |
|
194 | | -model_names = list_models(pretrained=True) |
| 21 | +model_list = [ |
| 22 | + #_entry('adv_inception_v3', 'Adversarial Inception V3', ), |
| 23 | + #_entry('densenet121'), # same weights as torchvision |
| 24 | + #_entry('densenet161'), # same weights as torchvision |
| 25 | + #_entry('densenet169'), # same weights as torchvision |
| 26 | + #_entry('densenet201'), # same weights as torchvision |
| 27 | + _entry('dpn68', 'DPN-68 (224x224)', '1707.01629'), |
| 28 | + _entry('dpn68b', 'DPN-68b (224x224)', '1707.01629'), |
| 29 | + _entry('dpn92', 'DPN-92 (224x224)', '1707.01629'), |
| 30 | + _entry('dpn98', 'DPN-98 (224x224)', '1707.01629'), |
| 31 | + _entry('dpn107', 'DPN-107 (224x224)', '1707.01629'), |
| 32 | + _entry('dpn131', 'DPN-131 (224x224)', '1707.01629'), |
| 33 | + _entry('dpn68', 'DPN-68 (320x320, Mean-Max Pooling)', '1707.01629', ttp=True, args=dict(img_size=320)), |
| 34 | + _entry('dpn68b', 'DPN-68b (320x320, Mean-Max Pooling)', '1707.01629', ttp=True, args=dict(img_size=320)), |
| 35 | + _entry('dpn92', 'DPN-92 (320x320, Mean-Max Pooling)', '1707.01629', |
| 36 | + ttp=True, args=dict(img_size=320), batch_size=BATCH_SIZE//2), |
| 37 | + _entry('dpn98', 'DPN-98 (320x320, Mean-Max Pooling)', '1707.01629', |
| 38 | + ttp=True, args=dict(img_size=320), batch_size=BATCH_SIZE//2), |
| 39 | + _entry('dpn107', 'DPN-107 (320x320, Mean-Max Pooling)', '1707.01629', |
| 40 | + ttp=True, args=dict(img_size=320), batch_size=BATCH_SIZE//4), |
| 41 | + _entry('dpn131', 'DPN-131 (320x320, Mean-Max Pooling)', '1707.01629', |
| 42 | + ttp=True, args=dict(img_size=320), batch_size=BATCH_SIZE//4), |
| 43 | + _entry('efficientnet_b0', 'EfficientNet-B0', '1905.11946'), |
| 44 | + _entry('efficientnet_b1', 'EfficientNet-B1', '1905.11946'), |
| 45 | + _entry('efficientnet_b2', 'EfficientNet-B2', '1905.11946'), |
| 46 | + #_entry('ens_adv_inception_resnet_v2', 'Ensemble Adversarial Inception V3'), |
| 47 | + _entry('fbnetc_100', 'FBNet-C', '1812.03443'), |
| 48 | + _entry('gluon_inception_v3', 'Inception V3', '1512.00567'), |
| 49 | + _entry('gluon_resnet18_v1b', 'ResNet-18', '1812.01187'), |
| 50 | + _entry('gluon_resnet34_v1b', 'ResNet-34', '1812.01187'), |
| 51 | + _entry('gluon_resnet50_v1b', 'ResNet-50', '1812.01187'), |
| 52 | + _entry('gluon_resnet50_v1c', 'ResNet-50-C', '1812.01187'), |
| 53 | + _entry('gluon_resnet50_v1d', 'ResNet-50-D', '1812.01187'), |
| 54 | + _entry('gluon_resnet50_v1s', 'ResNet-50-S', '1812.01187'), |
| 55 | + _entry('gluon_resnet101_v1b', 'ResNet-101', '1812.01187'), |
| 56 | + _entry('gluon_resnet101_v1c', 'ResNet-101-C', '1812.01187'), |
| 57 | + _entry('gluon_resnet101_v1d', 'ResNet-101-D', '1812.01187'), |
| 58 | + _entry('gluon_resnet101_v1s', 'ResNet-101-S', '1812.01187'), |
| 59 | + _entry('gluon_resnet152_v1b', 'ResNet-152', '1812.01187'), |
| 60 | + _entry('gluon_resnet152_v1c', 'ResNet-152-C', '1812.01187'), |
| 61 | + _entry('gluon_resnet152_v1d', 'ResNet-152-D', '1812.01187'), |
| 62 | + _entry('gluon_resnet152_v1s', 'ResNet-152-S', '1812.01187'), |
| 63 | + _entry('gluon_resnext50_32x4d', 'ResNeXt-50 32x4d', '1812.01187'), |
| 64 | + _entry('gluon_resnext101_32x4d', 'ResNeXt-101 32x4d', '1812.01187'), |
| 65 | + _entry('gluon_resnext101_64x4d', 'ResNeXt-101 64x4d', '1812.01187'), |
| 66 | + _entry('gluon_senet154', 'SENet-154', '1812.01187'), |
| 67 | + _entry('gluon_seresnext50_32x4d', 'SE-ResNeXt-50 32x4d', '1812.01187'), |
| 68 | + _entry('gluon_seresnext101_32x4d', 'SE-ResNeXt-101 32x4d', '1812.01187'), |
| 69 | + _entry('gluon_seresnext101_64x4d', 'SE-ResNeXt-101 64x4d', '1812.01187'), |
| 70 | + _entry('gluon_xception65', 'Modified Aligned Xception', '1802.02611', batch_size=BATCH_SIZE//2), |
| 71 | + _entry('ig_resnext101_32x8d', 'ResNeXt-101 32x8d', '1805.00932'), |
| 72 | + _entry('ig_resnext101_32x16d', 'ResNeXt-101 32x16d', '1805.00932'), |
| 73 | + _entry('ig_resnext101_32x32d', 'ResNeXt-101 32x32d', '1805.00932', batch_size=BATCH_SIZE//2), |
| 74 | + _entry('ig_resnext101_32x48d', 'ResNeXt-101 32x48d', '1805.00932', batch_size=BATCH_SIZE//4), |
| 75 | + _entry('inception_resnet_v2', 'Inception ResNet V2', '1602.07261'), |
| 76 | + #_entry('inception_v3', paper_model_name='Inception V3', ), # same weights as torchvision |
| 77 | + _entry('inception_v4', 'Inception V4', '1602.07261'), |
| 78 | + _entry('mixnet_l', 'MixNet-L', '1907.09595'), |
| 79 | + _entry('mixnet_m', 'MixNet-M', '1907.09595'), |
| 80 | + _entry('mixnet_s', 'MixNet-S', '1907.09595'), |
| 81 | + _entry('mnasnet_100', 'MnasNet-B1', '1807.11626'), |
| 82 | + _entry('mobilenetv3_100', 'MobileNet V3(1.0)', '1905.02244'), |
| 83 | + _entry('nasnetalarge', 'NASNet-A Large', '1707.07012', batch_size=BATCH_SIZE//4), |
| 84 | + _entry('pnasnet5large', 'PNASNet-5', '1712.00559', batch_size=BATCH_SIZE//4), |
| 85 | + _entry('resnet18', 'ResNet-18', '1812.01187'), |
| 86 | + _entry('resnet26', 'ResNet-26', '1812.01187'), |
| 87 | + _entry('resnet26d', 'ResNet-26-D', '1812.01187'), |
| 88 | + _entry('resnet34', 'ResNet-34', '1812.01187'), |
| 89 | + _entry('resnet50', 'ResNet-50', '1812.01187'), |
| 90 | + #_entry('resnet101', , ), # same weights as torchvision |
| 91 | + #_entry('resnet152', , ), # same weights as torchvision |
| 92 | + _entry('resnext50_32x4d', 'ResNeXt-50 32x4d', '1812.01187'), |
| 93 | + _entry('resnext50d_32x4d', 'ResNeXt-50-D 32x4d', '1812.01187'), |
| 94 | + #_entry('resnext101_32x8d', ), # same weights as torchvision |
| 95 | + _entry('semnasnet_100', 'MnasNet-A1', '1807.11626'), |
| 96 | + _entry('senet154', 'SENet-154', '1709.01507'), |
| 97 | + _entry('seresnet18', 'SE-ResNet-18', '1709.01507'), |
| 98 | + _entry('seresnet34', 'SE-ResNet-34', '1709.01507'), |
| 99 | + _entry('seresnet50', 'SE-ResNet-50', '1709.01507'), |
| 100 | + _entry('seresnet101', 'SE-ResNet-101', '1709.01507'), |
| 101 | + _entry('seresnet152', 'SE-ResNet-152', '1709.01507'), |
| 102 | + _entry('seresnext26_32x4d', 'SE-ResNeXt-26 32x4d', '1709.01507'), |
| 103 | + _entry('seresnext50_32x4d', 'SE-ResNeXt-50 32x4d', '1709.01507'), |
| 104 | + _entry('seresnext101_32x4d', 'SE-ResNeXt-101 32x4d', '1709.01507'), |
| 105 | + _entry('spnasnet_100', 'Single-Path NAS', '1904.02877'), |
| 106 | + _entry('tf_efficientnet_b0', 'EfficientNet-B0 (AutoAugment)', '1905.11946'), |
| 107 | + _entry('tf_efficientnet_b1', 'EfficientNet-B1 (AutoAugment)', '1905.11946'), |
| 108 | + _entry('tf_efficientnet_b2', 'EfficientNet-B2 (AutoAugment)', '1905.11946'), |
| 109 | + _entry('tf_efficientnet_b3', 'EfficientNet-B3 (AutoAugment)', '1905.11946', batch_size=BATCH_SIZE//2), |
| 110 | + _entry('tf_efficientnet_b4', 'EfficientNet-B4 (AutoAugment)', '1905.11946', batch_size=BATCH_SIZE//2), |
| 111 | + _entry('tf_efficientnet_b5', 'EfficientNet-B5 (AutoAugment)', '1905.11946', batch_size=BATCH_SIZE//4), |
| 112 | + _entry('tf_efficientnet_b6', 'EfficientNet-B6 (AutoAugment)', '1905.11946', batch_size=BATCH_SIZE//8), |
| 113 | + _entry('tf_efficientnet_b7', 'EfficientNet-B7 (AutoAugment)', '1905.11946', batch_size=BATCH_SIZE//8), |
| 114 | + _entry('tf_efficientnet_es', 'EfficientNet-EdgeTPU-S', '1905.11946'), |
| 115 | + _entry('tf_efficientnet_em', 'EfficientNet-EdgeTPU-M', '1905.11946'), |
| 116 | + _entry('tf_efficientnet_el', 'EfficientNet-EdgeTPU-L', '1905.11946', batch_size=BATCH_SIZE//2), |
| 117 | + _entry('tf_inception_v3', 'Inception V3', '1512.00567'), |
| 118 | + _entry('tf_mixnet_l', 'MixNet-L', '1907.09595'), |
| 119 | + _entry('tf_mixnet_m', 'MixNet-M', '1907.09595'), |
| 120 | + _entry('tf_mixnet_s', 'MixNet-S', '1907.09595'), |
| 121 | + #_entry('tv_resnet34', , ), # same weights as torchvision |
| 122 | + #_entry('tv_resnet50', , ), # same weights as torchvision |
| 123 | + #_entry('tv_resnext50_32x4d', , ), # same weights as torchvision |
| 124 | + #_entry('wide_resnet50_2' , ), # same weights as torchvision |
| 125 | + #_entry('wide_resnet101_2', , ), # same weights as torchvision |
| 126 | + _entry('xception', 'Xception', '1610.02357'), |
| 127 | +] |
195 | 128 |
|
196 | | -for model_name in model_names: |
197 | | - if model_name not in model_map: |
198 | | - print('Skipping %s' % model_name) |
199 | | - continue |
200 | 129 |
|
| 130 | +for m in model_list: |
| 131 | + model_name = m['model'] |
201 | 132 | # create model from name |
202 | 133 | model = create_model(model_name, pretrained=True) |
203 | 134 | param_count = sum([m.numel() for m in model.parameters()]) |
204 | | - print('Model %s created, param count: %d' % (model_name, param_count)) |
| 135 | + print('Model %s, %s created. Param count: %d' % (model_name, m['paper_model_name'], param_count)) |
205 | 136 |
|
206 | 137 | # get appropriate transform for model's default pretrained config |
207 | | - data_config = resolve_data_config(dict(), model=model, verbose=True) |
| 138 | + data_config = resolve_data_config(m['args'], model=model, verbose=True) |
| 139 | + if m['ttp']: |
| 140 | + model = TestTimePoolHead(model, model.default_cfg['pool_size']) |
| 141 | + data_config['crop_pct'] = 1.0 |
208 | 142 | input_transform = create_transform(**data_config) |
209 | 143 |
|
210 | 144 | # Run the benchmark |
211 | 145 | ImageNet.benchmark( |
212 | 146 | model=model, |
213 | | - paper_model_name=model_map[model_name]['paper_model_name'], |
214 | | - paper_arxiv_id=model_map[model_name]['paper_arxiv_id'], |
| 147 | + paper_model_name=m['paper_model_name'], |
| 148 | + paper_arxiv_id=m['paper_arxiv_id'], |
215 | 149 | input_transform=input_transform, |
216 | | - batch_size=model_map[model_name]['batch_size'], |
| 150 | + batch_size=m['batch_size'], |
217 | 151 | num_gpu=NUM_GPU, |
218 | 152 | data_root=os.environ.get('IMAGENET_DIR', './imagenet') |
219 | 153 | ) |
|
0 commit comments