--- library_name: pytorch license: other tags: - backbone - android pipeline_tag: image-classification --- ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/web-assets/model_demo.png) # VIT: Optimized for Qualcomm Devices VIT is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases. This is based on the implementation of VIT found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/vision_transformer.py). This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/vit) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary). Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) to run these models on a hosted Qualcomm® device. ## Getting Started There are two ways to deploy this model on your device: ### Option 1: Download Pre-Exported Models Below are pre-exported model assets ready for deployment. | Runtime | Precision | Chipset | SDK Versions | Download | |---|---|---|---|---| | ONNX | float | Universal | QAIRT 2.42, ONNX Runtime 1.24.3 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-onnx-float.zip) | ONNX | w8a16 | Universal | QAIRT 2.42, ONNX Runtime 1.24.3 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-onnx-w8a16.zip) | ONNX | w8a8 | Universal | QAIRT 2.42, ONNX Runtime 1.24.3 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-onnx-w8a8.zip) | ONNX | w8a8_mixed_int16 | Universal | QAIRT 2.42, ONNX Runtime 1.24.3 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-onnx-w8a8_mixed_int16.zip) | QNN_DLC | float | Universal | QAIRT 2.43 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-qnn_dlc-float.zip) | TFLITE | float | Universal | QAIRT 2.43, TFLite 2.19.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-tflite-float.zip) | TFLITE | w8a8 | Universal | QAIRT 2.43, TFLite 2.19.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.50.2/vit-tflite-w8a8.zip) For more device-specific assets and performance metrics, visit **[VIT on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/vit)**. ### Option 2: Export with Custom Configurations Use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/vit) Python library to compile and export the model with your own: - Custom weights (e.g., fine-tuned checkpoints) - Custom input shapes - Target device and runtime configurations This option is ideal if you need to customize the model beyond the default configuration provided here. See our repository for [VIT on GitHub](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/vit) for usage instructions. ## Model Details **Model Type:** Model_use_case.image_classification **Model Stats:** - Model checkpoint: Imagenet - Input resolution: 224x224 - Number of parameters: 86.6M - Model size (float): 330 MB - Model size (w8a16): 86.2 MB - Model size (w8a8): 83.2 MB ## Performance Summary | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |---|---|---|---|---|---|--- | VIT | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 2.698 ms | 1 - 347 MB | NPU | VIT | ONNX | float | Snapdragon® X2 Elite | 3.028 ms | 170 - 170 MB | NPU | VIT | ONNX | float | Snapdragon® X Elite | 7.669 ms | 170 - 170 MB | NPU | VIT | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 5.03 ms | 0 - 369 MB | NPU | VIT | ONNX | float | Qualcomm® QCS8550 (Proxy) | 7.131 ms | 0 - 196 MB | NPU | VIT | ONNX | float | Qualcomm® QCS9075 | 10.169 ms | 0 - 4 MB | NPU | VIT | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.44 ms | 0 - 339 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 3.116 ms | 0 - 276 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® X2 Elite | 4.424 ms | 86 - 86 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® X Elite | 8.794 ms | 86 - 86 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 5.734 ms | 0 - 349 MB | NPU | VIT | ONNX | w8a16 | Qualcomm® QCS6490 | 1125.779 ms | 31 - 54 MB | CPU | VIT | ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 8.19 ms | 0 - 102 MB | NPU | VIT | ONNX | w8a16 | Qualcomm® QCS9075 | 8.771 ms | 0 - 3 MB | NPU | VIT | ONNX | w8a16 | Qualcomm® QCM6690 | 604.448 ms | 54 - 70 MB | CPU | VIT | ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 4.395 ms | 0 - 281 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 590.731 ms | 42 - 59 MB | CPU | VIT | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 4.576 ms | 0 - 421 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® X2 Elite | 5.214 ms | 85 - 85 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® X Elite | 13.707 ms | 85 - 85 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 8.762 ms | 0 - 530 MB | NPU | VIT | ONNX | w8a8 | Qualcomm® QCS6490 | 308.621 ms | 19 - 72 MB | CPU | VIT | ONNX | w8a8 | Qualcomm® QCS8550 (Proxy) | 12.993 ms | 0 - 101 MB | NPU | VIT | ONNX | w8a8 | Qualcomm® QCS9075 | 13.737 ms | 0 - 3 MB | NPU | VIT | ONNX | w8a8 | Qualcomm® QCM6690 | 131.058 ms | 22 - 41 MB | CPU | VIT | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 6.966 ms | 0 - 413 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 125.982 ms | 11 - 31 MB | CPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® X2 Elite | 45.84 ms | 75 - 75 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® X Elite | 160.974 ms | 73 - 73 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 8 Gen 3 Mobile | 74.098 ms | 54 - 418 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCS6490 | 729.381 ms | 77 - 111 MB | CPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCS8550 (Proxy) | 93.613 ms | 51 - 57 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCS9075 | 115.883 ms | 55 - 57 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCM6690 | 363.109 ms | 41 - 61 MB | CPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 8 Elite For Galaxy Mobile | 63.713 ms | 51 - 335 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 7 Gen 4 Mobile | 352.78 ms | 81 - 104 MB | CPU | VIT | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 2.993 ms | 0 - 318 MB | NPU | VIT | QNN_DLC | float | Snapdragon® X2 Elite | 3.572 ms | 1 - 1 MB | NPU | VIT | QNN_DLC | float | Snapdragon® X Elite | 8.504 ms | 1 - 1 MB | NPU | VIT | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 5.519 ms | 0 - 357 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 35.226 ms | 1 - 331 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 7.912 ms | 1 - 2 MB | NPU | VIT | QNN_DLC | float | Qualcomm® SA8775P | 10.654 ms | 1 - 332 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS9075 | 11.097 ms | 1 - 3 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 12.772 ms | 0 - 337 MB | NPU | VIT | QNN_DLC | float | Qualcomm® SA7255P | 35.226 ms | 1 - 331 MB | NPU | VIT | QNN_DLC | float | Qualcomm® SA8295P | 13.047 ms | 1 - 310 MB | NPU | VIT | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.759 ms | 0 - 333 MB | NPU | VIT | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 2.955 ms | 0 - 275 MB | NPU | VIT | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 5.276 ms | 0 - 355 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 34.552 ms | 0 - 276 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 7.191 ms | 0 - 3 MB | NPU | VIT | TFLITE | float | Qualcomm® SA8775P | 10.187 ms | 0 - 277 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS9075 | 10.641 ms | 0 - 174 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 12.92 ms | 0 - 339 MB | NPU | VIT | TFLITE | float | Qualcomm® SA7255P | 34.552 ms | 0 - 276 MB | NPU | VIT | TFLITE | float | Qualcomm® SA8295P | 13.247 ms | 0 - 265 MB | NPU | VIT | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.701 ms | 0 - 285 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 4.525 ms | 0 - 381 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 8.662 ms | 0 - 493 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS6490 | 166.626 ms | 1 - 101 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 35.043 ms | 0 - 386 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 12.909 ms | 0 - 2 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® SA8775P | 12.203 ms | 0 - 388 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS9075 | 13.759 ms | 0 - 88 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCM6690 | 199.256 ms | 2 - 293 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 20.024 ms | 0 - 456 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® SA7255P | 35.043 ms | 0 - 386 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® SA8295P | 19.189 ms | 0 - 344 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 6.932 ms | 0 - 381 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 29.256 ms | 2 - 222 MB | NPU ## License * The license for the original implementation of VIT can be found [here](https://github.com/pytorch/vision/blob/main/LICENSE). ## References * [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/vision_transformer.py) ## Community * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI. * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).