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 | w8a8 | Universal | QAIRT 2.50, ONNX Runtime 1.30.0 | Download |
| QNN_DLC | float | Universal | QAIRT 2.50 | Download |
| QNN_DLC | w8a8 | Universal | QAIRT 2.50 | Download |
| TFLITE | w8a8 | Universal | QAIRT 2.50 | 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:
- Input resolution: 720p (720x1280)
- Model checkpoint: sam2.1_hiera_t
- Model size (decoder) (float): 23.7 MB
- Model size (encoder) (float): 128 MB
- Number of parameters (decoder): 6.22M
- Number of parameters (encoder): 33.5M
Performance Summary
| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |
|---|---|---|---|---|---|---|
| decoder | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 1.411 ms | 0 - 138 MB | NPU |
| decoder | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 1.579 ms | 0 - 120 MB | NPU |
| decoder | ONNX | w8a8 | Snapdragon® X2 Elite | 1.483 ms | 4 - 4 MB | NPU |
| decoder | ONNX | w8a8 | Snapdragon® X Elite | 2.962 ms | 4 - 4 MB | NPU |
| decoder | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.902 ms | 4 - 147 MB | NPU |
| decoder | ONNX | w8a8 | Snapdragon® 8 Gen 1 Mobile | 3.488 ms | 4 - 145 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 9.728 ms | 4 - 7 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 3.015 ms | 4 - 8 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 2.838 ms | 2 - 127 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® QCS8450 | 3.488 ms | 4 - 145 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 3.353 ms | 4 - 7 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 2.962 ms | 4 - 4 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 14.968 ms | 2 - 232 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 3.592 ms | 4 - 237 MB | NPU |
| decoder | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 1.579 ms | 0 - 120 MB | NPU |
| decoder | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 3.592 ms | 4 - 237 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 2.429 ms | 4 - 187 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 2.828 ms | 4 - 188 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® X2 Elite | 2.902 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® X Elite | 5.662 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 3.635 ms | 0 - 203 MB | NPU |
| decoder | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 7.528 ms | 4 - 212 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-8275 | 6.055 ms | 16 - 35 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® QCS8450 | 7.528 ms | 4 - 212 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-9075 | 6.429 ms | 18 - 36 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-X7181 | 5.662 ms | 16 - 16 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® Dragonwing™ Q-8750 | 2.828 ms | 4 - 188 MB | NPU |
| decoder | QNN_DLC | float | Qualcomm® SA8295P | 8.192 ms | 0 - 186 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 0.87 ms | 1 - 112 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 0.957 ms | 1 - 88 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 1.306 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 2.241 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 1.278 ms | 0 - 108 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 1 Mobile | 2.445 ms | 0 - 111 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 6.441 ms | 1 - 7 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 2.143 ms | 1 - 8 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 1.959 ms | 4 - 6 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8650P | 2.559 ms | 4 - 89 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8255P | 2.559 ms | 4 - 89 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 | 2.445 ms | 0 - 111 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 2.407 ms | 2 - 9 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 2.241 ms | 4 - 4 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 9.878 ms | 4 - 204 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 2.483 ms | 4 - 207 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 0.957 ms | 1 - 88 MB | NPU |
| decoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 2.851 ms | 4 - 90 MB | NPU |
| decoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 2.483 ms | 4 - 207 MB | NPU |
| decoder | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 2.043 ms | 0 - 232 MB | NPU |
| decoder | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.571 ms | 0 - 205 MB | NPU |
| decoder | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 5.978 ms | 0 - 250 MB | NPU |
| decoder | TFLITE | w8a8 | Snapdragon® 8 Gen 1 Mobile | 9.005 ms | 0 - 233 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 32.188 ms | 14 - 61 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 7.949 ms | 0 - 15 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 7.903 ms | 0 - 139 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® SA8650P | 8.613 ms | 0 - 240 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® SA8255P | 8.613 ms | 0 - 240 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® QCS8450 | 9.005 ms | 0 - 233 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 9.399 ms | 0 - 14 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 32.235 ms | 12 - 191 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 13.923 ms | 13 - 201 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.571 ms | 0 - 205 MB | NPU |
| decoder | TFLITE | w8a8 | Qualcomm® SA8295P | 10.44 ms | 0 - 210 MB | NPU |
| decoder | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 13.923 ms | 13 - 201 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 38.539 ms | 10 - 1834 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 37.846 ms | 12 - 1641 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® X2 Elite | 37.684 ms | 18 - 18 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® X Elite | 73.258 ms | 46 - 46 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 49.966 ms | 15 - 1923 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® 8 Gen 1 Mobile | 96.186 ms | 11 - 2356 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 600.731 ms | 7 - 13 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 62.798 ms | 10 - 18 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 71.681 ms | 12 - 16 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® QCS8450 | 96.186 ms | 11 - 2356 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 72.508 ms | 13 - 19 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 73.258 ms | 46 - 46 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 1444.933 ms | 3 - 1971 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 92.473 ms | 5 - 1690 MB | NPU |
| encoder | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 37.846 ms | 12 - 1641 MB | NPU |
| encoder | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 92.473 ms | 5 - 1690 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 67.948 ms | 12 - 1554 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 101.231 ms | 12 - 1566 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® X2 Elite | 75.886 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® X Elite | 167.132 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 124.655 ms | 12 - 4387 MB | NPU |
| encoder | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 265.154 ms | 12 - 1895 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-8275 | 170.813 ms | 12 - 47 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® QCS8450 | 265.154 ms | 12 - 1895 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-9075 | 180.37 ms | 14 - 48 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-X7181 | 167.132 ms | 12 - 12 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® Dragonwing™ Q-8750 | 101.231 ms | 12 - 1566 MB | NPU |
| encoder | QNN_DLC | float | Qualcomm® SA8295P | 249.4 ms | 0 - 1420 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 39.936 ms | 3 - 1818 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 52.515 ms | 3 - 1715 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 39.585 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® X Elite | 79.52 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 53.091 ms | 3 - 1895 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 8 Gen 1 Mobile | 108.051 ms | 3 - 2328 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 603.92 ms | 5 - 15 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 67.55 ms | 3 - 14 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 76.594 ms | 3 - 8 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8650P | 81.826 ms | 3 - 1581 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8255P | 81.826 ms | 3 - 1581 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® QCS8450 | 108.051 ms | 3 - 2328 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 78.077 ms | 1 - 12 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 79.52 ms | 3 - 3 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 1711.639 ms | 3 - 1959 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 102.763 ms | 3 - 2221 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 52.515 ms | 3 - 1715 MB | NPU |
| encoder | QNN_DLC | w8a8 | Qualcomm® SA8295P | 92.522 ms | 0 - 1598 MB | NPU |
| encoder | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 102.763 ms | 3 - 2221 MB | NPU |
| encoder | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 34.694 ms | 4 - 1816 MB | NPU |
| encoder | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 41.23 ms | 4 - 1691 MB | NPU |
| encoder | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 56.716 ms | 89 - 2049 MB | NPU |
| encoder | TFLITE | w8a8 | Snapdragon® 8 Gen 1 Mobile | 108.004 ms | 5 - 2210 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 1211.839 ms | 60 - 282 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 70.831 ms | 5 - 65 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 81.73 ms | 5 - 9 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® SA8650P | 98.068 ms | 6 - 1877 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® SA8255P | 98.068 ms | 6 - 1877 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® QCS8450 | 108.004 ms | 5 - 2210 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 80.624 ms | 4 - 64 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 2057.255 ms | 55 - 1004 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 302.009 ms | 15 - 935 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 41.23 ms | 4 - 1691 MB | NPU |
| encoder | TFLITE | w8a8 | Qualcomm® SA8295P | 98.627 ms | 5 - 1688 MB | NPU |
| encoder | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 302.009 ms | 15 - 935 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.
