Image Segmentation
PyTorch
real_time
android
U2Net-Segmentation / README.md
qaihm-bot's picture
v0.67.0
f337f74 verified
|
Raw History Blame Contribute Delete
14.8 kB
---
library_name: pytorch
license: apache-2.0
tags:
- real_time
- android
pipeline_tag: image-segmentation
---
![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/web-assets/model_demo.png)
# U2Net-Segmentation: Optimized for Qualcomm Devices
U2-Net is a machine learning model for salient object detection and foreground extraction. It uses a two-level nested U-structure (RSU blocks) to capture both local and global context at multiple scales, producing high-quality binary foreground masks. The model is trained on the DUTS dataset and is well-suited for background removal, portrait segmentation, and object extraction on mobile and edge devices.
This is based on the implementation of U2Net-Segmentation found [here](https://github.com/xuebinqin/U-2-Net).
This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/v0.67.0/src/qai_hub_models/models/u2net_segmentation) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) 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.51, ONNX Runtime 1.30.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.67.0/u2net_segmentation-onnx-float.zip)
| ONNX | w8a8 | Universal | QAIRT 2.51, ONNX Runtime 1.30.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.67.0/u2net_segmentation-onnx-w8a8.zip)
| QNN_DLC | float | Universal | QAIRT 2.51 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.67.0/u2net_segmentation-qnn_dlc-float.zip)
| QNN_DLC | w8a8 | Universal | QAIRT 2.51 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.67.0/u2net_segmentation-qnn_dlc-w8a8.zip)
| TFLITE | float | Universal | QAIRT 2.51 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.67.0/u2net_segmentation-tflite-float.zip)
| TFLITE | w8a8 | Universal | QAIRT 2.51 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.67.0/u2net_segmentation-tflite-w8a8.zip)
For more device-specific assets and performance metrics, visit **[U2Net-Segmentation on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/u2net_segmentation)**.
### Option 2: Export with Custom Configurations
Use the [Qualcomm® AI Hub Models](https://github.com/qualcomm/ai-hub-models/blob/v0.67.0/src/qai_hub_models/models/u2net_segmentation) 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 [U2Net-Segmentation on GitHub](https://github.com/qualcomm/ai-hub-models/blob/v0.67.0/src/qai_hub_models/models/u2net_segmentation) for usage instructions.
## Model Details
**Model Type:** Model_use_case.semantic_segmentation
**Model Stats:**
- Input resolution: 320x320
- Model checkpoint: u2net.pth
- Number of output classes: 1 (salient foreground mask)
- Number of parameters: 44.0M
## Performance Summary
| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
|---|---|---|---|---|---|---
| U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 7.475 ms | 0 - 190 MB | NPU
| U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 9.321 ms | 2 - 194 MB | NPU
| U2Net-Segmentation | ONNX | float | Snapdragon® X2 Elite | 8.279 ms | 1 - 1 MB | NPU
| U2Net-Segmentation | ONNX | float | Snapdragon® X Elite | 16.725 ms | 86 - 86 MB | NPU
| U2Net-Segmentation | ONNX | float | Snapdragon® 8 Gen 1 Mobile | 28.183 ms | 1 - 247 MB | NPU
| U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ IQ-8275 | 30.663 ms | 1 - 6 MB | NPU
| U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 16.284 ms | 0 - 97 MB | NPU
| U2Net-Segmentation | ONNX | float | Qualcomm® QCS8450 | 28.183 ms | 1 - 247 MB | NPU
| U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ IQ-9075 | 28.23 ms | 1 - 6 MB | NPU
| U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ IQ-X7181 | 16.725 ms | 86 - 86 MB | NPU
| U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ Q-8750 | 9.321 ms | 2 - 194 MB | NPU
| U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 6.686 ms | 2 - 194 MB | NPU
| U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite Gen 6 Mobile | 7.844 ms | 2 - 190 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 3.001 ms | 0 - 204 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.679 ms | 0 - 200 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® X2 Elite | 3.039 ms | 1 - 1 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® X Elite | 6.843 ms | 44 - 44 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Gen 1 Mobile | 8.196 ms | 0 - 288 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 29.39 ms | 0 - 4 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 6.671 ms | 0 - 5 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 6.715 ms | 0 - 50 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® QCS8450 | 8.196 ms | 0 - 288 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 6.62 ms | 0 - 4 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 6.843 ms | 44 - 44 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 109.471 ms | 0 - 240 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 10.302 ms | 0 - 236 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.679 ms | 0 - 200 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 10.302 ms | 0 - 236 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 2.563 ms | 0 - 201 MB | NPU
| U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite Gen 6 Mobile | 3.07 ms | 0 - 201 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 8.281 ms | 1 - 187 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 10.585 ms | 1 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® X2 Elite | 9.692 ms | 1 - 1 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® X Elite | 19.042 ms | 1 - 1 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 30.692 ms | 1 - 241 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-8275 | 31.809 ms | 1 - 6 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 18.299 ms | 1 - 3 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® QCS8450 | 30.692 ms | 1 - 241 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-9075 | 29.984 ms | 1 - 5 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-X7181 | 19.042 ms | 1 - 1 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ Q-8750 | 10.585 ms | 1 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® SA7255P | 104.791 ms | 1 - 179 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Qualcomm® SA8295P | 32.025 ms | 1 - 180 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 7.221 ms | 1 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite Gen 6 Mobile | 9.043 ms | 1 - 181 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 3.152 ms | 0 - 189 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.841 ms | 0 - 185 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 3.457 ms | 0 - 0 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® X Elite | 7.503 ms | 0 - 0 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Gen 1 Mobile | 8.945 ms | 0 - 272 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 30.429 ms | 2 - 5 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 7.025 ms | 0 - 4 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 7.016 ms | 0 - 31 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA8775P | 7.375 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA8650P | 7.375 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA8255P | 7.375 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® QCS8450 | 8.945 ms | 0 - 272 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 7.043 ms | 0 - 3 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 7.503 ms | 0 - 0 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 111.984 ms | 0 - 227 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 10.707 ms | 0 - 224 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.841 ms | 0 - 185 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA7255P | 18.764 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA8295P | 11.021 ms | 0 - 186 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 10.707 ms | 0 - 224 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 2.604 ms | 0 - 187 MB | NPU
| U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 6 Mobile | 3.221 ms | 0 - 186 MB | NPU
| U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 8.202 ms | 1 - 190 MB | NPU
| U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 10.417 ms | 1 - 187 MB | NPU
| U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Gen 1 Mobile | 29.75 ms | 0 - 312 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ IQ-8275 | 31.962 ms | 0 - 91 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 18.452 ms | 0 - 3 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® SA8775P | 29.328 ms | 0 - 184 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® SA8650P | 29.328 ms | 0 - 184 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® SA8255P | 29.328 ms | 0 - 184 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® QCS8450 | 29.75 ms | 0 - 312 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ IQ-9075 | 29.915 ms | 0 - 90 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ Q-8750 | 10.417 ms | 1 - 187 MB | NPU
| U2Net-Segmentation | TFLITE | float | Qualcomm® SA8295P | 32.03 ms | 1 - 191 MB | NPU
| U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 7.386 ms | 0 - 192 MB | NPU
| U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite Gen 6 Mobile | 8.635 ms | 0 - 185 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 2.891 ms | 0 - 185 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.731 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Gen 1 Mobile | 8.347 ms | 0 - 268 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 32.288 ms | 1 - 56 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 6.593 ms | 0 - 47 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 6.614 ms | 0 - 3 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8775P | 6.959 ms | 0 - 180 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8650P | 6.959 ms | 0 - 180 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8255P | 6.959 ms | 0 - 180 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® QCS8450 | 8.347 ms | 0 - 268 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 6.595 ms | 0 - 46 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 90.188 ms | 1 - 221 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 11.154 ms | 1 - 221 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.731 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA7255P | 17.514 ms | 0 - 180 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8295P | 10.423 ms | 0 - 183 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 11.154 ms | 1 - 221 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 2.589 ms | 0 - 187 MB | NPU
| U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 6 Mobile | 3.083 ms | 0 - 185 MB | NPU
## License
* The license for the original implementation of U2Net-Segmentation can be found
[here](https://github.com/xuebinqin/U-2-Net/blob/master/LICENSE).
## References
* [U^2-Net: Going Deeper with Nested U-Structure for Salient Object Detection](https://arxiv.org/abs/2005.09007)
* [Source Model Implementation](https://github.com/xuebinqin/U-2-Net)
## Community
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).