opensi·si

timm/models/resnetv2.py ·

ResNetV2 (BiT)

Category: CNN · Code: timm/models/resnetv2.py · Architectures: 20 · Pretrained weights: 24 (18 with ImageNet-1k results)

Pre-activation ResNet (v2) with Group Normalization and Weight Standardization as used by Big Transfer (BiT), with the original BiT weights. Also supports the non pre-activation variant used as the hybrid Vision Transformer backbone.

Papers

  • Big Transfer (BiT): General Visual Representation Learning
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Knowledge distillation: A good teacher is patient and consistent
  • Identity Mappings in Deep Residual Networks

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('resnetv2_50.a1h_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)

Model API support

Feature ResNetV2
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 (ResNetV2 with resnetv2_18 at 224), other architectures of the same class are expected to behave the same. See the Model API page for details.

Architectures

표 (21행)
Architecture Params (M) GMACs Input size Pretrained weights
resnetv2_18 11.69 1.82 224 1
resnetv2_18d 11.71 2.06 224 1
resnetv2_34 21.80 3.67 224 1
resnetv2_34d 21.82 3.91 224 2
resnetv2_50 25.55 4.11 224 1
resnetv2_50d 25.57 4.35 224 0
resnetv2_50d_evos 25.59 4.33 224 1
resnetv2_50d_frn 25.59 4.33 224 0
resnetv2_50d_gn 25.57 4.38 224 1
resnetv2_50t 25.57 4.32 224 0
resnetv2_50x1_bit 25.55 4.23 224 3
resnetv2_50x3_bit 217.32 145.70 448 2
resnetv2_101 44.54 7.83 224 1
resnetv2_101d 44.56 8.07 224 0
resnetv2_101x1_bit 44.54 31.65 448 2
resnetv2_101x3_bit 387.93 280.33 448 2
resnetv2_152 60.19 11.55 224 0
resnetv2_152d 60.20 11.80 224 0
resnetv2_152x2_bit 236.34 46.95 224 4
resnetv2_152x4_bit 936.53 844.84 480 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.

goog tags

표 (16행)
Weight Input size Top-1 (%) Eval size Classes License Hub
resnetv2_50x1_bit.goog_distilled_in1k 224 82.820 224 1000 apache-2.0 timm
resnetv2_50x1_bit.goog_in21k 224 - - 21843 apache-2.0 timm
resnetv2_50x1_bit.goog_in21k_ft_in1k 448 80.386 448 1000 apache-2.0 timm
resnetv2_50x3_bit.goog_in21k 224 - - 21843 apache-2.0 timm
resnetv2_50x3_bit.goog_in21k_ft_in1k 448 83.982 448 1000 apache-2.0 timm
resnetv2_101x1_bit.goog_in21k 224 - - 21843 apache-2.0 timm
resnetv2_101x1_bit.goog_in21k_ft_in1k 448 82.332 448 1000 apache-2.0 timm
resnetv2_101x3_bit.goog_in21k 224 - - 21843 apache-2.0 timm
resnetv2_101x3_bit.goog_in21k_ft_in1k 448 84.430 448 1000 apache-2.0 timm
resnetv2_152x2_bit.goog_in21k 224 - - 21843 apache-2.0 timm
resnetv2_152x2_bit.goog_in21k_ft_in1k 448 84.468 448 1000 apache-2.0 timm
resnetv2_152x2_bit.goog_teacher_in21k_ft_in1k 224 82.918 224 1000 apache-2.0 timm
resnetv2_152x2_bit.goog_teacher_in21k_ft_in1k_384 384 83.858 384 1000 apache-2.0 timm
resnetv2_152x4_bit.goog_in21k 224 - - 21843 apache-2.0 timm
resnetv2_152x4_bit.goog_in21k_ft_in1k 480 84.936 480 1000 apache-2.0 timm

ra4 tags

Weight Input size Top-1 (%) Eval size Classes License Hub
resnetv2_18.ra4_e3600_r224_in1k 224 (test 288) 75.364 288 1000 apache-2.0 timm
resnetv2_18d.ra4_e3600_r224_in1k 224 (test 288) 76.058 288 1000 apache-2.0 timm
resnetv2_34.ra4_e3600_r224_in1k 224 (test 288) 79.070 288 1000 apache-2.0 timm
resnetv2_34d.ra4_e3600_r224_in1k 224 (test 288) 79.614 288 1000 apache-2.0 timm
resnetv2_34d.ra4_e3600_r384_in1k 384 (test 448) 80.430 448 1000 apache-2.0 timm

a1h tags

Weight Input size Top-1 (%) Eval size Classes License Hub
resnetv2_50.a1h_in1k 224 (test 288) 81.406 288 1000 apache-2.0 timm
resnetv2_101.a1h_in1k 224 (test 288) 83.002 288 1000 apache-2.0 timm

ah tags

Weight Input size Top-1 (%) Eval size Classes License Hub
resnetv2_50d_evos.ah_in1k 224 (test 288) 82.024 288 1000 apache-2.0 timm
resnetv2_50d_gn.ah_in1k 224 (test 288) 81.960 288 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.