opensi·si

timm/models/resnet.py ·

ResNet

Category: CNN · Code: timm/models/resnet.py · Architectures: 81 · Pretrained weights: 150 (144 with ImageNet-1k results)

Residual networks (ResNet) and the variants built on the same ResNet class: ResNeXt grouped convolutions, Squeeze-and-Excitation (SE) and ECA channel attention, deep / tiered stems and average pool downsampling (the "c", "d", "s" and "t" variants), anti-aliased downsampling, Wide ResNet and ResNet-RS configurations.

Papers

  • Deep Residual Learning for Image Recognition
  • Bag of Tricks for Image Classification with Convolutional Neural Networks
  • Aggregated Residual Transformations for Deep Neural Networks
  • Wide Residual Networks
  • Squeeze-and-Excitation Networks
  • ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks
  • Making Convolutional Networks Shift-Invariant Again
  • Group Normalization
  • Revisiting ResNets: Improved Training and Scaling Strategies
  • ResNet strikes back: An improved training procedure in timm
  • Billion-scale semi-supervised learning for image classification
  • Exploring the Limits of Weakly Supervised Pretraining
  • Knapsack Pruning with Inner Distillation

Referenced by pretrained weights:

  • arXiv:2203.07845

Usage

See the Quickstart for loading pretrained weights, image preprocessing and fine-tuning, and Feature Extraction for using the models as backbones.

>>> import timm
>>> model = timm.create_model('resnet50.a1_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)

Model API support

Feature ResNet
features_only=True feature maps ✓ (strides 2, 4, 8, 16, 32)
forward_intermediates() ✓
prune_intermediate_layers() ✓
Any input size, no changes needed ✓
set_input_size() –
dynamic_img_size=True –
set_grad_checkpointing() ✓
Layer-wise LR decay (group_matcher()) ✓
reset_classifier() ✓

✓ supported, ✓ (square) works for square sizes only, ✗ not supported, – not needed (the model already accepts any input size). Checked by running each feature on a randomly initialized model (ResNet with resnet10t at 176), other architectures of the same class are expected to behave the same. See the Model API page for details.

Architectures

テーブル(82 行)
Architecture Params (M) GMACs Input size Pretrained weights
ecaresnet26t 16.01 3.35 256 1
ecaresnet50d 25.58 4.35 224 1
ecaresnet50d_pruned 19.94 2.53 224 1
ecaresnet50t 25.57 5.64 256 4
ecaresnet101d 44.57 8.08 224 1
ecaresnet101d_pruned 24.88 3.48 224 1
ecaresnet200d 64.69 20.00 256 0
ecaresnet269d 102.09 41.53 320 1
ecaresnetlight 30.16 4.11 224 1
ecaresnext26t_32x4d 15.41 2.70 224 0
ecaresnext50t_32x4d 25.05 - 224 0
resnet10t 5.44 0.70 176 1
resnet14t 10.08 1.07 176 1
resnet18 11.69 1.82 224 7
resnet18d 11.71 2.06 224 2
resnet26 16.00 2.36 224 1
resnet26d 16.01 2.60 224 1
resnet26t 16.01 3.35 256 1
resnet34 21.80 3.67 224 7
resnet34d 21.82 3.91 224 1
resnet50 25.56 4.11 224 19
resnet50_gn 25.56 4.14 224 1
resnet50c 25.58 4.35 224 1
resnet50d 25.58 4.35 224 6
resnet50s 25.68 5.47 224 1
resnet50t 25.57 4.32 224 0
resnet101 44.55 7.83 224 7
resnet101c 44.57 8.08 224 1
resnet101d 44.57 10.55 256 2
resnet101s 44.67 9.19 224 1
resnet152 60.19 11.56 224 7
resnet152c 60.21 11.80 224 1
resnet152d 60.21 15.41 256 2
resnet152s 60.32 12.92 224 1
resnet200 64.67 15.07 224 0
resnet200d 64.69 20.00 256 1
resnetaa34d 21.82 4.43 224 0
resnetaa50 25.56 5.15 224 1
resnetaa50d 25.58 5.39 224 3
resnetaa101d 44.57 9.12 224 2
resnetblur18 11.69 2.34 224 0
resnetblur50 25.56 5.16 224 1
resnetblur50d 25.58 5.40 224 0
resnetblur101d 44.57 9.12 224 0
resnetrs50 35.69 2.29 160 1
resnetrs101 63.62 6.04 192 1
resnetrs152 86.62 15.59 256 1
resnetrs200 93.21 20.18 256 1
resnetrs270 129.86 27.06 256 1
resnetrs350 163.96 43.67 288 1
resnetrs420 191.89 64.20 320 1
resnext50_32x4d 25.03 4.26 224 10
resnext50d_32x4d 25.05 4.50 224 1
resnext101_32x4d 44.18 8.01 224 3
resnext101_32x8d 88.79 16.48 224 5
resnext101_32x16d 194.03 36.27 224 3
resnext101_32x32d 468.53 87.29 224 1
resnext101_64x4d 83.46 15.52 224 3
senet154 115.09 20.77 224 1
seresnet18 11.78 1.82 224 0
seresnet34 21.96 3.67 224 0
seresnet50 28.09 4.11 224 4
seresnet50t 28.10 4.32 224 0
seresnet101 49.33 7.84 224 0
seresnet152 66.82 11.57 224 0
seresnet152d 66.84 15.42 256 1
seresnet200d 71.86 20.01 256 0
seresnet269d 113.67 26.59 256 0
seresnetaa50d 28.11 5.40 224 0
seresnext26d_32x4d 16.81 2.73 224 1
seresnext26t_32x4d 16.81 2.70 224 1
seresnext50_32x4d 27.56 4.26 224 2
seresnext101_32x4d 48.96 8.02 224 1
seresnext101_32x8d 93.57 16.48 224 1
seresnext101_64x4d 88.23 15.53 224 1
seresnext101d_32x8d 93.59 16.72 224 1
seresnextaa101d_32x8d 93.59 28.51 288 4
seresnextaa201d_32x8d 149.39 101.11 384 2
test_resnet 0.47 0.10 160 1
wide_resnet50_2 68.88 11.43 224 3
wide_resnet101_2 126.89 22.80 224 2

GMACs and parameter counts are for the default input size and classifier of each architecture, from the benchmark results.

Pretrained weights

Top-1 is ImageNet-1k validation accuracy from results-imagenet.csv at the listed eval size, - if the weight has no ImageNet-1k result (e.g. pretraining or image-text weights). Classes is the size of the pretrained classifier, none for weights without one.

Weights are grouped by source: the paper or origin given in the pretrained config, else a Hub organization other than timm, else the first part of the pretrained tag (architecture.tag). Sources with a single weight are listed under other.

ResNet strikes back

Pretrained configs reference ResNet strikes back: An improved training procedure in timm.

テーブル(45 行)
Weight Input size Top-1 (%) Eval size Classes License Hub
ecaresnet50t.a1_in1k 224 (test 288) 82.110 288 1000 apache-2.0 timm
ecaresnet50t.a2_in1k 224 (test 288) 81.682 288 1000 apache-2.0 timm
ecaresnet50t.a3_in1k 160 (test 224) 79.548 224 1000 apache-2.0 timm
resnet18.a1_in1k 224 (test 288) 73.164 288 1000 apache-2.0 timm
resnet18.a2_in1k 224 (test 288) 72.364 288 1000 apache-2.0 timm
resnet18.a3_in1k 160 (test 224) 68.250 224 1000 apache-2.0 timm
resnet18d.ra4_e3600_r224_in1k 224 (test 288) 76.012 288 1000 apache-2.0 timm
resnet34.a1_in1k 224 (test 288) 77.930 288 1000 apache-2.0 timm
resnet34.a2_in1k 224 (test 288) 77.150 288 1000 apache-2.0 timm
resnet34.a3_in1k 160 (test 224) 72.996 224 1000 apache-2.0 timm
resnet34.ra4_e3600_r224_in1k 224 (test 288) 78.972 288 1000 apache-2.0 timm
resnet50.a1_in1k 224 (test 288) 81.240 288 1000 apache-2.0 timm
resnet50.a1h_in1k 176 (test 224) 80.654 224 1000 apache-2.0 timm
resnet50.a2_in1k 224 (test 288) 80.774 288 1000 apache-2.0 timm
resnet50.a3_in1k 160 (test 224) 78.052 224 1000 apache-2.0 timm
resnet50.b1k_in1k 224 (test 288) 80.708 288 1000 apache-2.0 timm
resnet50.b2k_in1k 224 (test 288) 80.466 288 1000 apache-2.0 timm
resnet50.c1_in1k 224 (test 288) 80.928 288 1000 apache-2.0 timm
resnet50.c2_in1k 224 (test 288) 80.862 288 1000 apache-2.0 timm
resnet50.d_in1k 224 (test 288) 81.012 288 1000 apache-2.0 timm
resnet50d.a1_in1k 224 (test 288) 81.466 288 1000 apache-2.0 timm
resnet50d.a2_in1k 224 (test 288) 81.164 288 1000 apache-2.0 timm
resnet50d.a3_in1k 160 (test 224) 78.742 224 1000 apache-2.0 timm
resnet50d.ra4_e3600_r224_in1k 224 (test 288) 81.840 288 1000 apache-2.0 timm
resnet101.a1_in1k 224 (test 288) 82.326 288 1000 apache-2.0 timm
resnet101.a1h_in1k 224 (test 288) 82.796 288 1000 apache-2.0 timm
resnet101.a2_in1k 224 (test 288) 82.218 288 1000 apache-2.0 timm
resnet101.a3_in1k 160 (test 224) 79.836 224 1000 apache-2.0 timm
resnet152.a1_in1k 224 (test 288) 82.742 288 1000 apache-2.0 timm
resnet152.a1h_in1k 224 (test 288) 83.494 288 1000 apache-2.0 timm
resnet152.a2_in1k 224 (test 288) 82.614 288 1000 apache-2.0 timm
resnet152.a3_in1k 160 (test 224) 80.548 224 1000 apache-2.0 timm
resnetaa50.a1h_in1k 224 (test 288) 81.618 288 1000 apache-2.0 timm
resnext50_32x4d.a1_in1k 224 (test 288) 81.480 288 1000 apache-2.0 timm
resnext50_32x4d.a1h_in1k 224 (test 288) 82.016 288 1000 apache-2.0 timm
resnext50_32x4d.a2_in1k 224 (test 288) 81.304 288 1000 apache-2.0 timm
resnext50_32x4d.a3_in1k 160 (test 224) 79.258 224 1000 apache-2.0 timm
resnext101_64x4d.c1_in1k 224 (test 288) 83.158 288 1000 apache-2.0 timm
seresnet50.a1_in1k 224 (test 288) 81.114 288 1000 apache-2.0 timm
seresnet50.a2_in1k 224 (test 288) 81.094 288 1000 apache-2.0 timm
seresnet50.a3_in1k 160 (test 224) 77.036 224 1000 apache-2.0 timm
seresnext101_32x8d.ah_in1k 224 (test 288) 84.192 288 1000 apache-2.0 timm
seresnext101d_32x8d.ah_in1k 224 (test 288) 84.380 288 1000 apache-2.0 timm
seresnextaa101d_32x8d.ah_in1k 224 (test 288) 84.580 288 1000 apache-2.0 timm

huggingface/pytorch-image-models

Origin: github.com/huggingface/pytorch-image-models

テーブル(36 行)
Weight Input size Top-1 (%) Eval size Classes License Hub
ecaresnet26t.ra2_in1k 256 (test 320) 79.900 320 1000 apache-2.0 timm
ecaresnet269d.ra2_in1k 320 (test 352) 84.968 352 1000 apache-2.0 timm
resnet10t.c3_in1k 176 (test 224) 68.354 224 1000 apache-2.0 timm
resnet14t.c3_in1k 176 (test 224) 72.242 224 1000 apache-2.0 timm
resnet18d.ra2_in1k 224 (test 288) 73.790 288 1000 apache-2.0 timm
resnet26.bt_in1k 224 (test 288) 76.384 288 1000 apache-2.0 timm
resnet26d.bt_in1k 224 (test 288) 77.422 288 1000 apache-2.0 timm
resnet26t.ra2_in1k 256 (test 320) 78.330 320 1000 apache-2.0 timm
resnet34.bt_in1k 224 (test 288) 76.506 288 1000 apache-2.0 timm
resnet34d.ra2_in1k 224 (test 288) 78.440 288 1000 apache-2.0 timm
resnet50.bt_in1k 224 (test 288) 79.652 288 1000 apache-2.0 timm
resnet50.ra_in1k 224 (test 288) 79.864 288 1000 apache-2.0 timm
resnet50.ram_in1k 224 (test 288) 79.982 288 1000 apache-2.0 timm
resnet50_gn.a1h_in1k 224 (test 288) 81.216 288 1000 apache-2.0 timm
resnet50d.ra2_in1k 224 (test 288) 81.354 288 1000 apache-2.0 timm
resnet101d.ra2_in1k 256 (test 320) 83.020 320 1000 apache-2.0 timm
resnet152d.ra2_in1k 256 (test 320) 83.684 320 1000 apache-2.0 timm
resnet200d.ra2_in1k 256 (test 320) 83.976 320 1000 apache-2.0 timm
resnetaa50d.d_in12k 224 (test 288) - - 11821 apache-2.0 timm
resnetaa50d.sw_in12k 224 (test 288) - - 11821 apache-2.0 timm
resnetaa50d.sw_in12k_ft_in1k 224 (test 288) 82.656 288 1000 apache-2.0 timm
resnetaa101d.sw_in12k 224 (test 288) - - 11821 apache-2.0 timm
resnetaa101d.sw_in12k_ft_in1k 224 (test 288) 84.114 288 1000 apache-2.0 timm
resnetblur50.bt_in1k 224 (test 288) 80.248 288 1000 apache-2.0 timm
resnext50_32x4d.ra_in1k 224 (test 288) 80.720 288 1000 apache-2.0 timm
resnext50d_32x4d.bt_in1k 224 (test 288) 80.676 288 1000 apache-2.0 timm
seresnet50.ra2_in1k 224 (test 288) 81.288 288 1000 apache-2.0 timm
seresnet152d.ra2_in1k 256 (test 320) 84.344 320 1000 apache-2.0 timm
seresnext26d_32x4d.bt_in1k 224 (test 288) 78.816 288 1000 apache-2.0 timm
seresnext26t_32x4d.bt_in1k 224 (test 288) 78.736 288 1000 apache-2.0 timm
seresnext50_32x4d.racm_in1k 224 (test 288) 82.186 288 1000 apache-2.0 timm
seresnextaa101d_32x8d.sw_in12k 224 (test 288) - - 11821 apache-2.0 timm
seresnextaa101d_32x8d.sw_in12k_ft_in1k 224 (test 288) 86.524 288 1000 apache-2.0 timm
seresnextaa101d_32x8d.sw_in12k_ft_in1k_288 288 (test 320) 86.722 320 1000 apache-2.0 timm
wide_resnet50_2.racm_in1k 224 (test 288) 82.260 288 1000 apache-2.0 timm

cv.gluon.ai

Origin: cv.gluon.ai/model_zoo/classification.html

テーブル(22 行)
Weight Input size Top-1 (%) Eval size Classes License Hub
resnet18.gluon_in1k 224 70.844 224 1000 apache-2.0 timm
resnet34.gluon_in1k 224 74.574 224 1000 apache-2.0 timm
resnet50.gluon_in1k 224 77.580 224 1000 apache-2.0 timm
resnet50c.gluon_in1k 224 78.016 224 1000 apache-2.0 timm
resnet50d.gluon_in1k 224 79.080 224 1000 apache-2.0 timm
resnet50s.gluon_in1k 224 78.710 224 1000 apache-2.0 timm
resnet101.gluon_in1k 224 79.306 224 1000 apache-2.0 timm
resnet101c.gluon_in1k 224 79.542 224 1000 apache-2.0 timm
resnet101d.gluon_in1k 224 80.466 224 1000 apache-2.0 timm
resnet101s.gluon_in1k 224 80.278 224 1000 apache-2.0 timm
resnet152.gluon_in1k 224 79.712 224 1000 apache-2.0 timm
resnet152c.gluon_in1k 224 79.904 224 1000 apache-2.0 timm
resnet152d.gluon_in1k 224 80.476 224 1000 apache-2.0 timm
resnet152s.gluon_in1k 224 81.048 224 1000 apache-2.0 timm
resnext50_32x4d.gluon_in1k 224 79.354 224 1000 apache-2.0 timm
resnext101_32x4d.gluon_in1k 224 80.336 224 1000 apache-2.0 timm
resnext101_64x4d.gluon_in1k 224 80.640 224 1000 apache-2.0 timm
senet154.gluon_in1k 224 81.258 224 1000 apache-2.0 timm
seresnext50_32x4d.gluon_in1k 224 79.916 224 1000 apache-2.0 timm
seresnext101_32x4d.gluon_in1k 224 80.886 224 1000 apache-2.0 timm
seresnext101_64x4d.gluon_in1k 224 80.884 224 1000 apache-2.0 timm

pytorch/vision

Origin: github.com/pytorch/vision

テーブル(18 行)
Weight Input size Top-1 (%) Eval size Classes License Hub
resnet18.tv_in1k 224 69.752 224 1000 bsd-3-clause timm
resnet34.tv_in1k 224 73.298 224 1000 bsd-3-clause timm
resnet50.tv2_in1k 176 (test 224) 80.846 224 1000 bsd-3-clause timm
resnet50.tv_in1k 224 76.156 224 1000 bsd-3-clause timm
resnet101.tv2_in1k 176 (test 224) 81.906 224 1000 bsd-3-clause timm
resnet101.tv_in1k 224 77.404 224 1000 bsd-3-clause timm
resnet152.tv2_in1k 176 (test 224) 82.294 224 1000 bsd-3-clause timm
resnet152.tv_in1k 224 78.330 224 1000 bsd-3-clause timm
resnext50_32x4d.tv2_in1k 176 (test 224) 81.190 224 1000 bsd-3-clause timm
resnext50_32x4d.tv_in1k 224 77.632 224 1000 bsd-3-clause timm
resnext101_32x8d.tv2_in1k 176 (test 224) 82.832 224 1000 bsd-3-clause timm
resnext101_32x8d.tv_in1k 224 79.308 224 1000 bsd-3-clause timm
resnext101_64x4d.tv_in1k 224 82.978 224 1000 bsd-3-clause timm
wide_resnet50_2.tv2_in1k 176 (test 224) 81.612 224 1000 bsd-3-clause timm
wide_resnet50_2.tv_in1k 224 78.486 224 1000 bsd-3-clause timm
wide_resnet101_2.tv2_in1k 176 (test 224) 82.514 224 1000 bsd-3-clause timm
wide_resnet101_2.tv_in1k 224 78.862 224 1000 bsd-3-clause timm

facebookresearch/semi-supervised-ImageNet1K-models

Origin: github.com/facebookresearch/semi-supervised-ImageNet1K-models

テーブル(13 行)
Weight Input size Top-1 (%) Eval size Classes License Hub
resnet18.fb_ssl_yfcc100m_ft_in1k 224 72.636 224 1000 cc-by-nc-4.0 timm
resnet18.fb_swsl_ig1b_ft_in1k 224 73.286 224 1000 cc-by-nc-4.0 timm
resnet50.fb_ssl_yfcc100m_ft_in1k 224 79.252 224 1000 cc-by-nc-4.0 timm
resnet50.fb_swsl_ig1b_ft_in1k 224 81.146 224 1000 cc-by-nc-4.0 timm
resnext50_32x4d.fb_ssl_yfcc100m_ft_in1k 224 80.316 224 1000 cc-by-nc-4.0 timm
resnext50_32x4d.fb_swsl_ig1b_ft_in1k 224 82.162 224 1000 cc-by-nc-4.0 timm
resnext101_32x4d.fb_ssl_yfcc100m_ft_in1k 224 80.936 224 1000 cc-by-nc-4.0 timm
resnext101_32x4d.fb_swsl_ig1b_ft_in1k 224 83.268 224 1000 cc-by-nc-4.0 timm
resnext101_32x8d.fb_ssl_yfcc100m_ft_in1k 224 81.620 224 1000 cc-by-nc-4.0 timm
resnext101_32x8d.fb_swsl_ig1b_ft_in1k 224 84.276 224 1000 cc-by-nc-4.0 timm
resnext101_32x16d.fb_ssl_yfcc100m_ft_in1k 224 81.856 224 1000 cc-by-nc-4.0 timm
resnext101_32x16d.fb_swsl_ig1b_ft_in1k 224 83.340 224 1000 cc-by-nc-4.0 timm

tf tags

Weight Input size Top-1 (%) Eval size Classes License Hub
resnetrs50.tf_in1k 160 (test 224) 79.934 224 1000 apache-2.0 timm
resnetrs101.tf_in1k 192 (test 288) 82.288 288 1000 apache-2.0 timm
resnetrs152.tf_in1k 256 (test 320) 83.710 320 1000 apache-2.0 timm
resnetrs200.tf_in1k 256 (test 320) 84.448 320 1000 apache-2.0 timm
resnetrs270.tf_in1k 256 (test 352) 84.438 352 1000 apache-2.0 timm
resnetrs350.tf_in1k 288 (test 384) 84.710 384 1000 apache-2.0 timm
resnetrs420.tf_in1k 320 (test 416) 85.010 416 1000 apache-2.0 timm

miil tags

Weight Input size Top-1 (%) Eval size Classes License Hub
ecaresnet50d.miil_in1k 224 (test 288) 81.648 288 1000 apache-2.0 timm
ecaresnet50d_pruned.miil_in1k 224 (test 288) 80.808 288 1000 apache-2.0 timm
ecaresnet101d.miil_in1k 224 (test 288) 83.006 288 1000 apache-2.0 timm
ecaresnet101d_pruned.miil_in1k 224 (test 288) 82.016 288 1000 apache-2.0 timm
ecaresnetlight.miil_in1k 224 (test 288) 81.430 288 1000 apache-2.0 timm

facebookresearch/WSL-Images

Origin: github.com/facebookresearch/WSL-Images

Weight Input size Top-1 (%) Eval size Classes License Hub
resnext101_32x8d.fb_wsl_ig1b_ft_in1k 224 82.720 224 1000 cc-by-nc-4.0 timm
resnext101_32x16d.fb_wsl_ig1b_ft_in1k 224 84.166 224 1000 cc-by-nc-4.0 timm
resnext101_32x32d.fb_wsl_ig1b_ft_in1k 224 85.090 224 1000 cc-by-nc-4.0 timm

sw tags

Weight Input size Top-1 (%) Eval size Classes License Hub
seresnextaa201d_32x8d.sw_in12k 320 (test 384) - - 11821 apache-2.0 timm
seresnextaa201d_32x8d.sw_in12k_ft_in1k_384 384 87.304 384 1000 apache-2.0 timm

Other

Weight Input size Top-1 (%) Eval size Classes License Hub
ecaresnet50t.ra2_in1k 256 (test 320) 82.370 320 1000 apache-2.0 timm
resnet50.am_in1k 224 79.004 224 1000 apache-2.0 timm
resnet50.bamboo 224 - - none - timm
test_resnet.r160_in1k 160 41.602 160 1000 apache-2.0 timm

Source and license

Source: timm documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.