From e6263bf64d210b80f1a05ff5346415a0c2163886 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Thu, 31 Oct 2024 15:40:36 -0700 Subject: [PATCH] Add resnet and resnet-v2 18/34 weights trained with mnv4 small based recipe --- timm/models/resnet.py | 6 ++++++ timm/models/resnetv2.py | 22 ++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/timm/models/resnet.py b/timm/models/resnet.py index 432b1182d2..280463e172 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -711,6 +711,9 @@ def _gcfg(url='', **kwargs): hf_hub_id='timm/', url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet18d_ra2-48a79e06.pth', first_conv='conv1.0'), + 'resnet18d.ra4_e3600_r224_in1k': _rcfg( + hf_hub_id='timm/', + mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), crop_pct=0.9), 'resnet34.a1_in1k': _rcfg( hf_hub_id='timm/', url='https://github.com/huggingface/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet34_a1_0-46f8f793.pth'), @@ -724,6 +727,9 @@ def _gcfg(url='', **kwargs): 'resnet34.bt_in1k': _ttcfg( hf_hub_id='timm/', url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet34-43635321.pth'), + 'resnet34.ra4_e3600_r224_in1k': _rcfg( + hf_hub_id='timm/', + mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5), crop_pct=0.9), 'resnet34d.ra2_in1k': _ttcfg( hf_hub_id='timm/', url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet34d_ra2-f8dcfcaf.pth', diff --git a/timm/models/resnetv2.py b/timm/models/resnetv2.py index e857e7a9d4..6a13af48d6 100644 --- a/timm/models/resnetv2.py +++ b/timm/models/resnetv2.py @@ -696,14 +696,20 @@ def _cfg(url='', **kwargs): hf_hub_id='timm/', num_classes=21843, custom_load=True), - 'resnetv2_18.untrained': _cfg( - 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_18.ra4_e3600_r224_in1k': _cfg( + hf_hub_id='timm/', + interpolation='bicubic', crop_pct=0.9, test_input_size=(3, 288, 288), test_crop_pct=1.0), + 'resnetv2_18d.ra4_e3600_r224_in1k': _cfg( + hf_hub_id='timm/', + interpolation='bicubic', crop_pct=0.9, test_input_size=(3, 288, 288), test_crop_pct=1.0, + first_conv='stem.conv1'), + 'resnetv2_34.ra4_e3600_r224_in1k': _cfg( + hf_hub_id='timm/', + interpolation='bicubic', crop_pct=0.9, test_input_size=(3, 288, 288), test_crop_pct=1.0), + 'resnetv2_34d.ra4_e3600_r224_in1k': _cfg( + hf_hub_id='timm/', + interpolation='bicubic', crop_pct=0.9, test_input_size=(3, 288, 288), test_crop_pct=1.0, + 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),