--- 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.51.0/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.51.0/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.51.0/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.51.0/vit-onnx-w8a8_mixed_int16.zip) | QNN_DLC | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.51.0/vit-qnn_dlc-float.zip) | QNN_DLC | w8a16 | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.51.0/vit-qnn_dlc-w8a16.zip) | QNN_DLC | w8a8 | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.51.0/vit-qnn_dlc-w8a8.zip) | TFLITE | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.51.0/vit-tflite-float.zip) | TFLITE | w8a8 | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/vit/releases/v0.51.0/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 | 3.662 ms | 0 - 354 MB | NPU | VIT | ONNX | float | Snapdragon® X2 Elite | 3.873 ms | 170 - 170 MB | NPU | VIT | ONNX | float | Snapdragon® X Elite | 11.128 ms | 170 - 170 MB | NPU | VIT | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 7.171 ms | 0 - 377 MB | NPU | VIT | ONNX | float | Qualcomm® QCS8550 (Proxy) | 10.454 ms | 0 - 195 MB | NPU | VIT | ONNX | float | Qualcomm® QCS9075 | 14.697 ms | 0 - 4 MB | NPU | VIT | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 4.99 ms | 0 - 348 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 3.775 ms | 0 - 303 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® X2 Elite | 3.902 ms | 86 - 86 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® X Elite | 11.253 ms | 86 - 86 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 7.363 ms | 0 - 378 MB | NPU | VIT | ONNX | w8a16 | Qualcomm® QCS6490 | 1117.068 ms | 38 - 59 MB | CPU | VIT | ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 10.668 ms | 0 - 101 MB | NPU | VIT | ONNX | w8a16 | Qualcomm® QCS9075 | 12.939 ms | 0 - 3 MB | NPU | VIT | ONNX | w8a16 | Qualcomm® QCM6690 | 611.108 ms | 73 - 88 MB | CPU | VIT | ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 5.314 ms | 0 - 300 MB | NPU | VIT | ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 593.078 ms | 60 - 76 MB | CPU | VIT | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 4.582 ms | 0 - 351 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® X2 Elite | 5.101 ms | 85 - 85 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® X Elite | 13.62 ms | 85 - 85 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 8.792 ms | 0 - 457 MB | NPU | VIT | ONNX | w8a8 | Qualcomm® QCS6490 | 316.911 ms | 21 - 74 MB | CPU | VIT | ONNX | w8a8 | Qualcomm® QCS8550 (Proxy) | 12.93 ms | 0 - 100 MB | NPU | VIT | ONNX | w8a8 | Qualcomm® QCS9075 | 13.549 ms | 0 - 3 MB | NPU | VIT | ONNX | w8a8 | Qualcomm® QCM6690 | 136.498 ms | 21 - 42 MB | CPU | VIT | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 7.243 ms | 0 - 323 MB | NPU | VIT | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 129.249 ms | 22 - 43 MB | CPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 8 Elite Gen 5 Mobile | 62.922 ms | 21 - 289 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® X2 Elite | 56.849 ms | 79 - 79 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® X Elite | 160.029 ms | 79 - 79 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 8 Gen 3 Mobile | 85.742 ms | 69 - 445 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCS6490 | 733.594 ms | 96 - 128 MB | CPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCS8550 (Proxy) | 100.182 ms | 9 - 95 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCS9075 | 130.409 ms | 68 - 70 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Qualcomm® QCM6690 | 383.515 ms | 99 - 121 MB | CPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 8 Elite For Galaxy Mobile | 72.88 ms | 68 - 339 MB | NPU | VIT | ONNX | w8a8_mixed_int16 | Snapdragon® 7 Gen 4 Mobile | 373.213 ms | 95 - 114 MB | CPU | VIT | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 4.094 ms | 1 - 231 MB | NPU | VIT | QNN_DLC | float | Snapdragon® X2 Elite | 4.45 ms | 1 - 1 MB | NPU | VIT | QNN_DLC | float | Snapdragon® X Elite | 11.889 ms | 1 - 1 MB | NPU | VIT | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 7.675 ms | 0 - 310 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 40.628 ms | 1 - 177 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 11.19 ms | 1 - 2 MB | NPU | VIT | QNN_DLC | float | Qualcomm® SA8775P | 13.991 ms | 1 - 213 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS9075 | 15.487 ms | 1 - 3 MB | NPU | VIT | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 19.142 ms | 0 - 291 MB | NPU | VIT | QNN_DLC | float | Qualcomm® SA7255P | 40.628 ms | 1 - 177 MB | NPU | VIT | QNN_DLC | float | Qualcomm® SA8295P | 17.287 ms | 0 - 192 MB | NPU | VIT | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 5.381 ms | 1 - 224 MB | NPU | VIT | QNN_DLC | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 3.374 ms | 0 - 298 MB | NPU | VIT | QNN_DLC | w8a16 | Snapdragon® X2 Elite | 4.184 ms | 0 - 0 MB | NPU | VIT | QNN_DLC | w8a16 | Snapdragon® X Elite | 9.853 ms | 0 - 0 MB | NPU | VIT | QNN_DLC | w8a16 | Snapdragon® 8 Gen 3 Mobile | 6.444 ms | 0 - 345 MB | NPU | VIT | QNN_DLC | w8a16 | Qualcomm® QCS8275 (Proxy) | 20.24 ms | 0 - 284 MB | NPU | VIT | QNN_DLC | w8a16 | Qualcomm® QCS8550 (Proxy) | 9.034 ms | 0 - 287 MB | NPU | VIT | QNN_DLC | w8a16 | Qualcomm® SA8775P | 9.402 ms | 0 - 285 MB | NPU | VIT | QNN_DLC | w8a16 | Qualcomm® QCS9075 | 11.506 ms | 0 - 2 MB | NPU | VIT | QNN_DLC | w8a16 | Qualcomm® QCM6690 | 87.029 ms | 0 - 413 MB | NPU | VIT | QNN_DLC | w8a16 | Qualcomm® SA7255P | 20.24 ms | 0 - 284 MB | NPU | VIT | QNN_DLC | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 4.758 ms | 0 - 283 MB | NPU | VIT | QNN_DLC | w8a16 | Snapdragon® 7 Gen 4 Mobile | 15.216 ms | 0 - 428 MB | NPU | VIT | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 3.706 ms | 0 - 279 MB | NPU | VIT | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 4.573 ms | 0 - 0 MB | NPU | VIT | QNN_DLC | w8a8 | Snapdragon® X Elite | 10.754 ms | 0 - 0 MB | NPU | VIT | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 7.069 ms | 0 - 411 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 51.044 ms | 0 - 2 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 29.699 ms | 0 - 287 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 10.229 ms | 0 - 2 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® SA8775P | 9.342 ms | 0 - 288 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 9.918 ms | 2 - 4 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 248.567 ms | 0 - 499 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 13.452 ms | 0 - 414 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® SA7255P | 29.699 ms | 0 - 287 MB | NPU | VIT | QNN_DLC | w8a8 | Qualcomm® SA8295P | 16.067 ms | 0 - 188 MB | NPU | VIT | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 5.79 ms | 0 - 289 MB | NPU | VIT | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 20.043 ms | 0 - 325 MB | NPU | VIT | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 3.029 ms | 0 - 174 MB | NPU | VIT | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 5.698 ms | 0 - 274 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 35.349 ms | 0 - 187 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 7.866 ms | 0 - 3 MB | NPU | VIT | TFLITE | float | Qualcomm® SA8775P | 10.791 ms | 0 - 190 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS9075 | 11.475 ms | 0 - 173 MB | NPU | VIT | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 13.903 ms | 0 - 241 MB | NPU | VIT | TFLITE | float | Qualcomm® SA7255P | 35.349 ms | 0 - 187 MB | NPU | VIT | TFLITE | float | Qualcomm® SA8295P | 13.431 ms | 0 - 154 MB | NPU | VIT | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.908 ms | 0 - 184 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 4.569 ms | 0 - 334 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 8.776 ms | 0 - 457 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS6490 | 152.222 ms | 1 - 101 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 35.43 ms | 0 - 327 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 12.279 ms | 0 - 4 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® SA8775P | 12.377 ms | 0 - 327 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS9075 | 13.843 ms | 0 - 88 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCM6690 | 203.01 ms | 2 - 287 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 21.722 ms | 0 - 446 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® SA7255P | 35.43 ms | 0 - 327 MB | NPU | VIT | TFLITE | w8a8 | Qualcomm® SA8295P | 19.859 ms | 0 - 318 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 7.09 ms | 0 - 317 MB | NPU | VIT | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 30.808 ms | 2 - 191 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).