timm documentation

RepViT

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v1.0.30).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

RepViT

Category: Efficient/Mobile · Code: timm/models/repvit.py · Architectures: 8 · Pretrained weights: 13 (13 with ImageNet-1k results)

RepViT is a mobile CNN that brings design choices of lightweight vision transformers into MobileNet-V3 style blocks, with structural re-parameterization.

Papers

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

Model API support

FeatureRepVit
features_only=True feature maps✓ (strides 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 (RepVit with repvit_m1 at 224), other architectures of the same class are expected to behave the same. See the Model API page for details.

Architectures

ArchitectureParams (M)GMACsInput sizePretrained weights
repvit_m0_95.070.822242
repvit_m15.070.822241
repvit_m1_06.811.112242
repvit_m1_18.241.342242
repvit_m1_514.052.272242
repvit_m28.241.342241
repvit_m2_322.934.522242
repvit_m310.121.862241

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.

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
repvit_m0_9.dist_300e_in1k22478.6522241000apache-2.0timm
repvit_m0_9.dist_450e_in1k22479.0582241000apache-2.0timm
repvit_m1.dist_in1k22478.5422241000apache-2.0timm
repvit_m1_0.dist_300e_in1k22480.1522241000apache-2.0timm
repvit_m1_0.dist_450e_in1k22480.4302241000apache-2.0timm
repvit_m1_1.dist_300e_in1k22480.8262241000apache-2.0timm
repvit_m1_1.dist_450e_in1k22481.3142241000apache-2.0timm
repvit_m1_5.dist_300e_in1k22482.3822241000apache-2.0timm
repvit_m1_5.dist_450e_in1k22482.5202241000apache-2.0timm
repvit_m2.dist_in1k22480.4682241000apache-2.0timm
repvit_m2_3.dist_300e_in1k22483.5242241000apache-2.0timm
repvit_m2_3.dist_450e_in1k22483.7462241000apache-2.0timm
repvit_m3.dist_in1k22481.4942241000apache-2.0timm

Citation

@misc{wang2023repvit,
      title={RepViT: Revisiting Mobile CNN From ViT Perspective},
      author={Ao Wang and Hui Chen and Zijia Lin and Hengjun Pu and Guiguang Ding},
      year={2023},
      eprint={2307.09283},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
Update on GitHub