qaihm-bot commited on
Commit
6f92b10
·
verified ·
1 Parent(s): ababc55

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +111 -22
README.md CHANGED
@@ -34,24 +34,38 @@ More details on model performance across various devices, can be found
34
 
35
  | Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
36
  |---|---|---|---|---|---|---|---|---|
37
- | Facial-Landmark-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.175 ms | 0 - 34 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
38
- | Facial-Landmark-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 0.36 ms | 0 - 20 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
39
- | Facial-Landmark-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.143 ms | 0 - 28 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
40
- | Facial-Landmark-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 0.287 ms | 0 - 32 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
41
- | Facial-Landmark-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.13 ms | 0 - 21 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
42
- | Facial-Landmark-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.281 ms | 0 - 18 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
43
- | Facial-Landmark-Detection-Quantized | SA7255P ADP | SA7255P | TFLITE | 1.095 ms | 0 - 9 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
44
- | Facial-Landmark-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.177 ms | 0 - 35 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
45
- | Facial-Landmark-Detection-Quantized | SA8295P ADP | SA8295P | TFLITE | 0.463 ms | 0 - 16 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
46
- | Facial-Landmark-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.181 ms | 0 - 35 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
47
- | Facial-Landmark-Detection-Quantized | SA8775P ADP | SA8775P | TFLITE | 0.379 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
48
- | Facial-Landmark-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 0.514 ms | 0 - 20 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
49
- | Facial-Landmark-Detection-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 1.911 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
50
- | Facial-Landmark-Detection-Quantized | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 1.095 ms | 0 - 9 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
51
- | Facial-Landmark-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.174 ms | 0 - 36 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
52
- | Facial-Landmark-Detection-Quantized | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 0.379 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
53
- | Facial-Landmark-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.221 ms | 0 - 27 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
54
- | Facial-Landmark-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.295 ms | 4 - 4 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
 
57
 
@@ -116,12 +130,88 @@ Facial-Landmark-Detection-Quantized
116
  Device : Samsung Galaxy S23 (13)
117
  Runtime : TFLITE
118
  Estimated inference time (ms) : 0.2
119
- Estimated peak memory usage (MB): [0, 34]
120
- Total # Ops : 42
121
- Compute Unit(s) : NPU (42 ops)
122
  ```
123
 
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
 
127
  ## Run demo on a cloud-hosted device
@@ -166,7 +256,6 @@ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
166
 
167
 
168
  ## References
169
- * [None](None)
170
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
171
 
172
 
 
34
 
35
  | Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
36
  |---|---|---|---|---|---|---|---|---|
37
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.169 ms | 0 - 37 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
38
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 0.17 ms | 0 - 2 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.so](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.so) |
39
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 0.474 ms | 0 - 29 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
40
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.137 ms | 0 - 27 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
41
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.125 ms | 0 - 20 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.so](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.so) |
42
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 0.347 ms | 0 - 35 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
43
+ | Facial-Landmark-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.151 ms | 0 - 13 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
44
+ | Facial-Landmark-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.128 ms | 0 - 16 MB | INT8 | NPU | Use Export Script |
45
+ | Facial-Landmark-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.328 ms | 0 - 20 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
46
+ | Facial-Landmark-Detection-Quantized | SA7255P ADP | SA7255P | TFLITE | 1.121 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
47
+ | Facial-Landmark-Detection-Quantized | SA7255P ADP | SA7255P | QNN | 1.08 ms | 0 - 9 MB | INT8 | NPU | Use Export Script |
48
+ | Facial-Landmark-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.174 ms | 0 - 37 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
49
+ | Facial-Landmark-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.17 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
50
+ | Facial-Landmark-Detection-Quantized | SA8295P ADP | SA8295P | TFLITE | 0.468 ms | 0 - 16 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
51
+ | Facial-Landmark-Detection-Quantized | SA8295P ADP | SA8295P | QNN | 0.442 ms | 0 - 18 MB | INT8 | NPU | Use Export Script |
52
+ | Facial-Landmark-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.17 ms | 0 - 37 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
53
+ | Facial-Landmark-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.169 ms | 0 - 3 MB | INT8 | NPU | Use Export Script |
54
+ | Facial-Landmark-Detection-Quantized | SA8775P ADP | SA8775P | TFLITE | 0.371 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
55
+ | Facial-Landmark-Detection-Quantized | SA8775P ADP | SA8775P | QNN | 0.35 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
56
+ | Facial-Landmark-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 0.525 ms | 0 - 24 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
57
+ | Facial-Landmark-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 0.589 ms | 0 - 15 MB | INT8 | NPU | Use Export Script |
58
+ | Facial-Landmark-Detection-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 1.627 ms | 0 - 3 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
59
+ | Facial-Landmark-Detection-Quantized | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 1.121 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
60
+ | Facial-Landmark-Detection-Quantized | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 1.08 ms | 0 - 9 MB | INT8 | NPU | Use Export Script |
61
+ | Facial-Landmark-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.172 ms | 0 - 37 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
62
+ | Facial-Landmark-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.166 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
63
+ | Facial-Landmark-Detection-Quantized | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 0.371 ms | 0 - 11 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
64
+ | Facial-Landmark-Detection-Quantized | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 0.35 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
65
+ | Facial-Landmark-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.282 ms | 0 - 29 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.tflite) |
66
+ | Facial-Landmark-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.276 ms | 0 - 27 MB | INT8 | NPU | Use Export Script |
67
+ | Facial-Landmark-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.229 ms | 1 - 1 MB | INT8 | NPU | Use Export Script |
68
+ | Facial-Landmark-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.445 ms | 4 - 4 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.onnx) |
69
 
70
 
71
 
 
130
  Device : Samsung Galaxy S23 (13)
131
  Runtime : TFLITE
132
  Estimated inference time (ms) : 0.2
133
+ Estimated peak memory usage (MB): [0, 37]
134
+ Total # Ops : 39
135
+ Compute Unit(s) : NPU (39 ops)
136
  ```
137
 
138
 
139
+ ## How does this work?
140
+
141
+ This [export script](https://aihub.qualcomm.com/models/facemap_3dmm_quantized/qai_hub_models/models/Facial-Landmark-Detection-Quantized/export.py)
142
+ leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
143
+ on-device. Lets go through each step below in detail:
144
+
145
+ Step 1: **Compile model for on-device deployment**
146
+
147
+ To compile a PyTorch model for on-device deployment, we first trace the model
148
+ in memory using the `jit.trace` and then call the `submit_compile_job` API.
149
+
150
+ ```python
151
+ import torch
152
+
153
+ import qai_hub as hub
154
+ from qai_hub_models.models.facemap_3dmm_quantized import Model
155
+
156
+ # Load the model
157
+ torch_model = Model.from_pretrained()
158
+
159
+ # Device
160
+ device = hub.Device("Samsung Galaxy S24")
161
+
162
+ # Trace model
163
+ input_shape = torch_model.get_input_spec()
164
+ sample_inputs = torch_model.sample_inputs()
165
+
166
+ pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
167
+
168
+ # Compile model on a specific device
169
+ compile_job = hub.submit_compile_job(
170
+ model=pt_model,
171
+ device=device,
172
+ input_specs=torch_model.get_input_spec(),
173
+ )
174
+
175
+ # Get target model to run on-device
176
+ target_model = compile_job.get_target_model()
177
+
178
+ ```
179
+
180
+
181
+ Step 2: **Performance profiling on cloud-hosted device**
182
+
183
+ After compiling models from step 1. Models can be profiled model on-device using the
184
+ `target_model`. Note that this scripts runs the model on a device automatically
185
+ provisioned in the cloud. Once the job is submitted, you can navigate to a
186
+ provided job URL to view a variety of on-device performance metrics.
187
+ ```python
188
+ profile_job = hub.submit_profile_job(
189
+ model=target_model,
190
+ device=device,
191
+ )
192
+
193
+ ```
194
+
195
+ Step 3: **Verify on-device accuracy**
196
+
197
+ To verify the accuracy of the model on-device, you can run on-device inference
198
+ on sample input data on the same cloud hosted device.
199
+ ```python
200
+ input_data = torch_model.sample_inputs()
201
+ inference_job = hub.submit_inference_job(
202
+ model=target_model,
203
+ device=device,
204
+ inputs=input_data,
205
+ )
206
+ on_device_output = inference_job.download_output_data()
207
+
208
+ ```
209
+ With the output of the model, you can compute like PSNR, relative errors or
210
+ spot check the output with expected output.
211
+
212
+ **Note**: This on-device profiling and inference requires access to Qualcomm®
213
+ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
214
+
215
 
216
 
217
  ## Run demo on a cloud-hosted device
 
256
 
257
 
258
  ## References
 
259
  * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
260
 
261