Skip to content

Commit

Permalink
Add 34/34d pre-act resnet variants
Browse files Browse the repository at this point in the history
  • Loading branch information
rwightman committed Oct 14, 2024
1 parent 72f0edb commit abdf331
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions timm/models/resnetv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,10 @@ def _cfg(url='', **kwargs):
interpolation='bicubic', crop_pct=0.95),
'resnetv2_18d.untrained': _cfg(
interpolation='bicubic', crop_pct=0.95, first_conv='stem.conv1'),
'resnetv2_34.untrained': _cfg(
interpolation='bicubic', crop_pct=0.95),
'resnetv2_34d.untrained': _cfg(
interpolation='bicubic', crop_pct=0.95, first_conv='stem.conv1'),
'resnetv2_50.a1h_in1k': _cfg(
hf_hub_id='timm/',
interpolation='bicubic', crop_pct=0.95, test_input_size=(3, 288, 288), test_crop_pct=1.0),
Expand Down Expand Up @@ -784,6 +788,24 @@ def resnetv2_18d(pretrained=False, **kwargs) -> ResNetV2:
return _create_resnetv2('resnetv2_18d', pretrained=pretrained, **dict(model_args, **kwargs))


@register_model
def resnetv2_34(pretrained=False, **kwargs) -> ResNetV2:
model_args = dict(
layers=(3, 4, 6, 3), channels=(64, 128, 256, 512), basic=True, bottle_ratio=1.0,
conv_layer=create_conv2d, norm_layer=BatchNormAct2d
)
return _create_resnetv2('resnetv2_34', pretrained=pretrained, **dict(model_args, **kwargs))


@register_model
def resnetv2_34d(pretrained=False, **kwargs) -> ResNetV2:
model_args = dict(
layers=(3, 4, 6, 3), channels=(64, 128, 256, 512), basic=True, bottle_ratio=1.0,
conv_layer=create_conv2d, norm_layer=BatchNormAct2d, stem_type='deep', avg_down=True
)
return _create_resnetv2('resnetv2_34d', pretrained=pretrained, **dict(model_args, **kwargs))


@register_model
def resnetv2_50(pretrained=False, **kwargs) -> ResNetV2:
model_args = dict(layers=[3, 4, 6, 3], conv_layer=create_conv2d, norm_layer=BatchNormAct2d)
Expand Down

0 comments on commit abdf331

Please sign in to comment.