qaihm-bot commited on
Commit
ecec3a6
·
verified ·
1 Parent(s): 5b37701

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +98 -18
README.md CHANGED
@@ -19,7 +19,7 @@ tags:
19
 
20
  ResNeXt101 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.
21
 
22
- This model is an implementation of ResNeXt101Quantized found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py).
23
  This repository provides scripts to run ResNeXt101Quantized on Qualcomm® devices.
24
  More details on model performance across various devices, can be found
25
  [here](https://aihub.qualcomm.com/models/resnext101_quantized).
@@ -34,26 +34,42 @@ More details on model performance across various devices, can be found
34
  - Number of parameters: 88.7M
35
  - Model size: 87.3 MB
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
 
39
 
40
- | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
41
- | ---|---|---|---|---|---|---|---|
42
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 2.842 ms | 0 - 2 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite)
43
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 3.096 ms | 0 - 34 MB | INT8 | NPU | [ResNeXt101Quantized.so](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.so)
44
-
45
-
46
 
47
  ## Installation
48
 
49
  This model can be installed as a Python package via pip.
50
 
51
  ```bash
52
- pip install "qai-hub-models[resnext101_quantized]"
53
  ```
54
 
55
 
56
-
57
  ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
58
 
59
  Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
@@ -98,18 +114,78 @@ device. This script does the following:
98
  ```bash
99
  python -m qai_hub_models.models.resnext101_quantized.export
100
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  ```
103
- Profile Job summary of ResNeXt101Quantized
104
- --------------------------------------------------
105
- Device: Snapdragon X Elite CRD (11)
106
- Estimated Inference Time: 3.08 ms
107
- Estimated Peak Memory Range: 0.20-0.20 MB
108
- Compute Units: NPU (146) | Total (146)
109
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  ```
 
 
112
 
 
 
113
 
114
 
115
 
@@ -146,15 +222,19 @@ provides instructions on how to use the `.so` shared library in an Android appl
146
  Get more details on ResNeXt101Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/resnext101_quantized).
147
  Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
148
 
 
149
  ## License
150
- - The license for the original implementation of ResNeXt101Quantized can be found
151
- [here](https://github.com/pytorch/vision/blob/main/LICENSE).
152
- - 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)
 
153
 
154
  ## References
155
  * [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431)
156
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
157
 
 
 
158
  ## Community
159
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
160
  * For questions or feedback please [reach out to us](mailto:[email protected]).
 
19
 
20
  ResNeXt101 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.
21
 
22
+ This model is an implementation of ResNeXt101Quantized found [here]({source_repo}).
23
  This repository provides scripts to run ResNeXt101Quantized on Qualcomm® devices.
24
  More details on model performance across various devices, can be found
25
  [here](https://aihub.qualcomm.com/models/resnext101_quantized).
 
34
  - Number of parameters: 88.7M
35
  - Model size: 87.3 MB
36
 
37
+ | Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
38
+ |---|---|---|---|---|---|---|---|---|
39
+ | ResNeXt101Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 2.869 ms | 0 - 2 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
40
+ | ResNeXt101Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 3.112 ms | 0 - 30 MB | INT8 | NPU | [ResNeXt101Quantized.so](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.so) |
41
+ | ResNeXt101Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 4.022 ms | 0 - 98 MB | INT8 | NPU | [ResNeXt101Quantized.onnx](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.onnx) |
42
+ | ResNeXt101Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 2.051 ms | 0 - 274 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
43
+ | ResNeXt101Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 2.536 ms | 0 - 92 MB | INT8 | NPU | [ResNeXt101Quantized.so](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.so) |
44
+ | ResNeXt101Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 2.786 ms | 0 - 336 MB | INT8 | NPU | [ResNeXt101Quantized.onnx](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.onnx) |
45
+ | ResNeXt101Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 9.831 ms | 0 - 200 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
46
+ | ResNeXt101Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 14.602 ms | 0 - 8 MB | INT8 | NPU | Use Export Script |
47
+ | ResNeXt101Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 134.358 ms | 0 - 521 MB | INT8 | GPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
48
+ | ResNeXt101Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 2.886 ms | 0 - 2 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
49
+ | ResNeXt101Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 2.933 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
50
+ | ResNeXt101Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 2.845 ms | 0 - 2 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
51
+ | ResNeXt101Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 3.01 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
52
+ | ResNeXt101Quantized | SA8775 (Proxy) | SA8775P Proxy | TFLITE | 2.788 ms | 0 - 3 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
53
+ | ResNeXt101Quantized | SA8775 (Proxy) | SA8775P Proxy | QNN | 2.931 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
54
+ | ResNeXt101Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 3.456 ms | 0 - 98 MB | INT8 | NPU | Use Export Script |
55
+ | ResNeXt101Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 2.085 ms | 0 - 190 MB | INT8 | NPU | [ResNeXt101Quantized.tflite](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.tflite) |
56
+ | ResNeXt101Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 2.04 ms | 0 - 91 MB | INT8 | NPU | Use Export Script |
57
+ | ResNeXt101Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 2.941 ms | 0 - 227 MB | INT8 | NPU | [ResNeXt101Quantized.onnx](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.onnx) |
58
+ | ResNeXt101Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 3.076 ms | 0 - 0 MB | INT8 | NPU | Use Export Script |
59
+ | ResNeXt101Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 4.219 ms | 90 - 90 MB | INT8 | NPU | [ResNeXt101Quantized.onnx](https://huggingface.co/qualcomm/ResNeXt101Quantized/blob/main/ResNeXt101Quantized.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.resnext101_quantized.export
116
  ```
117
+ ```
118
+ Profiling Results
119
+ ------------------------------------------------------------
120
+ ResNeXt101Quantized
121
+ Device : Samsung Galaxy S23 (13)
122
+ Runtime : TFLITE
123
+ Estimated inference time (ms) : 2.9
124
+ Estimated peak memory usage (MB): [0, 2]
125
+ Total # Ops : 150
126
+ Compute Unit(s) : NPU (150 ops)
127
+ ```
128
+
129
+
130
+ ## How does this work?
131
+
132
+ This [export script](https://aihub.qualcomm.com/models/resnext101_quantized/qai_hub_models/models/ResNeXt101Quantized/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.resnext101_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 ResNeXt101Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/resnext101_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 ResNeXt101Quantized 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
  * [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431)
234
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.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:[email protected]).