qaihm-bot commited on
Commit
7d99418
·
verified ·
1 Parent(s): ac89d49

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

README.md CHANGED
@@ -11,280 +11,131 @@ pipeline_tag: image-classification
11
 
12
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/web-assets/model_demo.png)
13
 
14
- # ResNet50: Optimized for Mobile Deployment
15
- ## Imagenet classifier and general purpose backbone
16
-
17
 
18
  ResNet50 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.
19
 
20
- This model is an implementation of ResNet50 found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py).
21
-
22
-
23
- This repository provides scripts to run ResNet50 on Qualcomm® devices.
24
- More details on model performance across various devices, can be found
25
- [here](https://aihub.qualcomm.com/models/resnet50).
26
-
27
-
28
-
29
- ### Model Details
30
-
31
- - **Model Type:** Model_use_case.image_classification
32
- - **Model Stats:**
33
- - Model checkpoint: Imagenet
34
- - Input resolution: 224x224
35
- - Number of parameters: 25.5M
36
- - Model size (float): 97.4 MB
37
- - Model size (w8a8): 25.1 MB
38
-
39
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
40
- |---|---|---|---|---|---|---|---|---|
41
- | ResNet50 | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 10.599 ms | 0 - 166 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
42
- | ResNet50 | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 10.654 ms | 1 - 136 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
43
- | ResNet50 | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 3.649 ms | 0 - 198 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
44
- | ResNet50 | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 3.65 ms | 1 - 160 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
45
- | ResNet50 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 2.169 ms | 0 - 3 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
46
- | ResNet50 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 2.201 ms | 1 - 3 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
47
- | ResNet50 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 2.294 ms | 0 - 58 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.onnx.zip) |
48
- | ResNet50 | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 14.156 ms | 0 - 166 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
49
- | ResNet50 | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 3.348 ms | 1 - 135 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
50
- | ResNet50 | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 10.599 ms | 0 - 166 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
51
- | ResNet50 | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 10.654 ms | 1 - 136 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
52
- | ResNet50 | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 3.598 ms | 0 - 160 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
53
- | ResNet50 | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 3.661 ms | 0 - 129 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
54
- | ResNet50 | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 14.156 ms | 0 - 166 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
55
- | ResNet50 | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 3.348 ms | 1 - 135 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
56
- | ResNet50 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 1.571 ms | 0 - 207 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
57
- | ResNet50 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 1.613 ms | 1 - 167 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
58
- | ResNet50 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 1.649 ms | 0 - 142 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.onnx.zip) |
59
- | ResNet50 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 1.282 ms | 0 - 166 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
60
- | ResNet50 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 1.281 ms | 1 - 140 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
61
- | ResNet50 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 1.375 ms | 0 - 111 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.onnx.zip) |
62
- | ResNet50 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 1.101 ms | 0 - 187 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.tflite) |
63
- | ResNet50 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 1.103 ms | 1 - 160 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
64
- | ResNet50 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 1.211 ms | 0 - 133 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.onnx.zip) |
65
- | ResNet50 | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 2.318 ms | 1 - 1 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.dlc) |
66
- | ResNet50 | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 2.103 ms | 49 - 49 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50.onnx.zip) |
67
- | ResNet50 | w8a8 | Dragonwing Q-6690 MTP | Qualcomm® QCM6690 | TFLITE | 6.011 ms | 0 - 147 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
68
- | ResNet50 | w8a8 | Dragonwing Q-6690 MTP | Qualcomm® QCM6690 | QNN_DLC | 6.625 ms | 0 - 145 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
69
- | ResNet50 | w8a8 | Dragonwing Q-6690 MTP | Qualcomm® QCM6690 | ONNX | 23.102 ms | 7 - 21 MB | CPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
70
- | ResNet50 | w8a8 | Dragonwing RB3 Gen 2 Vision Kit | Qualcomm® QCS6490 | TFLITE | 2.667 ms | 0 - 27 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
71
- | ResNet50 | w8a8 | Dragonwing RB3 Gen 2 Vision Kit | Qualcomm® QCS6490 | QNN_DLC | 2.996 ms | 2 - 4 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
72
- | ResNet50 | w8a8 | Dragonwing RB3 Gen 2 Vision Kit | Qualcomm® QCS6490 | ONNX | 32.221 ms | 9 - 29 MB | CPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
73
- | ResNet50 | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 1.694 ms | 0 - 134 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
74
- | ResNet50 | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 1.962 ms | 0 - 134 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
75
- | ResNet50 | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 1.075 ms | 0 - 176 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
76
- | ResNet50 | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 1.215 ms | 0 - 174 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
77
- | ResNet50 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 0.754 ms | 0 - 2 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
78
- | ResNet50 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 0.904 ms | 0 - 2 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
79
- | ResNet50 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 1.113 ms | 0 - 31 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
80
- | ResNet50 | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 0.942 ms | 0 - 134 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
81
- | ResNet50 | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 3.898 ms | 0 - 134 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
82
- | ResNet50 | w8a8 | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 1.694 ms | 0 - 134 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
83
- | ResNet50 | w8a8 | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 1.962 ms | 0 - 134 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
84
- | ResNet50 | w8a8 | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 1.264 ms | 0 - 140 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
85
- | ResNet50 | w8a8 | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 1.408 ms | 0 - 141 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
86
- | ResNet50 | w8a8 | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 0.942 ms | 0 - 134 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
87
- | ResNet50 | w8a8 | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 3.898 ms | 0 - 134 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
88
- | ResNet50 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 0.593 ms | 0 - 170 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
89
- | ResNet50 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 0.664 ms | 0 - 172 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
90
- | ResNet50 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 0.796 ms | 0 - 152 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
91
- | ResNet50 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 0.485 ms | 0 - 133 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
92
- | ResNet50 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 0.525 ms | 0 - 136 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
93
- | ResNet50 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 0.687 ms | 0 - 111 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
94
- | ResNet50 | w8a8 | Snapdragon 7 Gen 4 QRD | Snapdragon® 7 Gen 4 Mobile | TFLITE | 1.103 ms | 0 - 146 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
95
- | ResNet50 | w8a8 | Snapdragon 7 Gen 4 QRD | Snapdragon® 7 Gen 4 Mobile | QNN_DLC | 1.256 ms | 0 - 147 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
96
- | ResNet50 | w8a8 | Snapdragon 7 Gen 4 QRD | Snapdragon® 7 Gen 4 Mobile | ONNX | 21.756 ms | 6 - 22 MB | CPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
97
- | ResNet50 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 0.445 ms | 0 - 136 MB | NPU | [ResNet50.tflite](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.tflite) |
98
- | ResNet50 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 0.494 ms | 0 - 137 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
99
- | ResNet50 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 0.662 ms | 0 - 114 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
100
- | ResNet50 | w8a8 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 0.959 ms | 0 - 0 MB | NPU | [ResNet50.dlc](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.dlc) |
101
- | ResNet50 | w8a8 | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.959 ms | 25 - 25 MB | NPU | [ResNet50.onnx.zip](https://huggingface.co/qualcomm/ResNet50/blob/main/ResNet50_w8a8.onnx.zip) |
102
-
103
-
104
-
105
-
106
- ## Installation
107
-
108
-
109
- Install the package via pip:
110
- ```bash
111
- pip install qai-hub-models
112
- ```
113
-
114
-
115
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
116
-
117
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
118
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
119
-
120
- With this API token, you can configure your client to run models on the cloud
121
- hosted devices.
122
- ```bash
123
- qai-hub configure --api_token API_TOKEN
124
- ```
125
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
126
-
127
-
128
-
129
- ## Demo off target
130
-
131
- The package contains a simple end-to-end demo that downloads pre-trained
132
- weights and runs this model on a sample input.
133
-
134
- ```bash
135
- python -m qai_hub_models.models.resnet50.demo
136
- ```
137
-
138
- The above demo runs a reference implementation of pre-processing, model
139
- inference, and post processing.
140
-
141
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
142
- environment, please add the following to your cell (instead of the above).
143
- ```
144
- %run -m qai_hub_models.models.resnet50.demo
145
- ```
146
-
147
-
148
- ### Run model on a cloud-hosted device
149
-
150
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
151
- device. This script does the following:
152
- * Performance check on-device on a cloud-hosted device
153
- * Downloads compiled assets that can be deployed on-device for Android.
154
- * Accuracy check between PyTorch and on-device outputs.
155
-
156
- ```bash
157
- python -m qai_hub_models.models.resnet50.export
158
- ```
159
-
160
-
161
-
162
- ## How does this work?
163
-
164
- This [export script](https://aihub.qualcomm.com/models/resnet50/qai_hub_models/models/ResNet50/export.py)
165
- leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
166
- on-device. Lets go through each step below in detail:
167
-
168
- Step 1: **Compile model for on-device deployment**
169
-
170
- To compile a PyTorch model for on-device deployment, we first trace the model
171
- in memory using the `jit.trace` and then call the `submit_compile_job` API.
172
-
173
- ```python
174
- import torch
175
-
176
- import qai_hub as hub
177
- from qai_hub_models.models.resnet50 import Model
178
-
179
- # Load the model
180
- torch_model = Model.from_pretrained()
181
-
182
- # Device
183
- device = hub.Device("Samsung Galaxy S25")
184
-
185
- # Trace model
186
- input_shape = torch_model.get_input_spec()
187
- sample_inputs = torch_model.sample_inputs()
188
-
189
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
190
-
191
- # Compile model on a specific device
192
- compile_job = hub.submit_compile_job(
193
- model=pt_model,
194
- device=device,
195
- input_specs=torch_model.get_input_spec(),
196
- )
197
-
198
- # Get target model to run on-device
199
- target_model = compile_job.get_target_model()
200
-
201
- ```
202
-
203
-
204
- Step 2: **Performance profiling on cloud-hosted device**
205
-
206
- After compiling models from step 1. Models can be profiled model on-device using the
207
- `target_model`. Note that this scripts runs the model on a device automatically
208
- provisioned in the cloud. Once the job is submitted, you can navigate to a
209
- provided job URL to view a variety of on-device performance metrics.
210
- ```python
211
- profile_job = hub.submit_profile_job(
212
- model=target_model,
213
- device=device,
214
- )
215
-
216
- ```
217
-
218
- Step 3: **Verify on-device accuracy**
219
-
220
- To verify the accuracy of the model on-device, you can run on-device inference
221
- on sample input data on the same cloud hosted device.
222
- ```python
223
- input_data = torch_model.sample_inputs()
224
- inference_job = hub.submit_inference_job(
225
- model=target_model,
226
- device=device,
227
- inputs=input_data,
228
- )
229
- on_device_output = inference_job.download_output_data()
230
-
231
- ```
232
- With the output of the model, you can compute like PSNR, relative errors or
233
- spot check the output with expected output.
234
-
235
- **Note**: This on-device profiling and inference requires access to Qualcomm®
236
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
237
-
238
-
239
-
240
- ## Run demo on a cloud-hosted device
241
-
242
- You can also run the demo on-device.
243
-
244
- ```bash
245
- python -m qai_hub_models.models.resnet50.demo --eval-mode on-device
246
- ```
247
-
248
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
249
- environment, please add the following to your cell (instead of the above).
250
- ```
251
- %run -m qai_hub_models.models.resnet50.demo -- --eval-mode on-device
252
- ```
253
-
254
-
255
- ## Deploying compiled model to Android
256
-
257
-
258
- The models can be deployed using multiple runtimes:
259
- - TensorFlow Lite (`.tflite` export): [This
260
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
261
- guide to deploy the .tflite model in an Android application.
262
-
263
-
264
- - QNN (`.so` export ): This [sample
265
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
266
- provides instructions on how to use the `.so` shared library in an Android application.
267
-
268
-
269
- ## View on Qualcomm® AI Hub
270
- Get more details on ResNet50's performance across various devices [here](https://aihub.qualcomm.com/models/resnet50).
271
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
272
-
273
 
274
  ## License
275
  * The license for the original implementation of ResNet50 can be found
276
  [here](https://github.com/pytorch/vision/blob/main/LICENSE).
277
 
278
-
279
-
280
  ## References
281
  * [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
282
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
283
 
284
-
285
-
286
  ## Community
287
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
288
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
289
-
290
-
 
11
 
12
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/web-assets/model_demo.png)
13
 
14
+ # ResNet50: Optimized for Qualcomm Devices
 
 
15
 
16
  ResNet50 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.
17
 
18
+ This is based on the implementation of ResNet50 found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py).
19
+ This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/resnet50) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
20
+
21
+ Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) to run these models on a hosted Qualcomm® device.
22
+
23
+ ## Getting Started
24
+ There are two ways to deploy this model on your device:
25
+
26
+ ### Option 1: Download Pre-Exported Models
27
+
28
+ Below are pre-exported model assets ready for deployment.
29
+
30
+ | Runtime | Precision | Chipset | SDK Versions | Download |
31
+ |---|---|---|---|---|
32
+ | ONNX | float | Universal | QAIRT 2.37, ONNX Runtime 1.23.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/releases/v0.46.1/resnet50-onnx-float.zip)
33
+ | ONNX | w8a8 | Universal | QAIRT 2.37, ONNX Runtime 1.23.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/releases/v0.46.1/resnet50-onnx-w8a8.zip)
34
+ | QNN_DLC | float | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/releases/v0.46.1/resnet50-qnn_dlc-float.zip)
35
+ | QNN_DLC | w8a8 | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/releases/v0.46.1/resnet50-qnn_dlc-w8a8.zip)
36
+ | TFLITE | float | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/releases/v0.46.1/resnet50-tflite-float.zip)
37
+ | TFLITE | w8a8 | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/resnet50/releases/v0.46.1/resnet50-tflite-w8a8.zip)
38
+
39
+ For more device-specific assets and performance metrics, visit **[ResNet50 on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/resnet50)**.
40
+
41
+
42
+ ### Option 2: Export with Custom Configurations
43
+
44
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/resnet50) Python library to compile and export the model with your own:
45
+ - Custom weights (e.g., fine-tuned checkpoints)
46
+ - Custom input shapes
47
+ - Target device and runtime configurations
48
+
49
+ This option is ideal if you need to customize the model beyond the default configuration provided here.
50
+
51
+ See our repository for [ResNet50 on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/resnet50) for usage instructions.
52
+
53
+ ## Model Details
54
+
55
+ **Model Type:** Model_use_case.image_classification
56
+
57
+ **Model Stats:**
58
+ - Model checkpoint: Imagenet
59
+ - Input resolution: 224x224
60
+ - Number of parameters: 25.5M
61
+ - Model size (float): 97.4 MB
62
+ - Model size (w8a8): 25.1 MB
63
+
64
+ ## Performance Summary
65
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
66
+ |---|---|---|---|---|---|---
67
+ | ResNet50 | ONNX | float | Snapdragon® X Elite | 2.108 ms | 49 - 49 MB | NPU
68
+ | ResNet50 | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 1.724 ms | 0 - 140 MB | NPU
69
+ | ResNet50 | ONNX | float | Qualcomm® QCS8550 (Proxy) | 2.281 ms | 0 - 61 MB | NPU
70
+ | ResNet50 | ONNX | float | Qualcomm® QCS9075 | 3.284 ms | 1 - 4 MB | NPU
71
+ | ResNet50 | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 1.387 ms | 0 - 111 MB | NPU
72
+ | ResNet50 | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 1.212 ms | 0 - 134 MB | NPU
73
+ | ResNet50 | ONNX | w8a8 | Snapdragon® X Elite | 0.962 ms | 25 - 25 MB | NPU
74
+ | ResNet50 | ONNX | w8a8 | Snapdragon® 8 Gen 3 Mobile | 0.864 ms | 0 - 147 MB | NPU
75
+ | ResNet50 | ONNX | w8a8 | Qualcomm® QCS6490 | 32.258 ms | 9 - 31 MB | CPU
76
+ | ResNet50 | ONNX | w8a8 | Qualcomm® QCS8550 (Proxy) | 1.118 ms | 0 - 173 MB | NPU
77
+ | ResNet50 | ONNX | w8a8 | Qualcomm® QCS9075 | 1.205 ms | 0 - 3 MB | NPU
78
+ | ResNet50 | ONNX | w8a8 | Qualcomm® QCM6690 | 22.973 ms | 1 - 11 MB | CPU
79
+ | ResNet50 | ONNX | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 0.716 ms | 0 - 110 MB | NPU
80
+ | ResNet50 | ONNX | w8a8 | Snapdragon® 7 Gen 4 Mobile | 17.351 ms | 6 - 13 MB | CPU
81
+ | ResNet50 | ONNX | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.663 ms | 0 - 114 MB | NPU
82
+ | ResNet50 | QNN_DLC | float | Snapdragon® X Elite | 2.379 ms | 1 - 1 MB | NPU
83
+ | ResNet50 | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 1.638 ms | 0 - 79 MB | NPU
84
+ | ResNet50 | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 10.695 ms | 1 - 47 MB | NPU
85
+ | ResNet50 | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 2.233 ms | 1 - 3 MB | NPU
86
+ | ResNet50 | QNN_DLC | float | Qualcomm® SA8775P | 3.386 ms | 1 - 48 MB | NPU
87
+ | ResNet50 | QNN_DLC | float | Qualcomm® QCS9075 | 3.311 ms | 1 - 3 MB | NPU
88
+ | ResNet50 | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 3.739 ms | 0 - 62 MB | NPU
89
+ | ResNet50 | QNN_DLC | float | Qualcomm® SA7255P | 10.695 ms | 1 - 47 MB | NPU
90
+ | ResNet50 | QNN_DLC | float | Qualcomm® SA8295P | 3.67 ms | 0 - 30 MB | NPU
91
+ | ResNet50 | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 1.325 ms | 0 - 48 MB | NPU
92
+ | ResNet50 | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 1.099 ms | 1 - 70 MB | NPU
93
+ | ResNet50 | QNN_DLC | w8a8 | Snapdragon® X Elite | 0.958 ms | 0 - 0 MB | NPU
94
+ | ResNet50 | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 0.687 ms | 0 - 70 MB | NPU
95
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 3.002 ms | 0 - 2 MB | NPU
96
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 1.975 ms | 0 - 41 MB | NPU
97
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 0.902 ms | 0 - 183 MB | NPU
98
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® SA8775P | 1.081 ms | 0 - 44 MB | NPU
99
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 0.962 ms | 0 - 2 MB | NPU
100
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 6.501 ms | 0 - 162 MB | NPU
101
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 1.199 ms | 0 - 74 MB | NPU
102
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® SA7255P | 1.975 ms | 0 - 41 MB | NPU
103
+ | ResNet50 | QNN_DLC | w8a8 | Qualcomm® SA8295P | 1.445 ms | 0 - 39 MB | NPU
104
+ | ResNet50 | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 0.532 ms | 0 - 38 MB | NPU
105
+ | ResNet50 | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 1.259 ms | 0 - 47 MB | NPU
106
+ | ResNet50 | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.494 ms | 0 - 41 MB | NPU
107
+ | ResNet50 | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 1.6 ms | 0 - 121 MB | NPU
108
+ | ResNet50 | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 10.624 ms | 0 - 82 MB | NPU
109
+ | ResNet50 | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 2.198 ms | 0 - 2 MB | NPU
110
+ | ResNet50 | TFLITE | float | Qualcomm® SA8775P | 14.365 ms | 0 - 82 MB | NPU
111
+ | ResNet50 | TFLITE | float | Qualcomm® QCS9075 | 3.343 ms | 0 - 52 MB | NPU
112
+ | ResNet50 | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 3.728 ms | 0 - 105 MB | NPU
113
+ | ResNet50 | TFLITE | float | Qualcomm® SA7255P | 10.624 ms | 0 - 82 MB | NPU
114
+ | ResNet50 | TFLITE | float | Qualcomm® SA8295P | 3.686 ms | 0 - 67 MB | NPU
115
+ | ResNet50 | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 1.302 ms | 0 - 78 MB | NPU
116
+ | ResNet50 | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 1.1 ms | 0 - 103 MB | NPU
117
+ | ResNet50 | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 0.576 ms | 0 - 72 MB | NPU
118
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® QCS6490 | 2.612 ms | 0 - 27 MB | NPU
119
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 1.733 ms | 0 - 40 MB | NPU
120
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 0.767 ms | 0 - 31 MB | NPU
121
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® SA8775P | 0.96 ms | 0 - 43 MB | NPU
122
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® QCS9075 | 0.813 ms | 0 - 27 MB | NPU
123
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® QCM6690 | 6.25 ms | 0 - 159 MB | NPU
124
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 1.059 ms | 0 - 74 MB | NPU
125
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® SA7255P | 1.733 ms | 0 - 40 MB | NPU
126
+ | ResNet50 | TFLITE | w8a8 | Qualcomm® SA8295P | 1.314 ms | 0 - 37 MB | NPU
127
+ | ResNet50 | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 0.491 ms | 0 - 38 MB | NPU
128
+ | ResNet50 | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 1.088 ms | 0 - 46 MB | NPU
129
+ | ResNet50 | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.445 ms | 0 - 41 MB | NPU
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  ## License
132
  * The license for the original implementation of ResNet50 can be found
133
  [here](https://github.com/pytorch/vision/blob/main/LICENSE).
134
 
 
 
135
  ## References
136
  * [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
137
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
138
 
 
 
139
  ## Community
140
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
141
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
 
ResNet50_float.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:17e3c4a0f8f12ab8d56a8157956de495af464284bd1cf8cda531ef596724a1bd
3
- size 102260596
 
 
 
 
ResNet50_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7b4a223b95aaf1cf0ead1dd74af440aa6dc5db8ffe2b0d83d0dc20c0286c704a
3
- size 95254689
 
 
 
 
ResNet50_float.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e352c0f14c2ca0e243259d6e73c9739a76e607831d81db8cf6b7a8f6c6df18b2
3
- size 102147696
 
 
 
 
ResNet50_w8a8.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:98008d3188153e67601d11445af10dfbf6a639e5e6caf2423d3786188098c6d2
3
- size 27246108
 
 
 
 
ResNet50_w8a8.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f269e497e2e0866356c21b614b9d799cb38938e9e5f6fdf253c8d5d43ad82031
3
- size 44974946
 
 
 
 
ResNet50_w8a8.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6f23b9eff40808c4dc7477d71e90d186d43227cc7985ce9a9bfcb42cf8e51cef
3
- size 26303288
 
 
 
 
tool-versions.yaml DELETED
@@ -1,4 +0,0 @@
1
- tool_versions:
2
- onnx:
3
- qairt: 2.37.1.250807093845_124904
4
- onnx_runtime: 1.23.0