qaihm-bot commited on
Commit
26532bf
·
verified ·
1 Parent(s): 9a90b26

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +99 -18
README.md CHANGED
@@ -18,7 +18,7 @@ tags:
18
 
19
  ShufflenetV2 is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.
20
 
21
- This model is an implementation of Shufflenet-v2Quantized found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py).
22
  This repository provides scripts to run Shufflenet-v2Quantized on Qualcomm® devices.
23
  More details on model performance across various devices, can be found
24
  [here](https://aihub.qualcomm.com/models/shufflenet_v2_quantized).
@@ -33,26 +33,43 @@ More details on model performance across various devices, can be found
33
  - Number of parameters: 1.37M
34
  - Model size: 4.42 MB
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
 
38
 
39
- | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
40
- | ---|---|---|---|---|---|---|---|
41
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 0.61 ms | 0 - 2 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite)
42
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 0.589 ms | 0 - 72 MB | INT8 | NPU | [Shufflenet-v2Quantized.so](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.so)
43
-
44
-
45
 
46
  ## Installation
47
 
48
  This model can be installed as a Python package via pip.
49
 
50
  ```bash
51
- pip install "qai-hub-models[shufflenet_v2_quantized]"
52
  ```
53
 
54
 
55
-
56
  ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
57
 
58
  Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
@@ -97,18 +114,78 @@ device. This script does the following:
97
  ```bash
98
  python -m qai_hub_models.models.shufflenet_v2_quantized.export
99
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  ```
102
- Profile Job summary of Shufflenet-v2Quantized
103
- --------------------------------------------------
104
- Device: Snapdragon X Elite CRD (11)
105
- Estimated Inference Time: 0.66 ms
106
- Estimated Peak Memory Range: 0.51-0.51 MB
107
- Compute Units: NPU (122) | Total (122)
108
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  ```
 
 
111
 
 
 
112
 
113
 
114
 
@@ -145,15 +222,19 @@ provides instructions on how to use the `.so` shared library in an Android appl
145
  Get more details on Shufflenet-v2Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/shufflenet_v2_quantized).
146
  Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
147
 
 
148
  ## License
149
- - The license for the original implementation of Shufflenet-v2Quantized can be found
150
- [here](https://github.com/pytorch/vision/blob/main/LICENSE).
151
- - The license for the compiled assets for on-device deployment can be found [here](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/Qualcomm+AI+Hub+Proprietary+License.pdf)
 
152
 
153
  ## References
154
  * [ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design](https://arxiv.org/abs/1807.11164)
155
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py)
156
 
 
 
157
  ## Community
158
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
159
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
18
 
19
  ShufflenetV2 is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.
20
 
21
+ This model is an implementation of Shufflenet-v2Quantized found [here]({source_repo}).
22
  This repository provides scripts to run Shufflenet-v2Quantized on Qualcomm® devices.
23
  More details on model performance across various devices, can be found
24
  [here](https://aihub.qualcomm.com/models/shufflenet_v2_quantized).
 
33
  - Number of parameters: 1.37M
34
  - Model size: 4.42 MB
35
 
36
+ | Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
37
+ |---|---|---|---|---|---|---|---|---|
38
+ | Shufflenet-v2Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.615 ms | 0 - 1 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
39
+ | Shufflenet-v2Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 0.601 ms | 0 - 32 MB | INT8 | NPU | [Shufflenet-v2Quantized.so](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.so) |
40
+ | Shufflenet-v2Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 8.856 ms | 2 - 6 MB | INT8 | NPU | [Shufflenet-v2Quantized.onnx](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.onnx) |
41
+ | Shufflenet-v2Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.423 ms | 0 - 28 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
42
+ | Shufflenet-v2Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.438 ms | 0 - 13 MB | INT8 | NPU | [Shufflenet-v2Quantized.so](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.so) |
43
+ | Shufflenet-v2Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 7.974 ms | 1 - 340 MB | INT8 | NPU | [Shufflenet-v2Quantized.onnx](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.onnx) |
44
+ | Shufflenet-v2Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 0.892 ms | 0 - 21 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
45
+ | Shufflenet-v2Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 1.21 ms | 0 - 8 MB | INT8 | NPU | Use Export Script |
46
+ | Shufflenet-v2Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 10.608 ms | 0 - 13 MB | FP32 | CPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
47
+ | Shufflenet-v2Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.614 ms | 0 - 7 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
48
+ | Shufflenet-v2Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.546 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
49
+ | Shufflenet-v2Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.611 ms | 0 - 2 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
50
+ | Shufflenet-v2Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.544 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
51
+ | Shufflenet-v2Quantized | SA8775 (Proxy) | SA8775P Proxy | TFLITE | 0.616 ms | 0 - 2 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
52
+ | Shufflenet-v2Quantized | SA8775 (Proxy) | SA8775P Proxy | QNN | 0.566 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
53
+ | Shufflenet-v2Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.645 ms | 0 - 29 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
54
+ | Shufflenet-v2Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.649 ms | 0 - 14 MB | INT8 | NPU | Use Export Script |
55
+ | Shufflenet-v2Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.466 ms | 0 - 20 MB | INT8 | NPU | [Shufflenet-v2Quantized.tflite](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.tflite) |
56
+ | Shufflenet-v2Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.382 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
57
+ | Shufflenet-v2Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 6.292 ms | 0 - 274 MB | INT8 | NPU | [Shufflenet-v2Quantized.onnx](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.onnx) |
58
+ | Shufflenet-v2Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.681 ms | 1 - 1 MB | INT8 | NPU | Use Export Script |
59
+ | Shufflenet-v2Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 10.337 ms | 6 - 6 MB | INT8 | NPU | [Shufflenet-v2Quantized.onnx](https://huggingface.co/qualcomm/Shufflenet-v2Quantized/blob/main/Shufflenet-v2Quantized.onnx) |
60
 
61
 
62
 
 
 
 
 
 
 
63
 
64
  ## Installation
65
 
66
  This model can be installed as a Python package via pip.
67
 
68
  ```bash
69
+ pip install qai-hub-models
70
  ```
71
 
72
 
 
73
  ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
74
 
75
  Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
 
114
  ```bash
115
  python -m qai_hub_models.models.shufflenet_v2_quantized.export
116
  ```
117
+ ```
118
+ Profiling Results
119
+ ------------------------------------------------------------
120
+ Shufflenet-v2Quantized
121
+ Device : Samsung Galaxy S23 (13)
122
+ Runtime : TFLITE
123
+ Estimated inference time (ms) : 0.6
124
+ Estimated peak memory usage (MB): [0, 1]
125
+ Total # Ops : 233
126
+ Compute Unit(s) : NPU (233 ops)
127
+ ```
128
+
129
+
130
+ ## How does this work?
131
+
132
+ This [export script](https://aihub.qualcomm.com/models/shufflenet_v2_quantized/qai_hub_models/models/Shufflenet-v2Quantized/export.py)
133
+ leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
134
+ on-device. Lets go through each step below in detail:
135
+
136
+ Step 1: **Compile model for on-device deployment**
137
+
138
+ To compile a PyTorch model for on-device deployment, we first trace the model
139
+ in memory using the `jit.trace` and then call the `submit_compile_job` API.
140
+
141
+ ```python
142
+ import torch
143
+
144
+ import qai_hub as hub
145
+ from qai_hub_models.models.shufflenet_v2_quantized import
146
+
147
+ # Load the model
148
 
149
+ # Device
150
+ device = hub.Device("Samsung Galaxy S23")
151
+
152
+
153
+ ```
154
+
155
+
156
+ Step 2: **Performance profiling on cloud-hosted device**
157
+
158
+ After compiling models from step 1. Models can be profiled model on-device using the
159
+ `target_model`. Note that this scripts runs the model on a device automatically
160
+ provisioned in the cloud. Once the job is submitted, you can navigate to a
161
+ provided job URL to view a variety of on-device performance metrics.
162
+ ```python
163
+ profile_job = hub.submit_profile_job(
164
+ model=target_model,
165
+ device=device,
166
+ )
167
+
168
  ```
 
 
 
 
 
 
169
 
170
+ Step 3: **Verify on-device accuracy**
171
+
172
+ To verify the accuracy of the model on-device, you can run on-device inference
173
+ on sample input data on the same cloud hosted device.
174
+ ```python
175
+ input_data = torch_model.sample_inputs()
176
+ inference_job = hub.submit_inference_job(
177
+ model=target_model,
178
+ device=device,
179
+ inputs=input_data,
180
+ )
181
+ on_device_output = inference_job.download_output_data()
182
 
183
  ```
184
+ With the output of the model, you can compute like PSNR, relative errors or
185
+ spot check the output with expected output.
186
 
187
+ **Note**: This on-device profiling and inference requires access to Qualcomm®
188
+ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
189
 
190
 
191
 
 
222
  Get more details on Shufflenet-v2Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/shufflenet_v2_quantized).
223
  Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
224
 
225
+
226
  ## License
227
+ * The license for the original implementation of Shufflenet-v2Quantized can be found [here](https://github.com/pytorch/vision/blob/main/LICENSE).
228
+ * The license for the compiled assets for on-device deployment can be found [here](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/Qualcomm+AI+Hub+Proprietary+License.pdf)
229
+
230
+
231
 
232
  ## References
233
  * [ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design](https://arxiv.org/abs/1807.11164)
234
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py)
235
 
236
+
237
+
238
  ## Community
239
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
240
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).