qaihm-bot commited on
Commit
b105154
·
verified ·
1 Parent(s): b4b2278

See https://github.com/quic/ai-hub-models/releases/v0.34.0 for changelog.

Files changed (1) hide show
  1. README.md +209 -56
README.md CHANGED
@@ -19,7 +19,11 @@ 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
- More details on model performance across various devices, can be found [here](https://aihub.qualcomm.com/models/yolov8_seg).
 
 
 
 
23
 
24
  ### Model Details
25
 
@@ -34,55 +38,223 @@ This model is an implementation of YOLOv8-Segmentation found [here](https://gith
34
 
35
  | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
36
  |---|---|---|---|---|---|---|---|---|
37
- | YOLOv8-Segmentation | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 21.491 ms | 4 - 65 MB | NPU | -- |
38
  | YOLOv8-Segmentation | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 17.023 ms | 4 - 117 MB | NPU | -- |
39
- | YOLOv8-Segmentation | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 11.53 ms | 4 - 50 MB | NPU | -- |
40
  | YOLOv8-Segmentation | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 10.219 ms | 5 - 43 MB | NPU | -- |
41
- | YOLOv8-Segmentation | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 8.117 ms | 4 - 27 MB | NPU | -- |
42
  | YOLOv8-Segmentation | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 4.457 ms | 5 - 41 MB | NPU | -- |
43
- | YOLOv8-Segmentation | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 10.25 ms | 4 - 66 MB | NPU | -- |
44
  | YOLOv8-Segmentation | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 6.317 ms | 0 - 112 MB | NPU | -- |
45
- | YOLOv8-Segmentation | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 21.491 ms | 4 - 65 MB | NPU | -- |
46
  | YOLOv8-Segmentation | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 17.023 ms | 4 - 117 MB | NPU | -- |
47
- | YOLOv8-Segmentation | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | TFLITE | 8.169 ms | 4 - 28 MB | NPU | -- |
48
  | YOLOv8-Segmentation | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | QNN_DLC | 4.48 ms | 5 - 48 MB | NPU | -- |
49
- | YOLOv8-Segmentation | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 12.674 ms | 4 - 34 MB | NPU | -- |
50
  | YOLOv8-Segmentation | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 8.576 ms | 0 - 34 MB | NPU | -- |
51
- | YOLOv8-Segmentation | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | TFLITE | 8.213 ms | 4 - 26 MB | NPU | -- |
52
  | YOLOv8-Segmentation | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | QNN_DLC | 4.481 ms | 5 - 35 MB | NPU | -- |
53
- | YOLOv8-Segmentation | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 10.25 ms | 4 - 66 MB | NPU | -- |
54
  | YOLOv8-Segmentation | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 6.317 ms | 0 - 112 MB | NPU | -- |
55
- | YOLOv8-Segmentation | float | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | TFLITE | 8.157 ms | 4 - 27 MB | NPU | -- |
56
  | YOLOv8-Segmentation | float | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | QNN_DLC | 4.47 ms | 4 - 43 MB | NPU | -- |
57
- | YOLOv8-Segmentation | float | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | ONNX | 6.74 ms | 10 - 93 MB | NPU | -- |
58
- | YOLOv8-Segmentation | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 5.902 ms | 3 - 68 MB | NPU | -- |
59
  | YOLOv8-Segmentation | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 3.28 ms | 5 - 204 MB | NPU | -- |
60
- | YOLOv8-Segmentation | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 4.457 ms | 16 - 211 MB | NPU | -- |
61
- | YOLOv8-Segmentation | float | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | TFLITE | 5.555 ms | 3 - 66 MB | NPU | -- |
62
  | YOLOv8-Segmentation | float | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | QNN_DLC | 2.965 ms | 5 - 130 MB | NPU | -- |
63
- | YOLOv8-Segmentation | float | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | ONNX | 3.693 ms | 1 - 132 MB | NPU | -- |
64
  | YOLOv8-Segmentation | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 5.029 ms | 5 - 5 MB | NPU | -- |
65
- | YOLOv8-Segmentation | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 7.144 ms | 17 - 17 MB | NPU | -- |
66
- | YOLOv8-Segmentation | w8a16 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 8.22 ms | 2 - 36 MB | NPU | -- |
67
- | YOLOv8-Segmentation | w8a16 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 5.137 ms | 2 - 46 MB | NPU | -- |
68
- | YOLOv8-Segmentation | w8a16 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 4.079 ms | 2 - 15 MB | NPU | -- |
69
- | YOLOv8-Segmentation | w8a16 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 4.789 ms | 0 - 36 MB | NPU | -- |
70
- | YOLOv8-Segmentation | w8a16 | RB3 Gen 2 (Proxy) | Qualcomm® QCS6490 (Proxy) | QNN_DLC | 16.582 ms | 2 - 40 MB | NPU | -- |
71
- | YOLOv8-Segmentation | w8a16 | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 8.22 ms | 2 - 36 MB | NPU | -- |
72
- | YOLOv8-Segmentation | w8a16 | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | QNN_DLC | 4.068 ms | 2 - 15 MB | NPU | -- |
73
- | YOLOv8-Segmentation | w8a16 | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 5.446 ms | 1 - 37 MB | NPU | -- |
74
- | YOLOv8-Segmentation | w8a16 | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | QNN_DLC | 4.073 ms | 2 - 16 MB | NPU | -- |
75
- | YOLOv8-Segmentation | w8a16 | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 4.789 ms | 0 - 36 MB | NPU | -- |
76
- | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | QNN_DLC | 4.08 ms | 2 - 16 MB | NPU | -- |
77
- | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | ONNX | 7.985 ms | 6 - 29 MB | NPU | -- |
78
- | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 2.695 ms | 2 - 45 MB | NPU | -- |
79
- | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 5.164 ms | 9 - 79 MB | NPU | -- |
80
- | YOLOv8-Segmentation | w8a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | QNN_DLC | 2.318 ms | 2 - 43 MB | NPU | -- |
81
- | YOLOv8-Segmentation | w8a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | ONNX | 5.008 ms | 5 - 103 MB | NPU | -- |
82
- | YOLOv8-Segmentation | w8a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 5.021 ms | 0 - 0 MB | NPU | -- |
83
- | YOLOv8-Segmentation | w8a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 8.782 ms | 15 - 15 MB | NPU | -- |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
 
 
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
 
88
  ## License
@@ -99,26 +271,7 @@ This model is an implementation of YOLOv8-Segmentation found [here](https://gith
99
 
100
 
101
  ## Community
102
- * 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.
103
  * For questions or feedback please [reach out to us](mailto:[email protected]).
104
 
105
- ## Usage and Limitations
106
-
107
- Model may not be used for or in connection with any of the following applications:
108
-
109
- - Accessing essential private and public services and benefits;
110
- - Administration of justice and democratic processes;
111
- - Assessing or recognizing the emotional state of a person;
112
- - Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics;
113
- - Education and vocational training;
114
- - Employment and workers management;
115
- - Exploitation of the vulnerabilities of persons resulting in harmful behavior;
116
- - General purpose social scoring;
117
- - Law enforcement;
118
- - Management and operation of critical infrastructure;
119
- - Migration, asylum and border control management;
120
- - Predictive policing;
121
- - Real-time remote biometric identification in public spaces;
122
- - Recommender systems of social media platforms;
123
- - Scraping of facial images (from the internet or otherwise); and/or
124
- - Subliminal manipulation
 
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
+ This repository provides scripts to run YOLOv8-Segmentation on Qualcomm® devices.
23
+ More details on model performance across various devices, can be found
24
+ [here](https://aihub.qualcomm.com/models/yolov8_seg).
25
+
26
+ **WARNING**: The model assets are not readily available for download due to licensing restrictions.
27
 
28
  ### Model Details
29
 
 
38
 
39
  | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
40
  |---|---|---|---|---|---|---|---|---|
41
+ | YOLOv8-Segmentation | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 21.454 ms | 4 - 66 MB | NPU | -- |
42
  | YOLOv8-Segmentation | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 17.023 ms | 4 - 117 MB | NPU | -- |
43
+ | YOLOv8-Segmentation | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 11.418 ms | 4 - 47 MB | NPU | -- |
44
  | YOLOv8-Segmentation | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 10.219 ms | 5 - 43 MB | NPU | -- |
45
+ | YOLOv8-Segmentation | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 8.092 ms | 4 - 24 MB | NPU | -- |
46
  | YOLOv8-Segmentation | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 4.457 ms | 5 - 41 MB | NPU | -- |
47
+ | YOLOv8-Segmentation | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 10.25 ms | 4 - 65 MB | NPU | -- |
48
  | YOLOv8-Segmentation | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 6.317 ms | 0 - 112 MB | NPU | -- |
49
+ | YOLOv8-Segmentation | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 21.454 ms | 4 - 66 MB | NPU | -- |
50
  | YOLOv8-Segmentation | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 17.023 ms | 4 - 117 MB | NPU | -- |
51
+ | YOLOv8-Segmentation | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | TFLITE | 8.165 ms | 4 - 27 MB | NPU | -- |
52
  | YOLOv8-Segmentation | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | QNN_DLC | 4.48 ms | 5 - 48 MB | NPU | -- |
53
+ | YOLOv8-Segmentation | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 12.708 ms | 4 - 34 MB | NPU | -- |
54
  | YOLOv8-Segmentation | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 8.576 ms | 0 - 34 MB | NPU | -- |
55
+ | YOLOv8-Segmentation | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | TFLITE | 8.165 ms | 4 - 30 MB | NPU | -- |
56
  | YOLOv8-Segmentation | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | QNN_DLC | 4.481 ms | 5 - 35 MB | NPU | -- |
57
+ | YOLOv8-Segmentation | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 10.25 ms | 4 - 65 MB | NPU | -- |
58
  | YOLOv8-Segmentation | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 6.317 ms | 0 - 112 MB | NPU | -- |
59
+ | YOLOv8-Segmentation | float | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | TFLITE | 8.147 ms | 4 - 27 MB | NPU | -- |
60
  | YOLOv8-Segmentation | float | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | QNN_DLC | 4.47 ms | 4 - 43 MB | NPU | -- |
61
+ | YOLOv8-Segmentation | float | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | ONNX | 6.813 ms | 0 - 75 MB | NPU | -- |
62
+ | YOLOv8-Segmentation | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 5.862 ms | 4 - 71 MB | NPU | -- |
63
  | YOLOv8-Segmentation | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 3.28 ms | 5 - 204 MB | NPU | -- |
64
+ | YOLOv8-Segmentation | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 4.791 ms | 15 - 204 MB | NPU | -- |
65
+ | YOLOv8-Segmentation | float | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | TFLITE | 5.542 ms | 3 - 56 MB | NPU | -- |
66
  | YOLOv8-Segmentation | float | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | QNN_DLC | 2.965 ms | 5 - 130 MB | NPU | -- |
67
+ | YOLOv8-Segmentation | float | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | ONNX | 4.338 ms | 5 - 135 MB | NPU | -- |
68
  | YOLOv8-Segmentation | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 5.029 ms | 5 - 5 MB | NPU | -- |
69
+ | YOLOv8-Segmentation | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 7.18 ms | 17 - 17 MB | NPU | -- |
70
+ | YOLOv8-Segmentation | w8a16 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 8.154 ms | 2 - 36 MB | NPU | -- |
71
+ | YOLOv8-Segmentation | w8a16 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 5.254 ms | 2 - 40 MB | NPU | -- |
72
+ | YOLOv8-Segmentation | w8a16 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 4.067 ms | 2 - 15 MB | NPU | -- |
73
+ | YOLOv8-Segmentation | w8a16 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 4.76 ms | 1 - 37 MB | NPU | -- |
74
+ | YOLOv8-Segmentation | w8a16 | RB3 Gen 2 (Proxy) | Qualcomm® QCS6490 (Proxy) | QNN_DLC | 15.523 ms | 2 - 39 MB | NPU | -- |
75
+ | YOLOv8-Segmentation | w8a16 | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 8.154 ms | 2 - 36 MB | NPU | -- |
76
+ | YOLOv8-Segmentation | w8a16 | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | QNN_DLC | 4.063 ms | 2 - 14 MB | NPU | -- |
77
+ | YOLOv8-Segmentation | w8a16 | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 5.395 ms | 2 - 40 MB | NPU | -- |
78
+ | YOLOv8-Segmentation | w8a16 | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | QNN_DLC | 4.071 ms | 2 - 16 MB | NPU | -- |
79
+ | YOLOv8-Segmentation | w8a16 | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 4.76 ms | 1 - 37 MB | NPU | -- |
80
+ | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | QNN_DLC | 4.072 ms | 2 - 16 MB | NPU | -- |
81
+ | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 Mobile | ONNX | 7.953 ms | 2 - 31 MB | NPU | -- |
82
+ | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 2.693 ms | 2 - 47 MB | NPU | -- |
83
+ | YOLOv8-Segmentation | w8a16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 5.201 ms | 9 - 76 MB | NPU | -- |
84
+ | YOLOv8-Segmentation | w8a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | QNN_DLC | 1.917 ms | 2 - 44 MB | NPU | -- |
85
+ | YOLOv8-Segmentation | w8a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | ONNX | 4.761 ms | 10 - 106 MB | NPU | -- |
86
+ | YOLOv8-Segmentation | w8a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 4.918 ms | 0 - 0 MB | NPU | -- |
87
+ | YOLOv8-Segmentation | w8a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 8.742 ms | 14 - 14 MB | NPU | -- |
88
+
89
+
90
+
91
+
92
+ ## Installation
93
+
94
+
95
+ Install the package via pip:
96
+ ```bash
97
+ pip install "qai-hub-models[yolov8-seg]"
98
+ ```
99
+
100
+
101
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
102
+
103
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
104
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
105
+
106
+ With this API token, you can configure your client to run models on the cloud
107
+ hosted devices.
108
+ ```bash
109
+ qai-hub configure --api_token API_TOKEN
110
+ ```
111
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
112
+
113
+
114
+
115
+ ## Demo off target
116
+
117
+ The package contains a simple end-to-end demo that downloads pre-trained
118
+ weights and runs this model on a sample input.
119
+
120
+ ```bash
121
+ python -m qai_hub_models.models.yolov8_seg.demo
122
+ ```
123
+
124
+ The above demo runs a reference implementation of pre-processing, model
125
+ inference, and post processing.
126
+
127
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
128
+ environment, please add the following to your cell (instead of the above).
129
+ ```
130
+ %run -m qai_hub_models.models.yolov8_seg.demo
131
+ ```
132
+
133
+
134
+ ### Run model on a cloud-hosted device
135
+
136
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
137
+ device. This script does the following:
138
+ * Performance check on-device on a cloud-hosted device
139
+ * Downloads compiled assets that can be deployed on-device for Android.
140
+ * Accuracy check between PyTorch and on-device outputs.
141
+
142
+ ```bash
143
+ python -m qai_hub_models.models.yolov8_seg.export
144
+ ```
145
+
146
+
147
+
148
+ ## How does this work?
149
+
150
+ This [export script](https://aihub.qualcomm.com/models/yolov8_seg/qai_hub_models/models/YOLOv8-Segmentation/export.py)
151
+ leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
152
+ on-device. Lets go through each step below in detail:
153
+
154
+ Step 1: **Compile model for on-device deployment**
155
+
156
+ To compile a PyTorch model for on-device deployment, we first trace the model
157
+ in memory using the `jit.trace` and then call the `submit_compile_job` API.
158
+
159
+ ```python
160
+ import torch
161
 
162
+ import qai_hub as hub
163
+ from qai_hub_models.models.yolov8_seg import Model
164
 
165
+ # Load the model
166
+ torch_model = Model.from_pretrained()
167
+
168
+ # Device
169
+ device = hub.Device("Samsung Galaxy S24")
170
+
171
+ # Trace model
172
+ input_shape = torch_model.get_input_spec()
173
+ sample_inputs = torch_model.sample_inputs()
174
+
175
+ pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
176
+
177
+ # Compile model on a specific device
178
+ compile_job = hub.submit_compile_job(
179
+ model=pt_model,
180
+ device=device,
181
+ input_specs=torch_model.get_input_spec(),
182
+ )
183
+
184
+ # Get target model to run on-device
185
+ target_model = compile_job.get_target_model()
186
+
187
+ ```
188
+
189
+
190
+ Step 2: **Performance profiling on cloud-hosted device**
191
+
192
+ After compiling models from step 1. Models can be profiled model on-device using the
193
+ `target_model`. Note that this scripts runs the model on a device automatically
194
+ provisioned in the cloud. Once the job is submitted, you can navigate to a
195
+ provided job URL to view a variety of on-device performance metrics.
196
+ ```python
197
+ profile_job = hub.submit_profile_job(
198
+ model=target_model,
199
+ device=device,
200
+ )
201
+
202
+ ```
203
+
204
+ Step 3: **Verify on-device accuracy**
205
+
206
+ To verify the accuracy of the model on-device, you can run on-device inference
207
+ on sample input data on the same cloud hosted device.
208
+ ```python
209
+ input_data = torch_model.sample_inputs()
210
+ inference_job = hub.submit_inference_job(
211
+ model=target_model,
212
+ device=device,
213
+ inputs=input_data,
214
+ )
215
+ on_device_output = inference_job.download_output_data()
216
+
217
+ ```
218
+ With the output of the model, you can compute like PSNR, relative errors or
219
+ spot check the output with expected output.
220
+
221
+ **Note**: This on-device profiling and inference requires access to Qualcomm®
222
+ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
223
+
224
+
225
+
226
+ ## Run demo on a cloud-hosted device
227
+
228
+ You can also run the demo on-device.
229
+
230
+ ```bash
231
+ python -m qai_hub_models.models.yolov8_seg.demo --eval-mode on-device
232
+ ```
233
+
234
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
235
+ environment, please add the following to your cell (instead of the above).
236
+ ```
237
+ %run -m qai_hub_models.models.yolov8_seg.demo -- --eval-mode on-device
238
+ ```
239
+
240
+
241
+ ## Deploying compiled model to Android
242
+
243
+
244
+ The models can be deployed using multiple runtimes:
245
+ - TensorFlow Lite (`.tflite` export): [This
246
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
247
+ guide to deploy the .tflite model in an Android application.
248
+
249
+
250
+ - QNN (`.so` export ): This [sample
251
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
252
+ provides instructions on how to use the `.so` shared library in an Android application.
253
+
254
+
255
+ ## View on Qualcomm® AI Hub
256
+ Get more details on YOLOv8-Segmentation's performance across various devices [here](https://aihub.qualcomm.com/models/yolov8_seg).
257
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
258
 
259
 
260
  ## License
 
271
 
272
 
273
  ## Community
274
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
275
  * For questions or feedback please [reach out to us](mailto:[email protected]).
276
 
277
+