Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -37,24 +37,38 @@ More details on model performance across various devices, can be found
|
|
37 |
|
38 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
39 |
|---|---|---|---|---|---|---|---|---|
|
40 |
-
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.
|
41 |
-
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 |
|
42 |
-
| Facial-Attribute-Detection-Quantized | Samsung Galaxy
|
43 |
-
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 |
|
44 |
-
| Facial-Attribute-Detection-Quantized |
|
45 |
-
| Facial-Attribute-Detection-Quantized |
|
46 |
-
| Facial-Attribute-Detection-Quantized |
|
47 |
-
| Facial-Attribute-Detection-Quantized |
|
48 |
-
| Facial-Attribute-Detection-Quantized |
|
49 |
-
| Facial-Attribute-Detection-Quantized |
|
50 |
-
| Facial-Attribute-Detection-Quantized |
|
51 |
-
| Facial-Attribute-Detection-Quantized |
|
52 |
-
| Facial-Attribute-Detection-Quantized |
|
53 |
-
| Facial-Attribute-Detection-Quantized |
|
54 |
-
| Facial-Attribute-Detection-Quantized |
|
55 |
-
| Facial-Attribute-Detection-Quantized |
|
56 |
-
| Facial-Attribute-Detection-Quantized |
|
57 |
-
| Facial-Attribute-Detection-Quantized |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
|
60 |
|
@@ -119,12 +133,88 @@ Facial-Attribute-Detection-Quantized
|
|
119 |
Device : Samsung Galaxy S23 (13)
|
120 |
Runtime : TFLITE
|
121 |
Estimated inference time (ms) : 0.4
|
122 |
-
Estimated peak memory usage (MB): [0,
|
123 |
-
Total # Ops :
|
124 |
-
Compute Unit(s) : NPU (
|
125 |
```
|
126 |
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
|
130 |
## Run demo on a cloud-hosted device
|
@@ -169,7 +259,6 @@ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
|
169 |
|
170 |
|
171 |
## References
|
172 |
-
* [None](None)
|
173 |
* [Source Model Implementation](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/face_attrib_net/model.py)
|
174 |
|
175 |
|
|
|
37 |
|
38 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
39 |
|---|---|---|---|---|---|---|---|---|
|
40 |
+
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.422 ms | 0 - 50 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
41 |
+
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 0.418 ms | 0 - 3 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.so](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.so) |
|
42 |
+
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 0.64 ms | 0 - 44 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.onnx) |
|
43 |
+
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.323 ms | 0 - 45 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
44 |
+
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.3 ms | 0 - 21 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.so](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.so) |
|
45 |
+
| Facial-Attribute-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 0.436 ms | 0 - 54 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.onnx) |
|
46 |
+
| Facial-Attribute-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.324 ms | 0 - 35 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
47 |
+
| Facial-Attribute-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.327 ms | 0 - 32 MB | INT8 | NPU | Use Export Script |
|
48 |
+
| Facial-Attribute-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.465 ms | 0 - 43 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.onnx) |
|
49 |
+
| Facial-Attribute-Detection-Quantized | SA7255P ADP | SA7255P | TFLITE | 4.933 ms | 0 - 31 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
50 |
+
| Facial-Attribute-Detection-Quantized | SA7255P ADP | SA7255P | QNN | 4.857 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
51 |
+
| Facial-Attribute-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.427 ms | 0 - 50 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
52 |
+
| Facial-Attribute-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.418 ms | 0 - 3 MB | INT8 | NPU | Use Export Script |
|
53 |
+
| Facial-Attribute-Detection-Quantized | SA8295P ADP | SA8295P | TFLITE | 0.929 ms | 0 - 34 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
54 |
+
| Facial-Attribute-Detection-Quantized | SA8295P ADP | SA8295P | QNN | 0.845 ms | 0 - 18 MB | INT8 | NPU | Use Export Script |
|
55 |
+
| Facial-Attribute-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.419 ms | 0 - 51 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
56 |
+
| Facial-Attribute-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.421 ms | 0 - 3 MB | INT8 | NPU | Use Export Script |
|
57 |
+
| Facial-Attribute-Detection-Quantized | SA8775P ADP | SA8775P | TFLITE | 0.767 ms | 0 - 31 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
58 |
+
| Facial-Attribute-Detection-Quantized | SA8775P ADP | SA8775P | QNN | 0.701 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
59 |
+
| Facial-Attribute-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 1.46 ms | 0 - 41 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
60 |
+
| Facial-Attribute-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 1.564 ms | 0 - 14 MB | INT8 | NPU | Use Export Script |
|
61 |
+
| Facial-Attribute-Detection-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 69.358 ms | 2 - 5 MB | FP32 | CPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
62 |
+
| Facial-Attribute-Detection-Quantized | QCS8275 (Proxy) | QCS8275 Proxy | TFLITE | 4.933 ms | 0 - 31 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
63 |
+
| Facial-Attribute-Detection-Quantized | QCS8275 (Proxy) | QCS8275 Proxy | QNN | 4.857 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
64 |
+
| Facial-Attribute-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.422 ms | 0 - 49 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
65 |
+
| Facial-Attribute-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.417 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
|
66 |
+
| Facial-Attribute-Detection-Quantized | QCS9075 (Proxy) | QCS9075 Proxy | TFLITE | 0.767 ms | 0 - 31 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
67 |
+
| Facial-Attribute-Detection-Quantized | QCS9075 (Proxy) | QCS9075 Proxy | QNN | 0.701 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
68 |
+
| Facial-Attribute-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.669 ms | 0 - 45 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
|
69 |
+
| Facial-Attribute-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.65 ms | 0 - 44 MB | INT8 | NPU | Use Export Script |
|
70 |
+
| Facial-Attribute-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.513 ms | 0 - 0 MB | INT8 | NPU | Use Export Script |
|
71 |
+
| Facial-Attribute-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.609 ms | 13 - 13 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.onnx) |
|
72 |
|
73 |
|
74 |
|
|
|
133 |
Device : Samsung Galaxy S23 (13)
|
134 |
Runtime : TFLITE
|
135 |
Estimated inference time (ms) : 0.4
|
136 |
+
Estimated peak memory usage (MB): [0, 50]
|
137 |
+
Total # Ops : 171
|
138 |
+
Compute Unit(s) : NPU (171 ops)
|
139 |
```
|
140 |
|
141 |
|
142 |
+
## How does this work?
|
143 |
+
|
144 |
+
This [export script](https://aihub.qualcomm.com/models/face_attrib_net_quantized/qai_hub_models/models/Facial-Attribute-Detection-Quantized/export.py)
|
145 |
+
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
146 |
+
on-device. Lets go through each step below in detail:
|
147 |
+
|
148 |
+
Step 1: **Compile model for on-device deployment**
|
149 |
+
|
150 |
+
To compile a PyTorch model for on-device deployment, we first trace the model
|
151 |
+
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
152 |
+
|
153 |
+
```python
|
154 |
+
import torch
|
155 |
+
|
156 |
+
import qai_hub as hub
|
157 |
+
from qai_hub_models.models.face_attrib_net_quantized import Model
|
158 |
+
|
159 |
+
# Load the model
|
160 |
+
torch_model = Model.from_pretrained()
|
161 |
+
|
162 |
+
# Device
|
163 |
+
device = hub.Device("Samsung Galaxy S24")
|
164 |
+
|
165 |
+
# Trace model
|
166 |
+
input_shape = torch_model.get_input_spec()
|
167 |
+
sample_inputs = torch_model.sample_inputs()
|
168 |
+
|
169 |
+
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
170 |
+
|
171 |
+
# Compile model on a specific device
|
172 |
+
compile_job = hub.submit_compile_job(
|
173 |
+
model=pt_model,
|
174 |
+
device=device,
|
175 |
+
input_specs=torch_model.get_input_spec(),
|
176 |
+
)
|
177 |
+
|
178 |
+
# Get target model to run on-device
|
179 |
+
target_model = compile_job.get_target_model()
|
180 |
+
|
181 |
+
```
|
182 |
+
|
183 |
+
|
184 |
+
Step 2: **Performance profiling on cloud-hosted device**
|
185 |
+
|
186 |
+
After compiling models from step 1. Models can be profiled model on-device using the
|
187 |
+
`target_model`. Note that this scripts runs the model on a device automatically
|
188 |
+
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
189 |
+
provided job URL to view a variety of on-device performance metrics.
|
190 |
+
```python
|
191 |
+
profile_job = hub.submit_profile_job(
|
192 |
+
model=target_model,
|
193 |
+
device=device,
|
194 |
+
)
|
195 |
+
|
196 |
+
```
|
197 |
+
|
198 |
+
Step 3: **Verify on-device accuracy**
|
199 |
+
|
200 |
+
To verify the accuracy of the model on-device, you can run on-device inference
|
201 |
+
on sample input data on the same cloud hosted device.
|
202 |
+
```python
|
203 |
+
input_data = torch_model.sample_inputs()
|
204 |
+
inference_job = hub.submit_inference_job(
|
205 |
+
model=target_model,
|
206 |
+
device=device,
|
207 |
+
inputs=input_data,
|
208 |
+
)
|
209 |
+
on_device_output = inference_job.download_output_data()
|
210 |
+
|
211 |
+
```
|
212 |
+
With the output of the model, you can compute like PSNR, relative errors or
|
213 |
+
spot check the output with expected output.
|
214 |
+
|
215 |
+
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
216 |
+
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
217 |
+
|
218 |
|
219 |
|
220 |
## Run demo on a cloud-hosted device
|
|
|
259 |
|
260 |
|
261 |
## References
|
|
|
262 |
* [Source Model Implementation](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/face_attrib_net/model.py)
|
263 |
|
264 |
|