From 94bcdebd73c9a5bc77789d3f82ab92ed528aee32 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Fri, 18 Mar 2022 21:31:13 -0700 Subject: [PATCH] Add latest weights trained on TPU-v3 VM instances --- timm/models/byobnet.py | 6 +++--- timm/models/helpers.py | 10 ---------- timm/models/regnet.py | 28 +++++++++++++++++++++------- timm/models/resnet.py | 8 ++++---- timm/models/resnetv2.py | 22 +++++++--------------- timm/models/xception_aligned.py | 14 +++++++++++--- 6 files changed, 46 insertions(+), 42 deletions(-) diff --git a/timm/models/byobnet.py b/timm/models/byobnet.py index 18bd53af..c24ca0e7 100644 --- a/timm/models/byobnet.py +++ b/timm/models/byobnet.py @@ -160,10 +160,10 @@ default_cfgs = { input_size=(3, 224, 224), pool_size=(7, 7), test_input_size=(3, 288, 288), first_conv='stem.conv', crop_pct=0.94), 'regnetz_c16_evos': _cfgr( - url='', - mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), test_input_size=(3, 320, 320), first_conv='stem.conv', crop_pct=0.94), + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnetz_c16_evos_ch-d8311942.pth', + mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), test_input_size=(3, 320, 320), first_conv='stem.conv', crop_pct=0.95), 'regnetz_d8_evos': _cfgr( - url='', + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnetz_d8_evos_ch-2bc12646.pth', mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), test_input_size=(3, 320, 320), crop_pct=0.95), } diff --git a/timm/models/helpers.py b/timm/models/helpers.py index 96d3bd7f..9afe3607 100644 --- a/timm/models/helpers.py +++ b/timm/models/helpers.py @@ -407,16 +407,6 @@ def pretrained_cfg_for_features(pretrained_cfg): return pretrained_cfg -# def overlay_external_pretrained_cfg(pretrained_cfg, kwargs): -# """ Overlay 'external_pretrained_cfg' in kwargs on top of pretrained_cfg arg. -# """ -# external_pretrained_cfg = kwargs.pop('external_pretrained_cfg', None) -# if external_pretrained_cfg: -# pretrained_cfg.pop('url', None) # url should come from external cfg -# pretrained_cfg.pop('hf_hub', None) # hf hub id should come from external cfg -# pretrained_cfg.update(external_pretrained_cfg) - - def set_default_kwargs(kwargs, names, pretrained_cfg): for n in names: # for legacy reasons, model __init__args uses img_size + in_chans as separate args while diff --git a/timm/models/regnet.py b/timm/models/regnet.py index 653ac6d5..4cf4a698 100644 --- a/timm/models/regnet.py +++ b/timm/models/regnet.py @@ -137,9 +137,15 @@ default_cfgs = dict( regnety_032=_cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/regnety_032_ra-7f2439f9.pth', crop_pct=1.0, test_input_size=(3, 288, 288)), - regnety_040=_cfg(url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-regnet/regnety_040-f0d569f9.pth'), - regnety_064=_cfg(url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-regnet/regnety_064-0a48325c.pth'), - regnety_080=_cfg(url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-regnet/regnety_080-e7f3eb93.pth'), + regnety_040=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnety_040_ra3-670e1166.pth', + crop_pct=1.0, test_input_size=(3, 288, 288)), + regnety_064=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnety_064_ra3-aa26dc7d.pth', + crop_pct=1.0, test_input_size=(3, 288, 288)), + regnety_080=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnety_080_ra3-1fdc4344.pth', + crop_pct=1.0, test_input_size=(3, 288, 288)), regnety_120=_cfg(url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-regnet/regnety_120-721ba79a.pth'), regnety_160=_cfg( url='https://dl.fbaipublicfiles.com/deit/regnety_160-a5fe301d.pth', # from Facebook DeiT GitHub repository @@ -147,12 +153,20 @@ default_cfgs = dict( regnety_320=_cfg(url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-regnet/regnety_320-ba464b29.pth'), regnety_040s_gn=_cfg(url=''), - regnetv_040=_cfg(url='', first_conv='stem'), - regnetv_064=_cfg(url='', first_conv='stem'), + regnetv_040=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnetv_040_ra3-c248f51f.pth', + first_conv='stem'), + regnetv_064=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnetv_064_ra3-530616c2.pth', + first_conv='stem'), regnetz_005=_cfg(url=''), - regnetz_040=_cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), - regnetz_040h=_cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), + regnetz_040=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnetz_040_ra3-9007edf5.pth', + input_size=(3, 256, 256), pool_size=(8, 8), crop_pct=1.0, test_input_size=(3, 320, 320)), + regnetz_040h=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/regnetz_040h_ra3-f594343b.pth', + input_size=(3, 256, 256), pool_size=(8, 8), crop_pct=1.0, test_input_size=(3, 320, 320)), ) diff --git a/timm/models/resnet.py b/timm/models/resnet.py index 4428f2ca..33366ae7 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -106,7 +106,7 @@ default_cfgs = { 'resnext101_32x4d': _cfg(url=''), 'resnext101_32x8d': _cfg(url='https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth'), 'resnext101_64x4d': _cfg( - url='', + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/resnext101_64x4d_c-0d0e0cc0.pth', interpolation='bicubic', crop_pct=1.0, test_input_size=(3, 288, 288)), 'tv_resnext50_32x4d': _cfg(url='https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth'), @@ -197,8 +197,8 @@ default_cfgs = { url='', interpolation='bicubic'), 'seresnext101_32x8d': _cfg( - url='', - interpolation='bicubic'), + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/seresnext101_32x8d_ah-e6bc4c0a.pth', + interpolation='bicubic', test_input_size=(3, 288, 288), crop_pct=1.0), 'senet154': _cfg( url='', interpolation='bicubic', @@ -283,7 +283,7 @@ default_cfgs = { input_size=(3, 256, 256), pool_size=(8, 8), crop_pct=1.0, test_input_size=(3, 320, 320), interpolation='bicubic', first_conv='conv1.0'), 'resnetrs200': _cfg( - url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rs-weights/resnetrs200_ema-623d2f59.pth', + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/resnetrs200_c-6b698b88.pth', input_size=(3, 256, 256), pool_size=(8, 8), crop_pct=1.0, test_input_size=(3, 320, 320), interpolation='bicubic', first_conv='conv1.0'), 'resnetrs270': _cfg( diff --git a/timm/models/resnetv2.py b/timm/models/resnetv2.py index b13d0960..09b6207a 100644 --- a/timm/models/resnetv2.py +++ b/timm/models/resnetv2.py @@ -122,13 +122,13 @@ default_cfgs = { interpolation='bicubic', first_conv='stem.conv1'), 'resnetv2_50d_gn': _cfg( - interpolation='bicubic', first_conv='stem.conv1'), + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/resnetv2_50d_gn_ah-c415c11a.pth', + interpolation='bicubic', first_conv='stem.conv1', test_input_size=(3, 288, 288), crop_pct=0.95), 'resnetv2_50d_evob': _cfg( interpolation='bicubic', first_conv='stem.conv1'), - 'resnetv2_50d_evos0': _cfg( - interpolation='bicubic', first_conv='stem.conv1'), - 'resnetv2_50d_evos1': _cfg( - interpolation='bicubic', first_conv='stem.conv1'), + 'resnetv2_50d_evos': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/resnetv2_50d_evos_ah-7c4dd548.pth', + interpolation='bicubic', first_conv='stem.conv1', test_input_size=(3, 288, 288), crop_pct=0.95), 'resnetv2_50d_frn': _cfg( interpolation='bicubic', first_conv='stem.conv1'), } @@ -693,21 +693,13 @@ def resnetv2_50d_evob(pretrained=False, **kwargs): @register_model -def resnetv2_50d_evos0(pretrained=False, **kwargs): +def resnetv2_50d_evos(pretrained=False, **kwargs): return _create_resnetv2( - 'resnetv2_50d_evos0', pretrained=pretrained, + 'resnetv2_50d_evos', pretrained=pretrained, layers=[3, 4, 6, 3], conv_layer=create_conv2d, norm_layer=EvoNorm2dS0, stem_type='deep', avg_down=True, **kwargs) -@register_model -def resnetv2_50d_evos1(pretrained=False, **kwargs): - return _create_resnetv2( - 'resnetv2_50d_evos1', pretrained=pretrained, - layers=[3, 4, 6, 3], conv_layer=create_conv2d, norm_layer=partial(EvoNorm2dS1, group_size=16), - stem_type='deep', avg_down=True, **kwargs) - - @register_model def resnetv2_50d_frn(pretrained=False, **kwargs): return _create_resnetv2( diff --git a/timm/models/xception_aligned.py b/timm/models/xception_aligned.py index e4f66bd3..52fe57da 100644 --- a/timm/models/xception_aligned.py +++ b/timm/models/xception_aligned.py @@ -34,12 +34,20 @@ default_cfgs = dict( xception41=_cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_xception_41-e6439c97.pth'), xception65=_cfg( - url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_xception_65-c9ae96e8.pth'), + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/xception65_ra3-1447db8d.pth', + crop_pct=0.94, + ), xception71=_cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_xception_71-8eec7df1.pth'), - xception41p=_cfg(url=''), - xception65p=_cfg(url=''), + xception41p=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/xception41p_ra3-33195bc8.pth', + crop_pct=0.94, + ), + xception65p=_cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tpu-weights/xception65p_ra3-3c6114e4.pth', + crop_pct=0.94, + ), )