--- library_name: pytorch license: other tags: - backbone - bu_auto - android pipeline_tag: image-classification --- ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_base/web-assets/model_demo.png) # Swin-Base: Optimized for Qualcomm Devices SwinBase 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 Swin-Base found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/swin_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/swin_base) 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.25.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_base/releases/v0.55.0/swin_base-onnx-float.zip) | ONNX | w8a16 | Universal | QAIRT 2.42, ONNX Runtime 1.25.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_base/releases/v0.55.0/swin_base-onnx-w8a16.zip) | QNN_DLC | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_base/releases/v0.55.0/swin_base-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/swin_base/releases/v0.55.0/swin_base-qnn_dlc-w8a16.zip) | TFLITE | float | Universal | QAIRT 2.45 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_base/releases/v0.55.0/swin_base-tflite-float.zip) For more device-specific assets and performance metrics, visit **[Swin-Base on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/swin_base)**. ### 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/swin_base) 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 [Swin-Base on GitHub](https://github.com/qualcomm/ai-hub-models/blob/main/src/qai_hub_models/models/swin_base) for usage instructions. ## Model Details **Model Type:** Model_use_case.image_classification **Model Stats:** - Model checkpoint: Imagenet - Input resolution: 224x224 - Number of parameters: 88.8M - Model size (float): 339 MB - Model size (w8a16): 90.2 MB ## Performance Summary | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |---|---|---|---|---|---|--- | Swin-Base | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 7.85 ms | 1 - 476 MB | NPU | Swin-Base | ONNX | float | Snapdragon® X2 Elite | 8.301 ms | 180 - 180 MB | NPU | Swin-Base | ONNX | float | Snapdragon® X Elite | 19.221 ms | 174 - 174 MB | NPU | Swin-Base | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 12.794 ms | 1 - 573 MB | NPU | Swin-Base | ONNX | float | Qualcomm® QCS8550 (Proxy) | 18.894 ms | 0 - 196 MB | NPU | Swin-Base | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 9.63 ms | 1 - 457 MB | NPU | Swin-Base | ONNX | float | Qualcomm® QCS9075 | 23.783 ms | 1 - 46 MB | NPU | Swin-Base | ONNX | float | Qualcomm® QCS8750 | 9.63 ms | 1 - 457 MB | NPU | Swin-Base | ONNX | float | Qualcomm® QCS7181 | 19.221 ms | 174 - 174 MB | NPU | Swin-Base | ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 6.982 ms | 0 - 441 MB | NPU | Swin-Base | ONNX | w8a16 | Snapdragon® X2 Elite | 9.139 ms | 211 - 211 MB | NPU | Swin-Base | ONNX | w8a16 | Snapdragon® X Elite | 17.526 ms | 149 - 149 MB | NPU | Swin-Base | ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 11.359 ms | 0 - 558 MB | NPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCS6490 | 1096.262 ms | 67 - 91 MB | CPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 16.672 ms | 0 - 133 MB | NPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCM6690 | 612.962 ms | 128 - 151 MB | CPU | Swin-Base | ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 582.596 ms | 110 - 133 MB | CPU | Swin-Base | ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 8.796 ms | 0 - 423 MB | NPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCS9075 | 20.443 ms | 0 - 45 MB | NPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCS7790 | 582.596 ms | 110 - 133 MB | CPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCS8750 | 8.796 ms | 0 - 423 MB | NPU | Swin-Base | ONNX | w8a16 | Qualcomm® QCS7181 | 17.526 ms | 149 - 149 MB | NPU | Swin-Base | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 7.491 ms | 1 - 382 MB | NPU | Swin-Base | QNN_DLC | float | Snapdragon® X2 Elite | 8.51 ms | 1 - 1 MB | NPU | Swin-Base | QNN_DLC | float | Snapdragon® X Elite | 19.282 ms | 1 - 1 MB | NPU | Swin-Base | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 12.492 ms | 1 - 519 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 18.539 ms | 1 - 3 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® SA8775P | 21.385 ms | 1 - 363 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® SA8650P | 21.385 ms | 1 - 363 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® SA8255P | 21.385 ms | 1 - 363 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 29.136 ms | 0 - 507 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® SA8295P | 27.586 ms | 1 - 354 MB | NPU | Swin-Base | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 9.395 ms | 0 - 363 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® QCS9075 | 23.476 ms | 3 - 5 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® QCS8750 | 9.395 ms | 0 - 363 MB | NPU | Swin-Base | QNN_DLC | float | Qualcomm® QCS7181 | 19.282 ms | 1 - 1 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 7.559 ms | 0 - 416 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Snapdragon® X2 Elite | 8.434 ms | 0 - 0 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Snapdragon® X Elite | 20.299 ms | 0 - 0 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Snapdragon® 8 Gen 3 Mobile | 12.774 ms | 0 - 507 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCS8275 | 35.31 ms | 0 - 412 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCS8550 (Proxy) | 19.281 ms | 0 - 3 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® SA8775P | 19.541 ms | 0 - 413 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® SA8650P | 19.541 ms | 0 - 413 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® SA8255P | 19.541 ms | 0 - 413 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCM6690 | 114.422 ms | 0 - 928 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® SA7255P | 35.31 ms | 0 - 412 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Snapdragon® 7 Gen 4 Mobile | 21.574 ms | 0 - 603 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 9.509 ms | 0 - 405 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCS9075 | 22.522 ms | 0 - 2 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCS7790 | 21.574 ms | 0 - 603 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCS8750 | 9.509 ms | 0 - 405 MB | NPU | Swin-Base | QNN_DLC | w8a16 | Qualcomm® QCS7181 | 20.299 ms | 0 - 0 MB | NPU | Swin-Base | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 7.892 ms | 0 - 392 MB | NPU | Swin-Base | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 12.737 ms | 0 - 1052 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® QCS8275 | 53.467 ms | 0 - 706 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 18.932 ms | 0 - 3 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® SA8775P | 21.942 ms | 0 - 378 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® SA8650P | 21.942 ms | 0 - 378 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® SA8255P | 21.942 ms | 0 - 378 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 29.057 ms | 0 - 510 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® SA8295P | 28.321 ms | 0 - 371 MB | NPU | Swin-Base | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 9.726 ms | 0 - 387 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® QCS9075 | 23.904 ms | 0 - 178 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® SA7255P | 53.467 ms | 0 - 706 MB | NPU | Swin-Base | TFLITE | float | Qualcomm® QCS8750 | 9.726 ms | 0 - 387 MB | NPU ## License * The license for the original implementation of Swin-Base can be found [here](https://github.com/pytorch/vision/blob/main/LICENSE). ## References * [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030) * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/swin_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).