Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: pytorch
|
3 |
+
license: bsd-3-clause
|
4 |
+
pipeline_tag: object-detection
|
5 |
+
tags:
|
6 |
+
- real_time
|
7 |
+
- quantized
|
8 |
+
- android
|
9 |
+
|
10 |
+
---
|
11 |
+
|
12 |
+
![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/face_det_lite_quantized/web-assets/model_demo.png)
|
13 |
+
|
14 |
+
# Lightweight-Face-Detection-Quantized: Optimized for Mobile Deployment
|
15 |
+
## face_det_lite_quantized is a face detection model
|
16 |
+
|
17 |
+
|
18 |
+
face_det_lite_quantized is a machine learning model that detect face in the images
|
19 |
+
|
20 |
+
This model is an implementation of Lightweight-Face-Detection-Quantized found [here](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/face_det_lite/model.py).
|
21 |
+
|
22 |
+
|
23 |
+
This repository provides scripts to run Lightweight-Face-Detection-Quantized on Qualcomm® devices.
|
24 |
+
More details on model performance across various devices, can be found
|
25 |
+
[here](https://aihub.qualcomm.com/models/face_det_lite_quantized).
|
26 |
+
|
27 |
+
|
28 |
+
### Model Details
|
29 |
+
|
30 |
+
- **Model Type:** Object detection
|
31 |
+
- **Model Stats:**
|
32 |
+
- Model checkpoint: qfd360_sl_model.pt
|
33 |
+
- Inference latency: RealTime
|
34 |
+
- Input resolution: 480x640
|
35 |
+
|
36 |
+
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
37 |
+
|---|---|---|---|---|---|---|---|---|
|
38 |
+
| Lightweight-Face-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 0.281 ms | 0 - 8 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
39 |
+
| Lightweight-Face-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 0.35 ms | 0 - 20 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.so](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.so) |
|
40 |
+
| Lightweight-Face-Detection-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 0.623 ms | 0 - 11 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.onnx) |
|
41 |
+
| Lightweight-Face-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.199 ms | 0 - 15 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
42 |
+
| Lightweight-Face-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.248 ms | 0 - 18 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.so](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.so) |
|
43 |
+
| Lightweight-Face-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 0.473 ms | 0 - 36 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.onnx) |
|
44 |
+
| Lightweight-Face-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.17 ms | 0 - 11 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
45 |
+
| Lightweight-Face-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.242 ms | 0 - 16 MB | INT8 | NPU | Use Export Script |
|
46 |
+
| Lightweight-Face-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.478 ms | 0 - 25 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.onnx) |
|
47 |
+
| Lightweight-Face-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 0.802 ms | 0 - 15 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
48 |
+
| Lightweight-Face-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 1.012 ms | 0 - 7 MB | INT8 | NPU | Use Export Script |
|
49 |
+
| Lightweight-Face-Detection-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 6.076 ms | 0 - 10 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
50 |
+
| Lightweight-Face-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.279 ms | 0 - 4 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
51 |
+
| Lightweight-Face-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.331 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
|
52 |
+
| Lightweight-Face-Detection-Quantized | SA7255P ADP | SA7255P | TFLITE | 3.157 ms | 0 - 16 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
53 |
+
| Lightweight-Face-Detection-Quantized | SA7255P ADP | SA7255P | QNN | 3.504 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
54 |
+
| Lightweight-Face-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.279 ms | 0 - 32 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
55 |
+
| Lightweight-Face-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.337 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
|
56 |
+
| Lightweight-Face-Detection-Quantized | SA8295P ADP | SA8295P | TFLITE | 0.678 ms | 0 - 10 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
57 |
+
| Lightweight-Face-Detection-Quantized | SA8295P ADP | SA8295P | QNN | 0.838 ms | 0 - 6 MB | INT8 | NPU | Use Export Script |
|
58 |
+
| Lightweight-Face-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.28 ms | 0 - 4 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
59 |
+
| Lightweight-Face-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.336 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
|
60 |
+
| Lightweight-Face-Detection-Quantized | SA8775P ADP | SA8775P | TFLITE | 0.606 ms | 0 - 16 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
61 |
+
| Lightweight-Face-Detection-Quantized | SA8775P ADP | SA8775P | QNN | 0.828 ms | 0 - 6 MB | INT8 | NPU | Use Export Script |
|
62 |
+
| Lightweight-Face-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.341 ms | 0 - 15 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.tflite) |
|
63 |
+
| Lightweight-Face-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.418 ms | 0 - 17 MB | INT8 | NPU | Use Export Script |
|
64 |
+
| Lightweight-Face-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.436 ms | 0 - 0 MB | INT8 | NPU | Use Export Script |
|
65 |
+
| Lightweight-Face-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 0.698 ms | 2 - 2 MB | INT8 | NPU | [Lightweight-Face-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Lightweight-Face-Detection-Quantized/blob/main/Lightweight-Face-Detection-Quantized.onnx) |
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
## Installation
|
71 |
+
|
72 |
+
This model can be installed as a Python package via pip.
|
73 |
+
|
74 |
+
```bash
|
75 |
+
pip install qai-hub-models
|
76 |
+
```
|
77 |
+
|
78 |
+
|
79 |
+
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
80 |
+
|
81 |
+
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
82 |
+
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
83 |
+
|
84 |
+
With this API token, you can configure your client to run models on the cloud
|
85 |
+
hosted devices.
|
86 |
+
```bash
|
87 |
+
qai-hub configure --api_token API_TOKEN
|
88 |
+
```
|
89 |
+
Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
## Demo off target
|
94 |
+
|
95 |
+
The package contains a simple end-to-end demo that downloads pre-trained
|
96 |
+
weights and runs this model on a sample input.
|
97 |
+
|
98 |
+
```bash
|
99 |
+
python -m qai_hub_models.models.face_det_lite_quantized.demo
|
100 |
+
```
|
101 |
+
|
102 |
+
The above demo runs a reference implementation of pre-processing, model
|
103 |
+
inference, and post processing.
|
104 |
+
|
105 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
106 |
+
environment, please add the following to your cell (instead of the above).
|
107 |
+
```
|
108 |
+
%run -m qai_hub_models.models.face_det_lite_quantized.demo
|
109 |
+
```
|
110 |
+
|
111 |
+
|
112 |
+
### Run model on a cloud-hosted device
|
113 |
+
|
114 |
+
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
115 |
+
device. This script does the following:
|
116 |
+
* Performance check on-device on a cloud-hosted device
|
117 |
+
* Downloads compiled assets that can be deployed on-device for Android.
|
118 |
+
* Accuracy check between PyTorch and on-device outputs.
|
119 |
+
|
120 |
+
```bash
|
121 |
+
python -m qai_hub_models.models.face_det_lite_quantized.export
|
122 |
+
```
|
123 |
+
```
|
124 |
+
Profiling Results
|
125 |
+
------------------------------------------------------------
|
126 |
+
Lightweight-Face-Detection-Quantized
|
127 |
+
Device : Samsung Galaxy S23 (13)
|
128 |
+
Runtime : TFLITE
|
129 |
+
Estimated inference time (ms) : 0.3
|
130 |
+
Estimated peak memory usage (MB): [0, 8]
|
131 |
+
Total # Ops : 90
|
132 |
+
Compute Unit(s) : NPU (90 ops)
|
133 |
+
```
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
## Run demo on a cloud-hosted device
|
139 |
+
|
140 |
+
You can also run the demo on-device.
|
141 |
+
|
142 |
+
```bash
|
143 |
+
python -m qai_hub_models.models.face_det_lite_quantized.demo --on-device
|
144 |
+
```
|
145 |
+
|
146 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
147 |
+
environment, please add the following to your cell (instead of the above).
|
148 |
+
```
|
149 |
+
%run -m qai_hub_models.models.face_det_lite_quantized.demo -- --on-device
|
150 |
+
```
|
151 |
+
|
152 |
+
|
153 |
+
## Deploying compiled model to Android
|
154 |
+
|
155 |
+
|
156 |
+
The models can be deployed using multiple runtimes:
|
157 |
+
- TensorFlow Lite (`.tflite` export): [This
|
158 |
+
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
159 |
+
guide to deploy the .tflite model in an Android application.
|
160 |
+
|
161 |
+
|
162 |
+
- QNN (`.so` export ): This [sample
|
163 |
+
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
164 |
+
provides instructions on how to use the `.so` shared library in an Android application.
|
165 |
+
|
166 |
+
|
167 |
+
## View on Qualcomm® AI Hub
|
168 |
+
Get more details on Lightweight-Face-Detection-Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/face_det_lite_quantized).
|
169 |
+
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
170 |
+
|
171 |
+
|
172 |
+
## License
|
173 |
+
* The license for the original implementation of Lightweight-Face-Detection-Quantized can be found [here](https://github.com/qcom-ai-hub/ai-hub-models-internal/blob/main/LICENSE).
|
174 |
+
* 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)
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
## References
|
179 |
+
* [None](None)
|
180 |
+
* [Source Model Implementation](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/face_det_lite/model.py)
|
181 |
+
|
182 |
+
|
183 |
+
|
184 |
+
## Community
|
185 |
+
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
|
186 |
+
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
187 |
+
|
188 |
+
|