--- library_name: pytorch license: bsd-3-clause tags: - backbone - bu_auto - android pipeline_tag: image-classification --- ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_small/web-assets/model_demo.png) # Swin-Small: Optimized for Qualcomm Devices SwinSmall 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-Small 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/v0.63.0/src/qai_hub_models/models/swin_small) 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.50, ONNX Runtime 1.27.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_small/releases/v0.63.0/swin_small-onnx-float.zip) | ONNX | w8a16 | Universal | QAIRT 2.50, ONNX Runtime 1.27.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_small/releases/v0.63.0/swin_small-onnx-w8a16.zip) | QNN_DLC | float | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_small/releases/v0.63.0/swin_small-qnn_dlc-float.zip) | QNN_DLC | w8a16 | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_small/releases/v0.63.0/swin_small-qnn_dlc-w8a16.zip) | TFLITE | float | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/swin_small/releases/v0.63.0/swin_small-tflite-float.zip) For more device-specific assets and performance metrics, visit **[Swin-Small on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/swin_small)**. ### Option 2: Export with Custom Configurations Use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/v0.63.0/src/qai_hub_models/models/swin_small) 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-Small on GitHub](https://github.com/qualcomm/ai-hub-models/blob/v0.63.0/src/qai_hub_models/models/swin_small) for usage instructions. ## Model Details **Model Type:** Model_use_case.image_classification **Model Stats:** - Input resolution: 224x224 - Model checkpoint: Imagenet - Model size (float): 193 MB - Model size (w8a16): 52.5 MB - Number of parameters: 50.4M ## Performance Summary | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |---|---|---|---|---|---|--- | Swin-Small | ONNX | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 6.249 ms | 1 - 320 MB | NPU | Swin-Small | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 7.642 ms | 1 - 307 MB | NPU | Swin-Small | ONNX | float | Snapdragon® X2 Elite | 6.437 ms | 2 - 2 MB | NPU | Swin-Small | ONNX | float | Snapdragon® X Elite | 15.714 ms | 101 - 101 MB | NPU | Swin-Small | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 9.971 ms | 0 - 438 MB | NPU | Swin-Small | ONNX | float | Snapdragon® 8 Gen 1 Mobile | 23.356 ms | 0 - 425 MB | NPU | Swin-Small | ONNX | float | Qualcomm® Dragonwing™ IQ-8275 | 15.275 ms | 0 - 5 MB | NPU | Swin-Small | ONNX | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 15.184 ms | 0 - 114 MB | NPU | Swin-Small | ONNX | float | Qualcomm® QCS8450 | 23.356 ms | 0 - 425 MB | NPU | Swin-Small | ONNX | float | Qualcomm® Dragonwing™ IQ-9075 | 16.724 ms | 1 - 5 MB | NPU | Swin-Small | ONNX | float | Qualcomm® Dragonwing™ IQ-X7181 | 15.714 ms | 101 - 101 MB | NPU | Swin-Small | ONNX | float | Qualcomm® Dragonwing™ Q-8750 | 7.642 ms | 1 - 307 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 5.153 ms | 0 - 340 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 6.605 ms | 0 - 330 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® X2 Elite | 5.364 ms | 1 - 1 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® X Elite | 13.505 ms | 54 - 54 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 8.856 ms | 0 - 444 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® 8 Gen 1 Mobile | 16.454 ms | 0 - 441 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ QCS6490 | 26.821 ms | 0 - 4 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ IQ-8275 | 11.558 ms | 0 - 5 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 13.067 ms | 0 - 59 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® QCS8450 | 16.454 ms | 0 - 441 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ IQ-9075 | 13.688 ms | 0 - 4 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ IQ-X7181 | 13.505 ms | 54 - 54 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ Q-6690 | 66.905 ms | 0 - 535 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ Q-7790 | 14.201 ms | 0 - 374 MB | NPU | Swin-Small | ONNX | w8a16 | Qualcomm® Dragonwing™ Q-8750 | 6.605 ms | 0 - 330 MB | NPU | Swin-Small | ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 14.201 ms | 0 - 374 MB | NPU | Swin-Small | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 6.098 ms | 0 - 286 MB | NPU | Swin-Small | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 7.447 ms | 1 - 270 MB | NPU | Swin-Small | QNN_DLC | float | Snapdragon® X2 Elite | 6.785 ms | 1 - 1 MB | NPU | Swin-Small | QNN_DLC | float | Snapdragon® X Elite | 15.78 ms | 1 - 1 MB | NPU | Swin-Small | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 9.87 ms | 0 - 402 MB | NPU | Swin-Small | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 23.608 ms | 0 - 393 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-8275 | 15.206 ms | 1 - 4 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 14.931 ms | 1 - 3 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® SA8650P | 17.421 ms | 1 - 593 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® SA8255P | 17.421 ms | 1 - 593 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® QCS8450 | 23.608 ms | 0 - 393 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-9075 | 17.142 ms | 3 - 5 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-X7181 | 15.78 ms | 1 - 1 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® Dragonwing™ Q-8750 | 7.447 ms | 1 - 270 MB | NPU | Swin-Small | QNN_DLC | float | Qualcomm® SA8295P | 22.117 ms | 1 - 263 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 6.033 ms | 0 - 316 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 7.854 ms | 0 - 305 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Snapdragon® X2 Elite | 6.569 ms | 0 - 0 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Snapdragon® X Elite | 17.107 ms | 0 - 0 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Snapdragon® 8 Gen 3 Mobile | 10.943 ms | 0 - 408 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ IQ-8275 | 14.468 ms | 0 - 4 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 16.13 ms | 0 - 3 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® SA8650P | 16.763 ms | 0 - 638 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® SA8255P | 16.763 ms | 0 - 638 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ IQ-9075 | 17.062 ms | 0 - 3 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ IQ-X7181 | 17.107 ms | 0 - 0 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ Q-6690 | 75.035 ms | 0 - 512 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ Q-7790 | 17.104 ms | 0 - 352 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Qualcomm® Dragonwing™ Q-8750 | 7.854 ms | 0 - 305 MB | NPU | Swin-Small | QNN_DLC | w8a16 | Snapdragon® 7 Gen 4 Mobile | 17.104 ms | 0 - 352 MB | NPU | Swin-Small | TFLITE | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 6.522 ms | 0 - 313 MB | NPU | Swin-Small | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 7.764 ms | 0 - 290 MB | NPU | Swin-Small | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 9.993 ms | 0 - 419 MB | NPU | Swin-Small | TFLITE | float | Snapdragon® 8 Gen 1 Mobile | 23.439 ms | 0 - 408 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® Dragonwing™ IQ-8275 | 15.275 ms | 0 - 105 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 15.191 ms | 0 - 5 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® SA8650P | 17.46 ms | 0 - 306 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® SA8255P | 17.46 ms | 0 - 306 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® QCS8450 | 23.439 ms | 0 - 408 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® Dragonwing™ IQ-9075 | 17.434 ms | 0 - 104 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® Dragonwing™ Q-8750 | 7.764 ms | 0 - 290 MB | NPU | Swin-Small | TFLITE | float | Qualcomm® SA8295P | 22.528 ms | 0 - 284 MB | NPU ## License * The license for the original implementation of Swin-Small 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).