Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
library_name: pytorch
|
3 |
license: agpl-3.0
|
4 |
-
pipeline_tag: image-segmentation
|
5 |
tags:
|
6 |
- real_time
|
7 |
- android
|
|
|
8 |
|
9 |
---
|
10 |
|
@@ -19,10 +19,7 @@ Ultralytics YOLOv8 is a machine learning model that predicts bounding boxes, seg
|
|
19 |
This model is an implementation of YOLOv8-Segmentation found [here](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models/yolo/segment).
|
20 |
|
21 |
|
22 |
-
|
23 |
-
More details on model performance across various devices, can be found
|
24 |
-
[here](https://aihub.qualcomm.com/models/yolov8_seg).
|
25 |
-
|
26 |
|
27 |
### Model Details
|
28 |
|
@@ -36,211 +33,37 @@ More details on model performance across various devices, can be found
|
|
36 |
|
37 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
38 |
|---|---|---|---|---|---|---|---|---|
|
39 |
-
| YOLOv8-Segmentation | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 6.
|
40 |
-
| YOLOv8-Segmentation | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 6.
|
41 |
-
| YOLOv8-Segmentation | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 7.
|
42 |
-
| YOLOv8-Segmentation | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 4.
|
43 |
-
| YOLOv8-Segmentation | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 4.
|
44 |
-
| YOLOv8-Segmentation | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 5.
|
45 |
-
| YOLOv8-Segmentation | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE |
|
46 |
-
| YOLOv8-Segmentation | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 4.
|
47 |
-
| YOLOv8-Segmentation | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 4.
|
48 |
-
| YOLOv8-Segmentation |
|
49 |
-
| YOLOv8-Segmentation |
|
50 |
-
| YOLOv8-Segmentation |
|
51 |
-
| YOLOv8-Segmentation |
|
52 |
-
| YOLOv8-Segmentation |
|
53 |
-
| YOLOv8-Segmentation |
|
54 |
-
| YOLOv8-Segmentation |
|
55 |
-
| YOLOv8-Segmentation |
|
56 |
-
| YOLOv8-Segmentation |
|
57 |
-
| YOLOv8-Segmentation |
|
58 |
-
| YOLOv8-Segmentation |
|
59 |
-
| YOLOv8-Segmentation |
|
60 |
-
| YOLOv8-Segmentation |
|
61 |
-
| YOLOv8-Segmentation |
|
62 |
-
| YOLOv8-Segmentation |
|
63 |
-
| YOLOv8-Segmentation |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
## Installation
|
69 |
-
|
70 |
-
|
71 |
-
Install the package via pip:
|
72 |
-
```bash
|
73 |
-
pip install "qai-hub-models[yolov8-seg]"
|
74 |
-
```
|
75 |
-
|
76 |
-
|
77 |
-
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
78 |
-
|
79 |
-
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
80 |
-
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
81 |
-
|
82 |
-
With this API token, you can configure your client to run models on the cloud
|
83 |
-
hosted devices.
|
84 |
-
```bash
|
85 |
-
qai-hub configure --api_token API_TOKEN
|
86 |
-
```
|
87 |
-
Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
## Demo off target
|
92 |
-
|
93 |
-
The package contains a simple end-to-end demo that downloads pre-trained
|
94 |
-
weights and runs this model on a sample input.
|
95 |
-
|
96 |
-
```bash
|
97 |
-
python -m qai_hub_models.models.yolov8_seg.demo
|
98 |
-
```
|
99 |
-
|
100 |
-
The above demo runs a reference implementation of pre-processing, model
|
101 |
-
inference, and post processing.
|
102 |
-
|
103 |
-
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
104 |
-
environment, please add the following to your cell (instead of the above).
|
105 |
-
```
|
106 |
-
%run -m qai_hub_models.models.yolov8_seg.demo
|
107 |
-
```
|
108 |
-
|
109 |
-
|
110 |
-
### Run model on a cloud-hosted device
|
111 |
-
|
112 |
-
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
113 |
-
device. This script does the following:
|
114 |
-
* Performance check on-device on a cloud-hosted device
|
115 |
-
* Downloads compiled assets that can be deployed on-device for Android.
|
116 |
-
* Accuracy check between PyTorch and on-device outputs.
|
117 |
-
|
118 |
-
```bash
|
119 |
-
python -m qai_hub_models.models.yolov8_seg.export
|
120 |
-
```
|
121 |
-
```
|
122 |
-
Profiling Results
|
123 |
-
------------------------------------------------------------
|
124 |
-
YOLOv8-Segmentation
|
125 |
-
Device : Samsung Galaxy S23 (13)
|
126 |
-
Runtime : TFLITE
|
127 |
-
Estimated inference time (ms) : 6.5
|
128 |
-
Estimated peak memory usage (MB): [4, 27]
|
129 |
-
Total # Ops : 338
|
130 |
-
Compute Unit(s) : NPU (338 ops)
|
131 |
-
```
|
132 |
-
|
133 |
-
|
134 |
-
## How does this work?
|
135 |
-
|
136 |
-
This [export script](https://aihub.qualcomm.com/models/yolov8_seg/qai_hub_models/models/YOLOv8-Segmentation/export.py)
|
137 |
-
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
138 |
-
on-device. Lets go through each step below in detail:
|
139 |
-
|
140 |
-
Step 1: **Compile model for on-device deployment**
|
141 |
-
|
142 |
-
To compile a PyTorch model for on-device deployment, we first trace the model
|
143 |
-
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
144 |
|
145 |
-
```python
|
146 |
-
import torch
|
147 |
|
148 |
-
import qai_hub as hub
|
149 |
-
from qai_hub_models.models.yolov8_seg import Model
|
150 |
-
|
151 |
-
# Load the model
|
152 |
-
torch_model = Model.from_pretrained()
|
153 |
-
|
154 |
-
# Device
|
155 |
-
device = hub.Device("Samsung Galaxy S24")
|
156 |
-
|
157 |
-
# Trace model
|
158 |
-
input_shape = torch_model.get_input_spec()
|
159 |
-
sample_inputs = torch_model.sample_inputs()
|
160 |
-
|
161 |
-
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
162 |
-
|
163 |
-
# Compile model on a specific device
|
164 |
-
compile_job = hub.submit_compile_job(
|
165 |
-
model=pt_model,
|
166 |
-
device=device,
|
167 |
-
input_specs=torch_model.get_input_spec(),
|
168 |
-
)
|
169 |
-
|
170 |
-
# Get target model to run on-device
|
171 |
-
target_model = compile_job.get_target_model()
|
172 |
-
|
173 |
-
```
|
174 |
-
|
175 |
-
|
176 |
-
Step 2: **Performance profiling on cloud-hosted device**
|
177 |
-
|
178 |
-
After compiling models from step 1. Models can be profiled model on-device using the
|
179 |
-
`target_model`. Note that this scripts runs the model on a device automatically
|
180 |
-
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
181 |
-
provided job URL to view a variety of on-device performance metrics.
|
182 |
-
```python
|
183 |
-
profile_job = hub.submit_profile_job(
|
184 |
-
model=target_model,
|
185 |
-
device=device,
|
186 |
-
)
|
187 |
-
|
188 |
-
```
|
189 |
-
|
190 |
-
Step 3: **Verify on-device accuracy**
|
191 |
-
|
192 |
-
To verify the accuracy of the model on-device, you can run on-device inference
|
193 |
-
on sample input data on the same cloud hosted device.
|
194 |
-
```python
|
195 |
-
input_data = torch_model.sample_inputs()
|
196 |
-
inference_job = hub.submit_inference_job(
|
197 |
-
model=target_model,
|
198 |
-
device=device,
|
199 |
-
inputs=input_data,
|
200 |
-
)
|
201 |
-
on_device_output = inference_job.download_output_data()
|
202 |
-
|
203 |
-
```
|
204 |
-
With the output of the model, you can compute like PSNR, relative errors or
|
205 |
-
spot check the output with expected output.
|
206 |
-
|
207 |
-
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
208 |
-
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
## Run demo on a cloud-hosted device
|
213 |
-
|
214 |
-
You can also run the demo on-device.
|
215 |
-
|
216 |
-
```bash
|
217 |
-
python -m qai_hub_models.models.yolov8_seg.demo --on-device
|
218 |
-
```
|
219 |
-
|
220 |
-
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
221 |
-
environment, please add the following to your cell (instead of the above).
|
222 |
-
```
|
223 |
-
%run -m qai_hub_models.models.yolov8_seg.demo -- --on-device
|
224 |
-
```
|
225 |
-
|
226 |
-
|
227 |
-
## Deploying compiled model to Android
|
228 |
-
|
229 |
-
|
230 |
-
The models can be deployed using multiple runtimes:
|
231 |
-
- TensorFlow Lite (`.tflite` export): [This
|
232 |
-
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
233 |
-
guide to deploy the .tflite model in an Android application.
|
234 |
-
|
235 |
-
|
236 |
-
- QNN (`.so` export ): This [sample
|
237 |
-
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
238 |
-
provides instructions on how to use the `.so` shared library in an Android application.
|
239 |
-
|
240 |
-
|
241 |
-
## View on Qualcomm® AI Hub
|
242 |
-
Get more details on YOLOv8-Segmentation's performance across various devices [here](https://aihub.qualcomm.com/models/yolov8_seg).
|
243 |
-
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
244 |
|
245 |
|
246 |
## License
|
@@ -257,7 +80,26 @@ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
|
257 |
|
258 |
|
259 |
## Community
|
260 |
-
* Join [our AI Hub Slack community](https://
|
261 |
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
262 |
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
library_name: pytorch
|
3 |
license: agpl-3.0
|
|
|
4 |
tags:
|
5 |
- real_time
|
6 |
- android
|
7 |
+
pipeline_tag: image-segmentation
|
8 |
|
9 |
---
|
10 |
|
|
|
19 |
This model is an implementation of YOLOv8-Segmentation found [here](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models/yolo/segment).
|
20 |
|
21 |
|
22 |
+
More details on model performance across various devices, can be found [here](https://aihub.qualcomm.com/models/yolov8_seg).
|
|
|
|
|
|
|
23 |
|
24 |
### Model Details
|
25 |
|
|
|
33 |
|
34 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
35 |
|---|---|---|---|---|---|---|---|---|
|
36 |
+
| YOLOv8-Segmentation | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 6.339 ms | 4 - 31 MB | FP16 | NPU | -- |
|
37 |
+
| YOLOv8-Segmentation | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 6.374 ms | 5 - 7 MB | FP16 | NPU | -- |
|
38 |
+
| YOLOv8-Segmentation | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 7.4 ms | 15 - 47 MB | FP16 | NPU | -- |
|
39 |
+
| YOLOv8-Segmentation | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 4.641 ms | 4 - 62 MB | FP16 | NPU | -- |
|
40 |
+
| YOLOv8-Segmentation | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 4.417 ms | 5 - 25 MB | FP16 | NPU | -- |
|
41 |
+
| YOLOv8-Segmentation | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 5.023 ms | 17 - 82 MB | FP16 | NPU | -- |
|
42 |
+
| YOLOv8-Segmentation | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 3.766 ms | 0 - 51 MB | FP16 | NPU | -- |
|
43 |
+
| YOLOv8-Segmentation | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 4.392 ms | 5 - 60 MB | FP16 | NPU | -- |
|
44 |
+
| YOLOv8-Segmentation | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 4.813 ms | 3 - 58 MB | FP16 | NPU | -- |
|
45 |
+
| YOLOv8-Segmentation | SA7255P ADP | SA7255P | TFLITE | 93.022 ms | 4 - 49 MB | FP16 | NPU | -- |
|
46 |
+
| YOLOv8-Segmentation | SA7255P ADP | SA7255P | QNN | 92.171 ms | 1 - 8 MB | FP16 | NPU | -- |
|
47 |
+
| YOLOv8-Segmentation | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 6.341 ms | 4 - 22 MB | FP16 | NPU | -- |
|
48 |
+
| YOLOv8-Segmentation | SA8255 (Proxy) | SA8255P Proxy | QNN | 6.332 ms | 5 - 8 MB | FP16 | NPU | -- |
|
49 |
+
| YOLOv8-Segmentation | SA8295P ADP | SA8295P | TFLITE | 11.343 ms | 4 - 37 MB | FP16 | NPU | -- |
|
50 |
+
| YOLOv8-Segmentation | SA8295P ADP | SA8295P | QNN | 10.824 ms | 0 - 10 MB | FP16 | NPU | -- |
|
51 |
+
| YOLOv8-Segmentation | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 6.373 ms | 4 - 23 MB | FP16 | NPU | -- |
|
52 |
+
| YOLOv8-Segmentation | SA8650 (Proxy) | SA8650P Proxy | QNN | 6.346 ms | 5 - 7 MB | FP16 | NPU | -- |
|
53 |
+
| YOLOv8-Segmentation | SA8775P ADP | SA8775P | TFLITE | 9.949 ms | 4 - 49 MB | FP16 | NPU | -- |
|
54 |
+
| YOLOv8-Segmentation | SA8775P ADP | SA8775P | QNN | 9.903 ms | 0 - 6 MB | FP16 | NPU | -- |
|
55 |
+
| YOLOv8-Segmentation | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 93.022 ms | 4 - 49 MB | FP16 | NPU | -- |
|
56 |
+
| YOLOv8-Segmentation | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 92.171 ms | 1 - 8 MB | FP16 | NPU | -- |
|
57 |
+
| YOLOv8-Segmentation | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 6.424 ms | 4 - 27 MB | FP16 | NPU | -- |
|
58 |
+
| YOLOv8-Segmentation | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 6.319 ms | 5 - 8 MB | FP16 | NPU | -- |
|
59 |
+
| YOLOv8-Segmentation | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 9.949 ms | 4 - 49 MB | FP16 | NPU | -- |
|
60 |
+
| YOLOv8-Segmentation | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 9.903 ms | 0 - 6 MB | FP16 | NPU | -- |
|
61 |
+
| YOLOv8-Segmentation | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 9.95 ms | 4 - 46 MB | FP16 | NPU | -- |
|
62 |
+
| YOLOv8-Segmentation | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 9.311 ms | 5 - 47 MB | FP16 | NPU | -- |
|
63 |
+
| YOLOv8-Segmentation | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 7.066 ms | 5 - 5 MB | FP16 | NPU | -- |
|
64 |
+
| YOLOv8-Segmentation | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 7.708 ms | 17 - 17 MB | FP16 | NPU | -- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
|
|
|
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
|
69 |
## License
|
|
|
80 |
|
81 |
|
82 |
## Community
|
83 |
+
* Join [our AI Hub Slack community](https://qualcomm-ai-hub.slack.com/join/shared_invite/zt-2d5zsmas3-Sj0Q9TzslueCjS31eXG2UA#/shared-invite/email) to collaborate, post questions and learn more about on-device AI.
|
84 |
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
85 |
|
86 |
+
## Usage and Limitations
|
87 |
+
|
88 |
+
Model may not be used for or in connection with any of the following applications:
|
89 |
+
|
90 |
+
- Accessing essential private and public services and benefits;
|
91 |
+
- Administration of justice and democratic processes;
|
92 |
+
- Assessing or recognizing the emotional state of a person;
|
93 |
+
- Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics;
|
94 |
+
- Education and vocational training;
|
95 |
+
- Employment and workers management;
|
96 |
+
- Exploitation of the vulnerabilities of persons resulting in harmful behavior;
|
97 |
+
- General purpose social scoring;
|
98 |
+
- Law enforcement;
|
99 |
+
- Management and operation of critical infrastructure;
|
100 |
+
- Migration, asylum and border control management;
|
101 |
+
- Predictive policing;
|
102 |
+
- Real-time remote biometric identification in public spaces;
|
103 |
+
- Recommender systems of social media platforms;
|
104 |
+
- Scraping of facial images (from the internet or otherwise); and/or
|
105 |
+
- Subliminal manipulation
|