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.1 | Download |
| ONNX | w8a8 | Universal | QAIRT 2.42, ONNX Runtime 1.24.1 | Download |
| QNN_DLC | float | Universal | QAIRT 2.43 | Download |
| QNN_DLC | w8a8 | Universal | QAIRT 2.43 | Download |
| TFLITE | w8a8 | Universal | QAIRT 2.43, TFLite 2.17.0 | 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 (SAM2Encoder): 33.5M
- Model size (SAM2Encoder) (float): 128 MB
- Number of parameters (SAM2Decoder): 6.22M
- Model size (SAM2Decoder) (float): 23.7 MB
Performance Summary
| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |
|---|---|---|---|---|---|---|
| SAM2Decoder | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 3.147 ms | 17 - 241 MB | NPU |
| SAM2Decoder | ONNX | float | Snapdragon® X2 Elite | 3.323 ms | 15 - 15 MB | NPU |
| SAM2Decoder | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 4.735 ms | 17 - 337 MB | NPU |
| SAM2Decoder | ONNX | float | Qualcomm® QCS8550 (Proxy) | 6.782 ms | 16 - 24 MB | NPU |
| SAM2Decoder | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.479 ms | 2 - 238 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 5.305 ms | 4 - 263 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Snapdragon® X2 Elite | 5.396 ms | 4 - 4 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Snapdragon® X Elite | 12.506 ms | 4 - 4 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 9.209 ms | 4 - 277 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Qualcomm® QCS6490 | 135.35 ms | 47 - 57 MB | CPU |
| SAM2Decoder | ONNX | w8a8 | Qualcomm® QCS8550 (Proxy) | 11.987 ms | 2 - 9 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Qualcomm® QCM6690 | 56.923 ms | 48 - 69 MB | CPU |
| SAM2Decoder | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 6.792 ms | 2 - 240 MB | NPU |
| SAM2Decoder | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 51.131 ms | 49 - 66 MB | CPU |
| SAM2Decoder | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 2.537 ms | 4 - 201 MB | NPU |
| SAM2Decoder | QNN_DLC | float | Snapdragon® X2 Elite | 3.077 ms | 16 - 16 MB | NPU |
| SAM2Decoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 3.606 ms | 4 - 230 MB | NPU |
| SAM2Decoder | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 5.288 ms | 16 - 18 MB | NPU |
| SAM2Decoder | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 8.838 ms | 4 - 225 MB | NPU |
| SAM2Decoder | QNN_DLC | float | Qualcomm® SA8295P | 8.032 ms | 0 - 214 MB | NPU |
| SAM2Decoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 2.886 ms | 4 - 214 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.907 ms | 1 - 105 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 1.323 ms | 4 - 4 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 2.256 ms | 4 - 4 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.292 ms | 0 - 102 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 3.896 ms | 4 - 82 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 1.92 ms | 4 - 6 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® SA8775P | 2.55 ms | 4 - 85 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 9.934 ms | 4 - 265 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 2.713 ms | 4 - 109 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® SA7255P | 3.896 ms | 4 - 82 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 3.006 ms | 4 - 81 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 1.019 ms | 1 - 78 MB | NPU |
| SAM2Decoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 2.592 ms | 4 - 204 MB | NPU |
| SAM2Decoder | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 2.534 ms | 0 - 205 MB | NPU |
| SAM2Decoder | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 3.716 ms | 0 - 242 MB | NPU |
| SAM2Decoder | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 12.815 ms | 0 - 210 MB | NPU |
| SAM2Decoder | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 5.316 ms | 0 - 18 MB | NPU |
| SAM2Decoder | TFLITE | float | Qualcomm® SA8775P | 6.748 ms | 0 - 211 MB | NPU |
| SAM2Decoder | TFLITE | float | Qualcomm® SA7255P | 12.815 ms | 0 - 210 MB | NPU |
| SAM2Decoder | TFLITE | float | Qualcomm® SA8295P | 8.004 ms | 0 - 223 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 5.435 ms | 0 - 240 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 9.2 ms | 0 - 257 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 20.893 ms | 0 - 212 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 12.179 ms | 0 - 47 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® SA8775P | 13.8 ms | 0 - 213 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® QCM6690 | 49.732 ms | 14 - 207 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 15.647 ms | 0 - 240 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® SA7255P | 20.893 ms | 0 - 212 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Qualcomm® SA8295P | 14.142 ms | 0 - 223 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 6.876 ms | 0 - 225 MB | NPU |
| SAM2Decoder | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 16.291 ms | 14 - 210 MB | NPU |
| SAM2Encoder | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 97.348 ms | 44 - 2275 MB | NPU |
| SAM2Encoder | ONNX | float | Snapdragon® X2 Elite | 99.905 ms | 71 - 71 MB | NPU |
| SAM2Encoder | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 144.746 ms | 45 - 3849 MB | NPU |
| SAM2Encoder | ONNX | float | Qualcomm® QCS8550 (Proxy) | 196.22 ms | 0 - 87 MB | NPU |
| SAM2Encoder | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 113.929 ms | 33 - 1667 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 40.345 ms | 11 - 1876 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Snapdragon® X2 Elite | 42.196 ms | 51 - 51 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Snapdragon® X Elite | 89.208 ms | 47 - 47 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 62.035 ms | 12 - 2009 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Qualcomm® QCS6490 | 2166.168 ms | 765 - 789 MB | CPU |
| SAM2Encoder | ONNX | w8a8 | Qualcomm® QCS8550 (Proxy) | 88.54 ms | 0 - 59 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Qualcomm® QCM6690 | 1338.001 ms | 656 - 670 MB | CPU |
| SAM2Encoder | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 57.69 ms | 11 - 1823 MB | NPU |
| SAM2Encoder | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 1257.464 ms | 662 - 677 MB | CPU |
| SAM2Encoder | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 89.382 ms | 12 - 1648 MB | NPU |
| SAM2Encoder | QNN_DLC | float | Snapdragon® X2 Elite | 97.583 ms | 12 - 12 MB | NPU |
| SAM2Encoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 146.055 ms | 0 - 1990 MB | NPU |
| SAM2Encoder | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 204.085 ms | 12 - 15 MB | NPU |
| SAM2Encoder | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 395.799 ms | 13 - 1950 MB | NPU |
| SAM2Encoder | QNN_DLC | float | Qualcomm® SA8295P | 303.512 ms | 1 - 1619 MB | NPU |
| SAM2Encoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 113.004 ms | 12 - 1675 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 83.205 ms | 3 - 1685 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 81.413 ms | 3 - 3 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 85.457 ms | 3 - 3 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 56.816 ms | 3 - 2047 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 149.217 ms | 3 - 1666 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 82.232 ms | 3 - 6 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® SA8775P | 85.262 ms | 3 - 1666 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 1678.878 ms | 3 - 1890 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 142.822 ms | 3 - 2022 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® SA7255P | 149.217 ms | 3 - 1666 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 95.058 ms | 3 - 1669 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 42.611 ms | 3 - 1656 MB | NPU |
| SAM2Encoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 113.321 ms | 3 - 1793 MB | NPU |
| SAM2Encoder | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 100.758 ms | 15 - 2351 MB | NPU |
| SAM2Encoder | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 148.286 ms | 15 - 2047 MB | NPU |
| SAM2Encoder | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 458.243 ms | 16 - 1692 MB | NPU |
| SAM2Encoder | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 204.544 ms | 16 - 20 MB | NPU |
| SAM2Encoder | TFLITE | float | Qualcomm® SA8775P | 217.798 ms | 16 - 1692 MB | NPU |
| SAM2Encoder | TFLITE | float | Qualcomm® SA7255P | 458.243 ms | 16 - 1692 MB | NPU |
| SAM2Encoder | TFLITE | float | Qualcomm® SA8295P | 296.088 ms | 16 - 1660 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 39.555 ms | 3 - 1860 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 60.723 ms | 2 - 1984 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 150.504 ms | 4 - 1740 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 88.866 ms | 4 - 8 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® SA8775P | 88.452 ms | 4 - 1738 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® QCM6690 | 2502.605 ms | 109 - 384 MB | CPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 149.919 ms | 4 - 2044 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® SA7255P | 150.504 ms | 4 - 1740 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Qualcomm® SA8295P | 101.466 ms | 4 - 1760 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 60.506 ms | 3 - 1775 MB | NPU |
| SAM2Encoder | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 1239.584 ms | 64 - 317 MB | CPU |
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.
