From 4e2533db774f50cc7a6694f0aafcb5511a7ad723 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Sun, 3 Jan 2021 11:25:07 -0800 Subject: [PATCH] Add 320x320 model default cfgs for 101D and 152D ResNets. Add SEResNet-152D weights and 320x320 cfg. --- timm/models/resnet.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/timm/models/resnet.py b/timm/models/resnet.py index 43a7f32a..be0652bf 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -59,10 +59,16 @@ default_cfgs = { 'resnet101d': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet101d_ra2-2803ffab.pth', interpolation='bicubic', first_conv='conv1.0', input_size=(3, 256, 256), crop_pct=0.94, pool_size=(8, 8)), + 'resnet101d_320': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet101d_ra2-2803ffab.pth', + interpolation='bicubic', first_conv='conv1.0', input_size=(3, 320, 320), crop_pct=1.0, pool_size=(10, 10)), 'resnet152': _cfg(url='', interpolation='bicubic'), 'resnet152d': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet152d_ra2-5cac0439.pth', interpolation='bicubic', first_conv='conv1.0', input_size=(3, 256, 256), crop_pct=0.94, pool_size=(8, 8)), + 'resnet152d_320': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet152d_ra2-5cac0439.pth', + interpolation='bicubic', first_conv='conv1.0', input_size=(3, 320, 320), crop_pct=1.0, pool_size=(10, 10)), 'resnet200': _cfg(url='', interpolation='bicubic'), 'resnet200d': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet200d_ra2-bdba9bf9.pth', @@ -151,8 +157,12 @@ default_cfgs = { url='', interpolation='bicubic'), 'seresnet152d': _cfg( - url='', + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/seresnet152d_ra2-04464dd2.pth', interpolation='bicubic', first_conv='conv1.0', input_size=(3, 256, 256), crop_pct=0.94, pool_size=(8, 8)), + 'seresnet152d_320': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/seresnet152d_ra2-04464dd2.pth', + interpolation='bicubic', first_conv='conv1.0', input_size=(3, 320, 320), crop_pct=1.0, pool_size=(10, 10)), + # Squeeze-Excitation ResNeXts, to eventually replace the models in senet.py 'seresnext26_32x4d': _cfg( @@ -710,6 +720,14 @@ def resnet101d(pretrained=False, **kwargs): return _create_resnet('resnet101d', pretrained, **model_args) +@register_model +def resnet101d_320(pretrained=False, **kwargs): + """Constructs a ResNet-101-D model. + """ + model_args = dict(block=Bottleneck, layers=[3, 4, 23, 3], stem_width=32, stem_type='deep', avg_down=True, **kwargs) + return _create_resnet('resnet101d_320', pretrained, **model_args) + + @register_model def resnet152(pretrained=False, **kwargs): """Constructs a ResNet-152 model. @@ -727,6 +745,15 @@ def resnet152d(pretrained=False, **kwargs): return _create_resnet('resnet152d', pretrained, **model_args) +@register_model +def resnet152d_320(pretrained=False, **kwargs): + """Constructs a ResNet-152-D model. + """ + model_args = dict( + block=Bottleneck, layers=[3, 8, 36, 3], stem_width=32, stem_type='deep', avg_down=True, **kwargs) + return _create_resnet('resnet152d_320', pretrained, **model_args) + + @register_model def resnet200(pretrained=False, **kwargs): """Constructs a ResNet-200 model. @@ -1171,6 +1198,14 @@ def seresnet152d(pretrained=False, **kwargs): return _create_resnet('seresnet152d', pretrained, **model_args) +@register_model +def seresnet152d_320(pretrained=False, **kwargs): + model_args = dict( + block=Bottleneck, layers=[3, 8, 36, 3], stem_width=32, stem_type='deep', avg_down=True, + block_args=dict(attn_layer='se'), **kwargs) + return _create_resnet('seresnet152d_320', pretrained, **model_args) + + @register_model def seresnext26_32x4d(pretrained=False, **kwargs): model_args = dict(