Skip to content

Commit c1cf971

Browse files
committed
Add updated EfficientNet-V2S weights, 83.8 @ 384x384 test. Add PyTorch trained EfficientNet-B4 weights, 83.4 @ 384x384 test. Tweak non TF EfficientNet B1-B4 train/test res scaling.
1 parent e8a64fb commit c1cf971

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

timm/models/efficientnet.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,16 @@ def _cfg(url='', **kwargs):
8585
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b0_ra-3dd342df.pth'),
8686
'efficientnet_b1': _cfg(
8787
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b1-533bc792.pth',
88-
input_size=(3, 240, 240), pool_size=(8, 8)),
88+
test_input_size=(3, 256, 256), crop_pct=1.0),
8989
'efficientnet_b2': _cfg(
9090
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b2_ra-bcdf34b7.pth',
91-
input_size=(3, 260, 260), pool_size=(9, 9)),
92-
'efficientnet_b2a': _cfg(
93-
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b2_ra-bcdf34b7.pth',
94-
input_size=(3, 288, 288), pool_size=(9, 9), crop_pct=1.0),
91+
input_size=(3, 256, 256), pool_size=(8, 8), test_input_size=(3, 288, 288), crop_pct=1.0),
9592
'efficientnet_b3': _cfg(
9693
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b3_ra2-cf984f9c.pth',
97-
input_size=(3, 300, 300), pool_size=(10, 10), crop_pct=0.904),
98-
'efficientnet_b3a': _cfg(
99-
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b3_ra2-cf984f9c.pth',
100-
input_size=(3, 320, 320), pool_size=(10, 10), crop_pct=1.0),
94+
input_size=(3, 288, 288), pool_size=(9, 9), test_input_size=(3, 320, 320), crop_pct=1.0),
10195
'efficientnet_b4': _cfg(
102-
url='', input_size=(3, 380, 380), pool_size=(12, 12), crop_pct=0.922),
96+
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth',
97+
input_size=(3, 320, 320), pool_size=(10, 10), test_input_size=(3, 384, 384), crop_pct=1.0),
10398
'efficientnet_b5': _cfg(
10499
url='', input_size=(3, 456, 456), pool_size=(15, 15), crop_pct=0.934),
105100
'efficientnet_b6': _cfg(
@@ -155,8 +150,8 @@ def _cfg(url='', **kwargs):
155150
input_size=(3, 300, 300), pool_size=(10, 10), crop_pct=0.904, mean=IMAGENET_INCEPTION_MEAN, std=IMAGENET_INCEPTION_STD),
156151

157152
'efficientnet_v2s': _cfg(
158-
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_v2s_ra2-b265c1ba.pth',
159-
input_size=(3, 224, 224), test_input_size=(3, 320, 320), pool_size=(7, 7), crop_pct=1.0), # FIXME WIP
153+
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_v2s_ra2_288-a6477665.pth',
154+
input_size=(3, 288, 288), test_input_size=(3, 384, 384), pool_size=(9, 9), crop_pct=1.0), # FIXME WIP
160155

161156
'tf_efficientnet_b0': _cfg(
162157
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b0_aa-827b6e33.pth',
@@ -1077,10 +1072,8 @@ def efficientnet_b2(pretrained=False, **kwargs):
10771072
@register_model
10781073
def efficientnet_b2a(pretrained=False, **kwargs):
10791074
""" EfficientNet-B2 @ 288x288 w/ 1.0 test crop"""
1080-
# NOTE for train, drop_rate should be 0.3, drop_path_rate should be 0.2
1081-
model = _gen_efficientnet(
1082-
'efficientnet_b2a', channel_multiplier=1.1, depth_multiplier=1.2, pretrained=pretrained, **kwargs)
1083-
return model
1075+
# WARN this model def is deprecated, different train/test res + test crop handled by default_cfg now
1076+
return efficientnet_b2(pretrained=pretrained, **kwargs)
10841077

10851078

10861079
@register_model
@@ -1095,10 +1088,8 @@ def efficientnet_b3(pretrained=False, **kwargs):
10951088
@register_model
10961089
def efficientnet_b3a(pretrained=False, **kwargs):
10971090
""" EfficientNet-B3 @ 320x320 w/ 1.0 test crop-pct """
1098-
# NOTE for train, drop_rate should be 0.3, drop_path_rate should be 0.2
1099-
model = _gen_efficientnet(
1100-
'efficientnet_b3a', channel_multiplier=1.2, depth_multiplier=1.4, pretrained=pretrained, **kwargs)
1101-
return model
1091+
# WARN this model def is deprecated, different train/test res + test crop handled by default_cfg now
1092+
return efficientnet_b3(pretrained=pretrained, **kwargs)
11021093

11031094

11041095
@register_model

0 commit comments

Comments
 (0)