This repository provides TensorFlow / Keras implementations of different MobileViT  variants. It also provides the TensorFlow / Keras models that have been populated with the original MobileViT pre-trained weights available from . These models are not blackbox SavedModels i.e., they can be fully expanded into
tf.keras.Model objects and one can call all the utility functions on them (example:
As of today, all the TensorFlow / Keras variants of the models listed here are available in this repository. This list includes the ImageNet-1k models.
Refer to the “Using the models” section to get started.
TensorFlow / Keras implementations are available in
mobilevit/models/mobilevit.py. Conversion utilities are in
The converted models will be available on TF-Hub.
There should be a total of 3 different models each having two variants: classifier and feature extractor. You can load any model and get started like so:
import tensorflow as tf model = tf.keras.models.load_model('model_path') print(model.summary())
The model names are interpreted as follows:
mobilevit_xxs_1k_256: Means that the model was pre-trained on the ImageNet-1k dataset with a resolution of 256x256.
Results are on ImageNet-1k validation set (top-1 accuracy).
|name||original acc@1||keras acc@1|
Differences in the results are primarily because of the differences in the library implementations especially how image resizing is implemented in PyTorch and TensorFlow. Results can be verified with the code in
imagenet_1k_eval. Logs are available at this URL.
from mobilevit.models.mobilevit import get_mobilevit_model model = get_mobilevit_model( model_name='mobilevit_xxs', # [mobilevit_xxs, mobilevit_xs, mobilevit_s] image_shape=(256, 256, 3), num_classes=1000, ) print(model.summary())
To view different model configurations, refer here.
 MobileViT Paper: https://arxiv.org/abs/2110.02178
 Official MobileViT weights: https://github.com/apple/ml-cvnets
 Hugging Face MobileViT: MobileViT-HF