timm documentation
MobileViT
MobileViT
Category: Efficient/Mobile · Code: timm/models/mobilevit.py · Architectures: 10 · Pretrained weights: 16 (16 with ImageNet-1k results)
MobileViT combines MobileNet-V2 inverted residual blocks with MobileViT blocks, which apply transformers to unfolded
patches for global processing. MobileViT-V2 uses separable self-attention. Built on the ByobNet class.
Papers
- MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer
- Separable Self-attention for Mobile Vision Transformers
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('mobilevitv2_200.cvnets_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)Model API support
✓ 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 (ByobNet with mobilevit_xxs at 256), other
architectures of the same class are expected to behave the same. See the Model API page for details.
Architectures
| Architecture | Params (M) | GMACs | Input size | Pretrained weights |
|---|---|---|---|---|
mobilevit_s | 5.58 | 2.03 | 256 | 1 |
mobilevit_xs | 2.32 | 1.05 | 256 | 1 |
mobilevit_xxs | 1.27 | 0.42 | 256 | 1 |
mobilevitv2_050 | 1.37 | 0.48 | 256 | 1 |
mobilevitv2_075 | 2.87 | 1.05 | 256 | 1 |
mobilevitv2_100 | 4.90 | 1.84 | 256 | 1 |
mobilevitv2_125 | 7.48 | 2.86 | 256 | 1 |
mobilevitv2_150 | 10.59 | 4.09 | 256 | 3 |
mobilevitv2_175 | 14.25 | 5.54 | 256 | 3 |
mobilevitv2_200 | 18.45 | 7.22 | 256 | 3 |
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.
| Weight | Input size | Top-1 (%) | Eval size | Classes | License | Hub |
|---|---|---|---|---|---|---|
mobilevit_s.cvnets_in1k | 256 | 78.298 | 256 | 1000 | cvnets-license | timm |
mobilevit_xs.cvnets_in1k | 256 | 74.618 | 256 | 1000 | cvnets-license | timm |
mobilevit_xxs.cvnets_in1k | 256 | 68.936 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_050.cvnets_in1k | 256 | 70.156 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_075.cvnets_in1k | 256 | 75.612 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_100.cvnets_in1k | 256 | 78.088 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_125.cvnets_in1k | 256 | 79.682 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_150.cvnets_in1k | 256 | 80.380 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_150.cvnets_in22k_ft_in1k | 256 | 81.466 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_150.cvnets_in22k_ft_in1k_384 | 384 | 82.606 | 384 | 1000 | cvnets-license | timm |
mobilevitv2_175.cvnets_in1k | 256 | 80.870 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_175.cvnets_in22k_ft_in1k | 256 | 81.950 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_175.cvnets_in22k_ft_in1k_384 | 384 | 82.920 | 384 | 1000 | cvnets-license | timm |
mobilevitv2_200.cvnets_in1k | 256 | 81.148 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_200.cvnets_in22k_ft_in1k | 256 | 82.320 | 256 | 1000 | cvnets-license | timm |
mobilevitv2_200.cvnets_in22k_ft_in1k_384 | 384 | 83.430 | 384 | 1000 | cvnets-license | timm |