Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -19,7 +19,7 @@ tags:
|
|
19 |
|
20 |
ResNet101 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 ResNet101Quantized found [here](
|
23 |
This repository provides scripts to run ResNet101Quantized on Qualcomm® devices.
|
24 |
More details on model performance across various devices, can be found
|
25 |
[here](https://aihub.qualcomm.com/models/resnet101_quantized).
|
@@ -34,26 +34,43 @@ More details on model performance across various devices, can be found
|
|
34 |
- Number of parameters: 44.5M
|
35 |
- Model size: 43.9 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 | 1.153 ms | 0 - 2 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite)
|
43 |
-
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 1.373 ms | 0 - 45 MB | INT8 | NPU | [ResNet101Quantized.so](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.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
|
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 +115,78 @@ device. This script does the following:
|
|
98 |
```bash
|
99 |
python -m qai_hub_models.models.resnet101_quantized.export
|
100 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
```
|
103 |
-
Profile Job summary of ResNet101Quantized
|
104 |
-
--------------------------------------------------
|
105 |
-
Device: Snapdragon X Elite CRD (11)
|
106 |
-
Estimated Inference Time: 1.31 ms
|
107 |
-
Estimated Peak Memory Range: 0.33-0.33 MB
|
108 |
-
Compute Units: NPU (146) | Total (146)
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
```
|
|
|
|
|
112 |
|
|
|
|
|
113 |
|
114 |
|
115 |
|
@@ -146,15 +223,19 @@ provides instructions on how to use the `.so` shared library in an Android appl
|
|
146 |
Get more details on ResNet101Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/resnet101_quantized).
|
147 |
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
148 |
|
|
|
149 |
## License
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
153 |
|
154 |
## References
|
155 |
* [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
|
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:ai-hub-support@qti.qualcomm.com).
|
|
|
19 |
|
20 |
ResNet101 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 ResNet101Quantized found [here]({source_repo}).
|
23 |
This repository provides scripts to run ResNet101Quantized on Qualcomm® devices.
|
24 |
More details on model performance across various devices, can be found
|
25 |
[here](https://aihub.qualcomm.com/models/resnet101_quantized).
|
|
|
34 |
- Number of parameters: 44.5M
|
35 |
- Model size: 43.9 MB
|
36 |
|
37 |
+
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
38 |
+
|---|---|---|---|---|---|---|---|---|
|
39 |
+
| ResNet101Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 1.159 ms | 0 - 52 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
40 |
+
| ResNet101Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 1.382 ms | 0 - 10 MB | INT8 | NPU | [ResNet101Quantized.so](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.so) |
|
41 |
+
| ResNet101Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 2.239 ms | 0 - 50 MB | INT8 | NPU | [ResNet101Quantized.onnx](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.onnx) |
|
42 |
+
| ResNet101Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.867 ms | 0 - 97 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
43 |
+
| ResNet101Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 1.043 ms | 0 - 21 MB | INT8 | NPU | [ResNet101Quantized.so](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.so) |
|
44 |
+
| ResNet101Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 1.597 ms | 0 - 146 MB | INT8 | NPU | [ResNet101Quantized.onnx](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.onnx) |
|
45 |
+
| ResNet101Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 4.486 ms | 0 - 35 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
46 |
+
| ResNet101Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 6.377 ms | 0 - 8 MB | INT8 | NPU | Use Export Script |
|
47 |
+
| ResNet101Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 17.354 ms | 0 - 2 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
48 |
+
| ResNet101Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 1.159 ms | 0 - 1 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
49 |
+
| ResNet101Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 1.324 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
|
50 |
+
| ResNet101Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 1.157 ms | 0 - 27 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
51 |
+
| ResNet101Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 1.324 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
|
52 |
+
| ResNet101Quantized | SA8775 (Proxy) | SA8775P Proxy | TFLITE | 1.162 ms | 0 - 371 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
53 |
+
| ResNet101Quantized | SA8775 (Proxy) | SA8775P Proxy | QNN | 1.325 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
|
54 |
+
| ResNet101Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 1.367 ms | 0 - 99 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
55 |
+
| ResNet101Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 1.592 ms | 0 - 25 MB | INT8 | NPU | Use Export Script |
|
56 |
+
| ResNet101Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.832 ms | 0 - 30 MB | INT8 | NPU | [ResNet101Quantized.tflite](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.tflite) |
|
57 |
+
| ResNet101Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 1.004 ms | 0 - 22 MB | INT8 | NPU | Use Export Script |
|
58 |
+
| ResNet101Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 1.585 ms | 0 - 60 MB | INT8 | NPU | [ResNet101Quantized.onnx](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.onnx) |
|
59 |
+
| ResNet101Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 1.327 ms | 0 - 0 MB | INT8 | NPU | Use Export Script |
|
60 |
+
| ResNet101Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 2.35 ms | 46 - 46 MB | INT8 | NPU | [ResNet101Quantized.onnx](https://huggingface.co/qualcomm/ResNet101Quantized/blob/main/ResNet101Quantized.onnx) |
|
61 |
|
62 |
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
## Installation
|
66 |
|
67 |
This model can be installed as a Python package via pip.
|
68 |
|
69 |
```bash
|
70 |
+
pip install qai-hub-models
|
71 |
```
|
72 |
|
73 |
|
|
|
74 |
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
75 |
|
76 |
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
|
|
115 |
```bash
|
116 |
python -m qai_hub_models.models.resnet101_quantized.export
|
117 |
```
|
118 |
+
```
|
119 |
+
Profiling Results
|
120 |
+
------------------------------------------------------------
|
121 |
+
ResNet101Quantized
|
122 |
+
Device : Samsung Galaxy S23 (13)
|
123 |
+
Runtime : TFLITE
|
124 |
+
Estimated inference time (ms) : 1.2
|
125 |
+
Estimated peak memory usage (MB): [0, 52]
|
126 |
+
Total # Ops : 150
|
127 |
+
Compute Unit(s) : NPU (150 ops)
|
128 |
+
```
|
129 |
+
|
130 |
+
|
131 |
+
## How does this work?
|
132 |
+
|
133 |
+
This [export script](https://aihub.qualcomm.com/models/resnet101_quantized/qai_hub_models/models/ResNet101Quantized/export.py)
|
134 |
+
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
135 |
+
on-device. Lets go through each step below in detail:
|
136 |
+
|
137 |
+
Step 1: **Compile model for on-device deployment**
|
138 |
+
|
139 |
+
To compile a PyTorch model for on-device deployment, we first trace the model
|
140 |
+
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
141 |
+
|
142 |
+
```python
|
143 |
+
import torch
|
144 |
+
|
145 |
+
import qai_hub as hub
|
146 |
+
from qai_hub_models.models.resnet101_quantized import
|
147 |
+
|
148 |
+
# Load the model
|
149 |
|
150 |
+
# Device
|
151 |
+
device = hub.Device("Samsung Galaxy S23")
|
152 |
+
|
153 |
+
|
154 |
+
```
|
155 |
+
|
156 |
+
|
157 |
+
Step 2: **Performance profiling on cloud-hosted device**
|
158 |
+
|
159 |
+
After compiling models from step 1. Models can be profiled model on-device using the
|
160 |
+
`target_model`. Note that this scripts runs the model on a device automatically
|
161 |
+
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
162 |
+
provided job URL to view a variety of on-device performance metrics.
|
163 |
+
```python
|
164 |
+
profile_job = hub.submit_profile_job(
|
165 |
+
model=target_model,
|
166 |
+
device=device,
|
167 |
+
)
|
168 |
+
|
169 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
Step 3: **Verify on-device accuracy**
|
172 |
+
|
173 |
+
To verify the accuracy of the model on-device, you can run on-device inference
|
174 |
+
on sample input data on the same cloud hosted device.
|
175 |
+
```python
|
176 |
+
input_data = torch_model.sample_inputs()
|
177 |
+
inference_job = hub.submit_inference_job(
|
178 |
+
model=target_model,
|
179 |
+
device=device,
|
180 |
+
inputs=input_data,
|
181 |
+
)
|
182 |
+
on_device_output = inference_job.download_output_data()
|
183 |
|
184 |
```
|
185 |
+
With the output of the model, you can compute like PSNR, relative errors or
|
186 |
+
spot check the output with expected output.
|
187 |
|
188 |
+
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
189 |
+
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
190 |
|
191 |
|
192 |
|
|
|
223 |
Get more details on ResNet101Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/resnet101_quantized).
|
224 |
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
225 |
|
226 |
+
|
227 |
## License
|
228 |
+
* The license for the original implementation of ResNet101Quantized can be found [here](https://github.com/pytorch/vision/blob/main/LICENSE).
|
229 |
+
* 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)
|
230 |
+
|
231 |
+
|
232 |
|
233 |
## References
|
234 |
* [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
|
235 |
* [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
|
236 |
|
237 |
+
|
238 |
+
|
239 |
## Community
|
240 |
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
|
241 |
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
|