Image Segmentation
PyTorch
foundation
android

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.51, ONNX Runtime 1.30.0 Download
QNN_DLC float Universal QAIRT 2.51 Download
QNN_DLC w8a8 Universal QAIRT 2.51 Download
TFLITE w8a8 Universal QAIRT 2.51 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.508 ms 0 - 145 MB NPU
decoder ONNX w8a8 Snapdragon® 8 Elite For Galaxy Mobile 1.643 ms 0 - 119 MB NPU
decoder ONNX w8a8 Snapdragon® X2 Elite 1.557 ms 4 - 4 MB NPU
decoder ONNX w8a8 Snapdragon® X Elite 3.128 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.529 ms 4 - 143 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ QCS6490 10.286 ms 4 - 7 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ IQ-8275 2.98 ms 4 - 8 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ QCS8550 (Proxy) 3.023 ms 2 - 7 MB NPU
decoder ONNX w8a8 Qualcomm® QCS8450 3.529 ms 4 - 143 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ IQ-9075 3.374 ms 4 - 8 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ IQ-X7181 3.128 ms 4 - 4 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ Q-6690 15.925 ms 2 - 232 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ Q-7790 4.367 ms 4 - 234 MB NPU
decoder ONNX w8a8 Qualcomm® Dragonwing™ Q-8750 1.643 ms 0 - 119 MB NPU
decoder ONNX w8a8 Snapdragon® 7 Gen 4 Mobile 4.367 ms 4 - 234 MB NPU
decoder ONNX w8a8 Snapdragon® 8 Elite Extreme Gen 6 Mobile 1.229 ms 4 - 147 MB NPU
decoder ONNX w8a8 Snapdragon® 8 Elite Gen 6 Mobile 1.539 ms 0 - 131 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 2.719 ms 4 - 206 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite For Galaxy Mobile 3.105 ms 4 - 198 MB NPU
decoder QNN_DLC float Snapdragon® X2 Elite 3.239 ms 16 - 16 MB NPU
decoder QNN_DLC float Snapdragon® X Elite 6.21 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 8.595 ms 4 - 212 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ IQ-8275 6.213 ms 16 - 35 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ QCS8550 (Proxy) 5.954 ms 16 - 123 MB NPU
decoder QNN_DLC float Qualcomm® QCS8450 8.595 ms 4 - 212 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ IQ-9075 6.725 ms 16 - 35 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ IQ-X7181 6.21 ms 16 - 16 MB NPU
decoder QNN_DLC float Qualcomm® Dragonwing™ Q-8750 3.105 ms 4 - 198 MB NPU
decoder QNN_DLC float Qualcomm® SA8295P 9.186 ms 0 - 186 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite Extreme Gen 6 Mobile 2.363 ms 4 - 95 MB NPU
decoder QNN_DLC float Snapdragon® 8 Elite Gen 6 Mobile 3.263 ms 4 - 203 MB NPU
decoder QNN_DLC w8a8 Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 1.385 ms 1 - 118 MB NPU
decoder QNN_DLC w8a8 Snapdragon® 8 Elite For Galaxy Mobile 1.481 ms 1 - 86 MB NPU
decoder QNN_DLC w8a8 Snapdragon® X2 Elite 1.791 ms 4 - 4 MB NPU
decoder QNN_DLC w8a8 Snapdragon® X Elite 3.071 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 3.216 ms 0 - 108 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ QCS6490 9.528 ms 1 - 7 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ IQ-8275 2.693 ms 1 - 8 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ QCS8550 (Proxy) 2.722 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 3.216 ms 0 - 108 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ IQ-9075 3.037 ms 3 - 9 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ IQ-X7181 3.071 ms 4 - 4 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ Q-6690 13.725 ms 4 - 206 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ Q-7790 4.063 ms 4 - 207 MB NPU
decoder QNN_DLC w8a8 Qualcomm® Dragonwing™ Q-8750 1.481 ms 1 - 86 MB NPU
decoder QNN_DLC w8a8 Qualcomm® SA8295P 3.744 ms 4 - 93 MB NPU
decoder QNN_DLC w8a8 Snapdragon® 7 Gen 4 Mobile 4.063 ms 4 - 207 MB NPU
decoder QNN_DLC w8a8 Snapdragon® 8 Elite Extreme Gen 6 Mobile 1.144 ms 0 - 113 MB NPU
decoder QNN_DLC w8a8 Snapdragon® 8 Elite Gen 6 Mobile 1.451 ms 0 - 100 MB NPU
decoder TFLITE w8a8 Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 2.104 ms 0 - 233 MB NPU
decoder TFLITE w8a8 Snapdragon® 8 Elite For Galaxy Mobile 3.555 ms 0 - 204 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.097 ms 0 - 232 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ QCS6490 32.742 ms 12 - 59 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ IQ-8275 7.873 ms 0 - 15 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ QCS8550 (Proxy) 8.205 ms 0 - 33 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.097 ms 0 - 232 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ IQ-9075 9.237 ms 0 - 15 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ Q-6690 33.794 ms 12 - 189 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ Q-7790 14.361 ms 12 - 209 MB NPU
decoder TFLITE w8a8 Qualcomm® Dragonwing™ Q-8750 3.555 ms 0 - 204 MB NPU
decoder TFLITE w8a8 Qualcomm® SA7255P 33.482 ms 7 - 16 MB CPU
decoder TFLITE w8a8 Qualcomm® SA8295P 10.566 ms 0 - 216 MB NPU
decoder TFLITE w8a8 Snapdragon® 7 Gen 4 Mobile 14.361 ms 12 - 209 MB NPU
decoder TFLITE w8a8 Snapdragon® 8 Elite Extreme Gen 6 Mobile 1.93 ms 0 - 226 MB NPU
decoder TFLITE w8a8 Snapdragon® 8 Elite Gen 6 Mobile 3.185 ms 0 - 220 MB NPU
encoder ONNX w8a8 Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 38.587 ms 11 - 1840 MB NPU
encoder ONNX w8a8 Snapdragon® 8 Elite For Galaxy Mobile 38.694 ms 12 - 1648 MB NPU
encoder ONNX w8a8 Snapdragon® X2 Elite 38.813 ms 18 - 18 MB NPU
encoder ONNX w8a8 Snapdragon® X Elite 74.282 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 92.617 ms 15 - 1950 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ QCS6490 604.631 ms 6 - 12 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ IQ-8275 62.394 ms 10 - 18 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ QCS8550 (Proxy) 72.625 ms 12 - 15 MB NPU
encoder ONNX w8a8 Qualcomm® QCS8450 92.617 ms 15 - 1950 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ IQ-9075 73.453 ms 11 - 17 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ IQ-X7181 74.282 ms 46 - 46 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ Q-6690 2151.933 ms 3 - 2136 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ Q-7790 98.668 ms 8 - 2217 MB NPU
encoder ONNX w8a8 Qualcomm® Dragonwing™ Q-8750 38.694 ms 12 - 1648 MB NPU
encoder ONNX w8a8 Snapdragon® 7 Gen 4 Mobile 98.668 ms 8 - 2217 MB NPU
encoder ONNX w8a8 Snapdragon® 8 Elite Extreme Gen 6 Mobile 29.775 ms 15 - 1864 MB NPU
encoder ONNX w8a8 Snapdragon® 8 Elite Gen 6 Mobile 47.182 ms 14 - 1869 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 63.056 ms 12 - 2231 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite For Galaxy Mobile 88.132 ms 10 - 1575 MB NPU
encoder QNN_DLC float Snapdragon® X2 Elite 71.497 ms 12 - 12 MB NPU
encoder QNN_DLC float Snapdragon® X Elite 153.987 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 249.868 ms 12 - 1876 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ IQ-8275 162.115 ms 12 - 47 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ QCS8550 (Proxy) 157.898 ms 12 - 15 MB NPU
encoder QNN_DLC float Qualcomm® QCS8450 249.868 ms 12 - 1876 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ IQ-9075 168.113 ms 12 - 46 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ IQ-X7181 153.987 ms 12 - 12 MB NPU
encoder QNN_DLC float Qualcomm® Dragonwing™ Q-8750 88.132 ms 10 - 1575 MB NPU
encoder QNN_DLC float Qualcomm® SA8295P 235.665 ms 1 - 1407 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite Extreme Gen 6 Mobile 60.034 ms 12 - 1660 MB NPU
encoder QNN_DLC float Snapdragon® 8 Elite Gen 6 Mobile 72.79 ms 12 - 1504 MB NPU
encoder QNN_DLC w8a8 Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 39.633 ms 3 - 1814 MB NPU
encoder QNN_DLC w8a8 Snapdragon® 8 Elite For Galaxy Mobile 40.483 ms 3 - 1619 MB NPU
encoder QNN_DLC w8a8 Snapdragon® X2 Elite 40.236 ms 3 - 3 MB NPU
encoder QNN_DLC w8a8 Snapdragon® X Elite 78.215 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 100.327 ms 3 - 1896 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ QCS6490 613.955 ms 3 - 13 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ IQ-8275 65.902 ms 1 - 12 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ QCS8550 (Proxy) 75.565 ms 3 - 6 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 100.327 ms 3 - 1896 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ IQ-9075 76.032 ms 5 - 15 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ IQ-X7181 78.215 ms 3 - 3 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ Q-6690 1313.47 ms 3 - 1971 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ Q-7790 103.317 ms 3 - 1679 MB NPU
encoder QNN_DLC w8a8 Qualcomm® Dragonwing™ Q-8750 40.483 ms 3 - 1619 MB NPU
encoder QNN_DLC w8a8 Qualcomm® SA8295P 90.476 ms 1 - 1602 MB NPU
encoder QNN_DLC w8a8 Snapdragon® 7 Gen 4 Mobile 103.317 ms 3 - 1679 MB NPU
encoder QNN_DLC w8a8 Snapdragon® 8 Elite Extreme Gen 6 Mobile 31.404 ms 3 - 1861 MB NPU
encoder QNN_DLC w8a8 Snapdragon® 8 Elite Gen 6 Mobile 36.313 ms 3 - 1649 MB NPU
encoder TFLITE w8a8 Snapdragon® 8 Elite Gen 5 For Galaxy Mobile 34.364 ms 4 - 1738 MB NPU
encoder TFLITE w8a8 Snapdragon® 8 Elite For Galaxy Mobile 41.822 ms 4 - 1696 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 109.328 ms 5 - 2050 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ QCS6490 1210.607 ms 60 - 282 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ IQ-8275 69.558 ms 5 - 65 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ QCS8550 (Proxy) 81.555 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 109.328 ms 5 - 2050 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ IQ-9075 81.739 ms 2 - 62 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ Q-6690 2252.562 ms 37 - 991 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ Q-7790 297.021 ms 60 - 975 MB NPU
encoder TFLITE w8a8 Qualcomm® Dragonwing™ Q-8750 41.822 ms 4 - 1696 MB NPU
encoder TFLITE w8a8 Qualcomm® SA7255P 1727.407 ms 78 - 101 MB CPU
encoder TFLITE w8a8 Qualcomm® SA8295P 97.852 ms 6 - 1688 MB NPU
encoder TFLITE w8a8 Snapdragon® 7 Gen 4 Mobile 297.021 ms 60 - 975 MB NPU
encoder TFLITE w8a8 Snapdragon® 8 Elite Extreme Gen 6 Mobile 32.104 ms 5 - 1912 MB NPU
encoder TFLITE w8a8 Snapdragon® 8 Elite Gen 6 Mobile 52.698 ms 5 - 1891 MB NPU

License

  • The license for the original implementation of Segment-Anything-Model-2 can be found here.

References

Community

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for qualcomm/Segment-Anything-Model-2