From b1f1228a41dd9cac238dd7676c2bc6aa60940f02 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Fri, 18 Dec 2020 17:13:37 -0800 Subject: [PATCH] Add ResNet101D, 152D, and 200D weights, remove meh 66d model --- README.md | 6 ++++++ timm/models/resnet.py | 32 ++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b08984ac..5b24c0fc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ ## What's New +### Dec 18, 2020 +* Add ResNet-101D, ResNet-152D, and ResNet-200D weights trained @ 256x256 + * 256x256 val (top-1) - 101D (82.33), 152D (83.08), 200D (83.25) + * 288x288 val, 1.0 crop - 101D (82.64), 152D (83.48), 200D (83.76) + * 320x320 val, 1.0 crop - 101D (83.00), 152D (83.66), 200D (84.01) + ### Dec 7, 2020 * Simplify EMA module (ModelEmaV2), compatible with fully torchscripted models * Misc fixes for SiLU ONNX export, default_cfg missing from Feature extraction models, Linear layer w/ AMP + torchscript diff --git a/timm/models/resnet.py b/timm/models/resnet.py index c2cc55fd..052e941c 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -55,13 +55,18 @@ default_cfgs = { 'resnet50d': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth', interpolation='bicubic', first_conv='conv1.0'), - 'resnet66d': _cfg(url='', interpolation='bicubic', first_conv='conv1.0'), 'resnet101': _cfg(url='', interpolation='bicubic'), - 'resnet101d': _cfg(url='', interpolation='bicubic', first_conv='conv1.0'), + '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), 'resnet152': _cfg(url='', interpolation='bicubic'), - 'resnet152d': _cfg(url='', interpolation='bicubic', first_conv='conv1.0'), + '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), 'resnet200': _cfg(url='', interpolation='bicubic'), - 'resnet200d': _cfg(url='', interpolation='bicubic', first_conv='conv1.0'), + 'resnet200d': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet200d_ra2-bdba9bf9.pth', + interpolation='bicubic', first_conv='conv1.0', input_size=(3, 256, 256), crop_pct=0.94), 'tv_resnet34': _cfg(url='https://download.pytorch.org/models/resnet34-333f7ec4.pth'), 'tv_resnet50': _cfg(url='https://download.pytorch.org/models/resnet50-19c8e357.pth'), 'tv_resnet101': _cfg(url='https://download.pytorch.org/models/resnet101-5d3b4d8f.pth'), @@ -142,6 +147,9 @@ default_cfgs = { 'seresnet152': _cfg( url='', interpolation='bicubic'), + 'seresnet152d': _cfg( + url='', + interpolation='bicubic', first_conv='conv1.0', input_size=(3, 256, 256), crop_pct=0.94), # Squeeze-Excitation ResNeXts, to eventually replace the models in senet.py 'seresnext26_32x4d': _cfg( @@ -683,14 +691,6 @@ def resnet50d(pretrained=False, **kwargs): return _create_resnet('resnet50d', pretrained, **model_args) -@register_model -def resnet66d(pretrained=False, **kwargs): - """Constructs a ResNet-66-D model. - """ - model_args = dict(block=BasicBlock, layers=[3, 4, 23, 3], stem_width=32, stem_type='deep', avg_down=True, **kwargs) - return _create_resnet('resnet66d', pretrained, **model_args) - - @register_model def resnet101(pretrained=False, **kwargs): """Constructs a ResNet-101 model. @@ -1151,6 +1151,14 @@ def seresnet152(pretrained=False, **kwargs): return _create_resnet('seresnet152', pretrained, **model_args) +@register_model +def seresnet152d(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', pretrained, **model_args) + + @register_model def seresnext26_32x4d(pretrained=False, **kwargs): model_args = dict(