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.149 ms | 17 - 242 MB | NPU |
| decoder | ONNX | float | Snapdragon® X2 Elite | 3.22 ms | 15 - 15 MB | NPU |
| decoder | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 4.729 ms | 16 - 328 MB | NPU |
| decoder | ONNX | float | Qualcomm® QCS8550 (Proxy) | 6.744 ms | 16 - 24 MB | NPU |
| decoder | ONNX | float | Qualcomm® QCS9075 | 8.485 ms | 16 - 19 MB | NPU |
| decoder | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.498 ms | 3 - 235 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® X2 Elite | 3.057 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® X Elite | 5.549 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 3.689 ms | 4 - 213 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 5.358 ms | 16 - 18 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® QCS9075 | 6.826 ms | 16 - 34 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® SA8295P | 8.19 ms | 0 - 189 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 2.861 ms | 4 - 186 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.9 ms | 0 - 126 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 1.334 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 2.302 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.288 ms | 0 - 107 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 8.445 ms | 1 - 7 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 3.935 ms | 4 - 88 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 1.976 ms | 4 - 6 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8775P | 2.666 ms | 4 - 91 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 2.415 ms | 1 - 7 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 9.958 ms | 4 - 270 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 2.561 ms | 0 - 110 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA7255P | 3.935 ms | 4 - 88 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 2.939 ms | 4 - 87 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 1.013 ms | 1 - 90 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 2.732 ms | 4 - 211 MB | NPU |
| encoder | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 98.074 ms | 0 - 2232 MB | NPU |
| encoder | ONNX | float | Snapdragon® X2 Elite | 99.93 ms | 71 - 71 MB | NPU |
| encoder | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 143.51 ms | 23 - 3816 MB | NPU |
| encoder | ONNX | float | Qualcomm® QCS8550 (Proxy) | 197.238 ms | 36 - 43 MB | NPU |
| encoder | ONNX | float | Qualcomm® QCS9075 | 272.475 ms | 12 - 27 MB | NPU |
| encoder | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 113.634 ms | 33 - 1687 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® X2 Elite | 108.94 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® X Elite | 206.568 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 156.256 ms | 29 - 1987 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 207.936 ms | 12 - 15 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® QCS9075 | 258.802 ms | 12 - 42 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® SA8295P | 309.402 ms | 0 - 1671 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 121.114 ms | 12 - 1747 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 38.857 ms | 3 - 1809 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 40.756 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 84.928 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 57.345 ms | 3 - 1981 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 665.154 ms | 3 - 12 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 144.989 ms | 3 - 1664 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 82.026 ms | 3 - 6 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8775P | 83.967 ms | 3 - 1664 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 103.371 ms | 3 - 12 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 1564.069 ms | 3 - 1968 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 140.201 ms | 3 - 2037 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA7255P | 144.989 ms | 3 - 1664 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 97.146 ms | 3 - 1671 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 42.779 ms | 3 - 1736 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 110.817 ms | 3 - 1775 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.
