qaihm-bot commited on
Commit
4a15a7d
·
verified ·
1 Parent(s): 9247fc3

Upload README.md with huggingface_hub

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