Skip to content

Commit 5f1c8b8

Browse files
committed
Add some weights for efficientnet_x / efficientnet_h models to validate variants that have yet to be used
1 parent 625386b commit 5f1c8b8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

timm/models/efficientnet.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,14 @@ def _create_effnet(variant, pretrained=False, **kwargs):
458458
kwargs_filter = ('num_classes', 'num_features', 'head_conv', 'global_pool')
459459
model_cls = EfficientNetFeatures
460460
features_mode = 'cls'
461+
pretrained_strict = kwargs.pop('pretrained_strict', True)
461462

462463
model = build_model_with_cfg(
463464
model_cls,
464465
variant,
465466
pretrained,
466467
features_only=features_mode == 'cfg',
467-
pretrained_strict=features_mode != 'cls',
468+
pretrained_strict=pretrained_strict and features_mode != 'cls',
468469
kwargs_filter=kwargs_filter,
469470
**kwargs,
470471
)
@@ -1446,12 +1447,16 @@ def _cfg(url='', **kwargs):
14461447
'efficientnet_b3_g8_gn.untrained': _cfg(
14471448
input_size=(3, 288, 288), pool_size=(9, 9), test_input_size=(3, 320, 320), crop_pct=1.0),
14481449
'efficientnet_blur_b0.untrained': _cfg(),
1449-
'efficientnet_h_b5.untrained': _cfg(
1450-
url='', input_size=(3, 448, 448), pool_size=(14, 14), crop_pct=1.0),
1450+
'efficientnet_h_b5.sw_r448_e450_in1k': _cfg(
1451+
hf_hub_id='timm/',
1452+
input_size=(3, 448, 448), pool_size=(14, 14), crop_pct=1.0,
1453+
crop_mode='squash', test_input_size=(3, 576, 576)),
14511454
'efficientnet_x_b3.untrained': _cfg(
14521455
url='', input_size=(3, 288, 288), pool_size=(9, 9), crop_pct=0.95),
1453-
'efficientnet_x_b5.untrained': _cfg(
1454-
url='', input_size=(3, 448, 448), pool_size=(14, 14), crop_pct=1.0),
1456+
'efficientnet_x_b5.sw_r448_e450_in1k': _cfg(
1457+
hf_hub_id='timm/',
1458+
input_size=(3, 448, 448), pool_size=(14, 14), crop_pct=1.0,
1459+
crop_mode='squash', test_input_size=(3, 576, 576)),
14551460

14561461
'efficientnet_es.ra_in1k': _cfg(
14571462
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_es_ra-f111e99c.pth',

0 commit comments

Comments
 (0)