|
Download README.md from qualcomm/U2Net-Segmentation: direct link, hf CLI and curl.
- Browser
- Download file 14.5 kB
-
https://huggingface.co/qualcomm/U2Net-Segmentation/resolve/main/README.md
- Command line
-
hf download hf://qualcomm/U2Net-Segmentation/README.md
-
curl -L -o README.md https://huggingface.co/qualcomm/U2Net-Segmentation/resolve/main/README.md
14.5 kB
| library_name: pytorch | |
| license: apache-2.0 | |
| tags: | |
| - real_time | |
| - android | |
| pipeline_tag: image-segmentation | |
|  | |
| # 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.66.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.50, ONNX Runtime 1.30.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.66.0/u2net_segmentation-onnx-float.zip) | |
| | ONNX | w8a8 | Universal | QAIRT 2.50, ONNX Runtime 1.30.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.66.0/u2net_segmentation-onnx-w8a8.zip) | |
| | QNN_DLC | float | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.66.0/u2net_segmentation-qnn_dlc-float.zip) | |
| | QNN_DLC | w8a8 | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.66.0/u2net_segmentation-qnn_dlc-w8a8.zip) | |
| | TFLITE | float | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.66.0/u2net_segmentation-tflite-float.zip) | |
| | TFLITE | w8a8 | Universal | QAIRT 2.50 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/u2net_segmentation/releases/v0.66.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.66.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.66.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.344 ms | 0 - 193 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 9.486 ms | 2 - 193 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Snapdragon® X2 Elite | 8.186 ms | 1 - 1 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Snapdragon® X Elite | 17.587 ms | 86 - 86 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Snapdragon® 8 Gen 1 Mobile | 28.489 ms | 0 - 247 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ IQ-8275 | 30.342 ms | 1 - 6 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 17.31 ms | 0 - 432 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Qualcomm® QCS8450 | 28.489 ms | 0 - 247 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ IQ-9075 | 28.636 ms | 1 - 6 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ IQ-X7181 | 17.587 ms | 86 - 86 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Qualcomm® Dragonwing™ Q-8750 | 9.486 ms | 2 - 193 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 6.329 ms | 2 - 192 MB | NPU | |
| | U2Net-Segmentation | ONNX | float | Snapdragon® 8 Elite Gen 6 Mobile | 7.987 ms | 2 - 194 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 3.013 ms | 0 - 204 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.664 ms | 0 - 197 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® X2 Elite | 3.038 ms | 1 - 1 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® X Elite | 6.735 ms | 44 - 44 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Gen 1 Mobile | 8.142 ms | 0 - 287 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 28.686 ms | 0 - 4 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 6.745 ms | 0 - 5 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 6.6 ms | 0 - 50 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® QCS8450 | 8.142 ms | 0 - 287 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 6.633 ms | 0 - 4 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 6.735 ms | 44 - 44 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 103.558 ms | 1 - 239 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 10.048 ms | 0 - 235 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.664 ms | 0 - 197 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 10.048 ms | 0 - 235 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 2.542 ms | 0 - 201 MB | NPU | |
| | U2Net-Segmentation | ONNX | w8a8 | Snapdragon® 8 Elite Gen 6 Mobile | 3.007 ms | 0 - 233 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 8.339 ms | 1 - 184 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 10.844 ms | 1 - 182 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® X2 Elite | 9.668 ms | 1 - 1 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® X Elite | 20.574 ms | 1 - 1 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Gen 1 Mobile | 30.94 ms | 1 - 235 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-8275 | 31.916 ms | 1 - 6 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 19.855 ms | 1 - 3 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® QCS8450 | 30.94 ms | 1 - 235 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-9075 | 30.684 ms | 1 - 5 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ IQ-X7181 | 20.574 ms | 1 - 1 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® Dragonwing™ Q-8750 | 10.844 ms | 1 - 182 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Qualcomm® SA8295P | 32.736 ms | 1 - 180 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 7.08 ms | 1 - 182 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | float | Snapdragon® 8 Elite Gen 6 Mobile | 8.969 ms | 1 - 185 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 3.091 ms | 0 - 187 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.908 ms | 0 - 184 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® X2 Elite | 3.501 ms | 0 - 0 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® X Elite | 7.473 ms | 0 - 0 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Gen 1 Mobile | 8.777 ms | 0 - 267 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 30.537 ms | 0 - 3 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 7.138 ms | 0 - 3 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 7.035 ms | 0 - 2 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® QCS8450 | 8.777 ms | 0 - 267 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 7.179 ms | 2 - 5 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ IQ-X7181 | 7.473 ms | 0 - 0 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 106.917 ms | 0 - 224 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 10.524 ms | 0 - 222 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.908 ms | 0 - 184 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA7255P | 18.541 ms | 0 - 181 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Qualcomm® SA8295P | 10.962 ms | 0 - 186 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 10.524 ms | 0 - 222 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 2.587 ms | 0 - 187 MB | NPU | |
| | U2Net-Segmentation | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 6 Mobile | 3.221 ms | 0 - 219 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 8.34 ms | 0 - 186 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 10.846 ms | 0 - 187 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Gen 1 Mobile | 30.775 ms | 1 - 311 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ IQ-8275 | 31.843 ms | 0 - 91 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 20.097 ms | 0 - 3 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® SA8775P | 30.386 ms | 1 - 183 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® SA8650P | 30.386 ms | 1 - 183 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® SA8255P | 30.386 ms | 1 - 183 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® QCS8450 | 30.775 ms | 1 - 311 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ IQ-9075 | 30.238 ms | 0 - 90 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® Dragonwing™ Q-8750 | 10.846 ms | 0 - 187 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® SA7255P | 105.055 ms | 1 - 181 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Qualcomm® SA8295P | 32.742 ms | 1 - 187 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 7.072 ms | 0 - 189 MB | NPU | |
| | U2Net-Segmentation | TFLITE | float | Snapdragon® 8 Elite Gen 6 Mobile | 8.978 ms | 0 - 188 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 For Galaxy Mobile | 2.766 ms | 0 - 188 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 3.485 ms | 0 - 183 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Gen 1 Mobile | 8.131 ms | 0 - 268 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS6490 | 33.338 ms | 1 - 56 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-8275 | 6.531 ms | 0 - 47 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ QCS8550 (Proxy) | 6.247 ms | 0 - 3 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8775P | 6.674 ms | 0 - 182 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8650P | 6.674 ms | 0 - 182 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8255P | 6.674 ms | 0 - 182 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® QCS8450 | 8.131 ms | 0 - 268 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ IQ-9075 | 6.49 ms | 0 - 46 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-6690 | 102.05 ms | 1 - 223 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-7790 | 11.541 ms | 1 - 219 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® Dragonwing™ Q-8750 | 3.485 ms | 0 - 183 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA7255P | 17.147 ms | 0 - 180 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Qualcomm® SA8295P | 10.18 ms | 0 - 185 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 11.541 ms | 1 - 219 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite Extreme Gen 6 Mobile | 2.325 ms | 0 - 187 MB | NPU | |
| | U2Net-Segmentation | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 6 Mobile | 2.859 ms | 0 - 219 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). | |