Segment-Anything-Model-2: Optimized for Qualcomm Devices
SAM 2, the successor to Meta's Segment Anything Model (SAM), is a cutting-edge tool designed for comprehensive object segmentation in both images and videos. It excels in handling complex visual data through a unified, promptable model architecture that supports real-time processing and zero-shot generalization.
This is based on the implementation of Segment-Anything-Model-2 found here. This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the Qualcomm® AI Hub Models library to export with custom configurations. More details on model performance across various devices, can be found here.
Qualcomm AI Hub Models uses Qualcomm AI Hub Workbench to compile, profile, and evaluate this model. Sign up 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 |
| QNN_DLC | float | Universal | QAIRT 2.45 | Download |
| QNN_DLC | w8a8 | Universal | QAIRT 2.45 | Download |
For more device-specific assets and performance metrics, visit Segment-Anything-Model-2 on Qualcomm® AI Hub.
Option 2: Export with Custom Configurations
Use the Qualcomm® AI Hub Models 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 Segment-Anything-Model-2 on GitHub for usage instructions.
Model Details
Model Type: Model_use_case.semantic_segmentation
Model Stats:
- Model checkpoint: sam2.1_hiera_t
- Input resolution: 720p (720x1280)
- Number of parameters (encoder): 33.5M
- Model size (encoder) (float): 128 MB
- Number of parameters (decoder): 6.22M
- Model size (decoder) (float): 23.7 MB
Performance Summary
| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |
|---|---|---|---|---|---|---|
| decoder | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 3.139 ms | 17 - 242 MB | NPU |
| decoder | ONNX | float | Snapdragon® X2 Elite | 3.216 ms | 15 - 15 MB | NPU |
| decoder | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 4.73 ms | 16 - 339 MB | NPU |
| decoder | ONNX | float | Qualcomm® QCS8550 (Proxy) | 6.804 ms | 16 - 23 MB | NPU |
| decoder | ONNX | float | Qualcomm® QCS9075 | 8.467 ms | 16 - 19 MB | NPU |
| decoder | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.476 ms | 1 - 233 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® X2 Elite | 3.112 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® X Elite | 5.516 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 3.678 ms | 4 - 214 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 5.381 ms | 16 - 125 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® QCS9075 | 6.811 ms | 16 - 34 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® SA8295P | 8.166 ms | 0 - 193 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 2.899 ms | 4 - 189 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.877 ms | 1 - 109 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 1.259 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 2.319 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.297 ms | 0 - 110 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 8.252 ms | 1 - 7 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 3.891 ms | 4 - 88 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 2.025 ms | 4 - 113 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8775P | 2.634 ms | 4 - 89 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 2.41 ms | 0 - 6 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 10.205 ms | 4 - 275 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 2.556 ms | 0 - 109 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA7255P | 3.891 ms | 4 - 88 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 2.959 ms | 4 - 108 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 1.029 ms | 1 - 89 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 2.663 ms | 4 - 215 MB | NPU |
| encoder | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 97.534 ms | 44 - 2275 MB | NPU |
| encoder | ONNX | float | Snapdragon® X2 Elite | 99.01 ms | 71 - 71 MB | NPU |
| encoder | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 146.245 ms | 1 - 3808 MB | NPU |
| encoder | ONNX | float | Qualcomm® QCS8550 (Proxy) | 199.079 ms | 0 - 88 MB | NPU |
| encoder | ONNX | float | Qualcomm® QCS9075 | 273.038 ms | 12 - 26 MB | NPU |
| encoder | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 113.051 ms | 33 - 1669 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® X2 Elite | 107.977 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® X Elite | 206.229 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 155.813 ms | 12 - 1967 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 215.599 ms | 12 - 16 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® QCS9075 | 258.641 ms | 12 - 42 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® SA8295P | 309.446 ms | 0 - 1671 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 119.576 ms | 0 - 1735 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 38.315 ms | 3 - 1810 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 40.925 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 84.916 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 57.396 ms | 0 - 1978 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 666.244 ms | 3 - 12 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 144.841 ms | 3 - 1664 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 82.328 ms | 3 - 6 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8775P | 83.916 ms | 3 - 1664 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 102.775 ms | 3 - 12 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 1283.67 ms | 3 - 1971 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 141.394 ms | 3 - 2036 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA7255P | 144.841 ms | 3 - 1664 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 96.974 ms | 3 - 1672 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 42.794 ms | 3 - 1734 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 110.547 ms | 3 - 1774 MB | NPU |
License
- The license for the original implementation of Segment-Anything-Model-2 can be found here.
References
Community
- Join our AI Hub Slack community to collaborate, post questions and learn more about on-device AI.
- For questions or feedback please reach out to us.
