qaihm-bot commited on
Commit
f0d8008
·
verified ·
1 Parent(s): 3d21cc4

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +190 -0
README.md ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_attrib_net_quantized/web-assets/model_demo.png)
13
+
14
+ # Facial-Attribute-Detection-Quantized: Optimized for Mobile Deployment
15
+ ## Comprehensive facial analysis by extracting face features
16
+
17
+
18
+ Facial feature extraction and additional attributes including liveness, eyeclose, mask and glasses detection for face recognition.
19
+
20
+ This model is an implementation of Facial-Attribute-Detection-Quantized found [here](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/face_attrib_net/model.py).
21
+
22
+
23
+ This repository provides scripts to run Facial-Attribute-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_attrib_net_quantized).
26
+
27
+
28
+ ### Model Details
29
+
30
+ - **Model Type:** Object detection
31
+ - **Model Stats:**
32
+ - Model checkpoint: multitask_FR_state_dict.pt
33
+ - Input resolution: 128x128
34
+ - Input channel number: 1
35
+ - Number of parameters: 11.6M
36
+ - Model size: 47.6MB
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.498 ms | 0 - 9 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.515 ms | 0 - 19 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.912 ms | 0 - 16 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.376 ms | 0 - 29 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.38 ms | 0 - 26 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.68 ms | 0 - 102 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.38 ms | 0 - 19 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.402 ms | 0 - 20 MB | INT8 | NPU | Use Export Script |
48
+ | Facial-Attribute-Detection-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 0.659 ms | 0 - 52 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 | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 2.656 ms | 0 - 32 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 | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 1.775 ms | 0 - 12 MB | INT8 | NPU | Use Export Script |
51
+ | Facial-Attribute-Detection-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 54.45 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) |
52
+ | Facial-Attribute-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 0.504 ms | 0 - 9 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
53
+ | Facial-Attribute-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.48 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
54
+ | Facial-Attribute-Detection-Quantized | SA7255P ADP | SA7255P | TFLITE | 5.066 ms | 0 - 21 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
55
+ | Facial-Attribute-Detection-Quantized | SA7255P ADP | SA7255P | QNN | 5.24 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
56
+ | Facial-Attribute-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 0.502 ms | 0 - 9 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
57
+ | Facial-Attribute-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.488 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
58
+ | Facial-Attribute-Detection-Quantized | SA8295P ADP | SA8295P | TFLITE | 1.022 ms | 0 - 19 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
59
+ | Facial-Attribute-Detection-Quantized | SA8295P ADP | SA8295P | QNN | 1.07 ms | 0 - 6 MB | INT8 | NPU | Use Export Script |
60
+ | Facial-Attribute-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 0.504 ms | 0 - 10 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.tflite](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.tflite) |
61
+ | Facial-Attribute-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.484 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
62
+ | Facial-Attribute-Detection-Quantized | SA8775P ADP | SA8775P | TFLITE | 0.919 ms | 0 - 23 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 | SA8775P ADP | SA8775P | QNN | 1.021 ms | 0 - 6 MB | INT8 | NPU | Use Export Script |
64
+ | Facial-Attribute-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 0.641 ms | 0 - 32 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 | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.637 ms | 0 - 26 MB | INT8 | NPU | Use Export Script |
66
+ | Facial-Attribute-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.628 ms | 1 - 1 MB | INT8 | NPU | Use Export Script |
67
+ | Facial-Attribute-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 1.026 ms | 15 - 15 MB | INT8 | NPU | [Facial-Attribute-Detection-Quantized.onnx](https://huggingface.co/qualcomm/Facial-Attribute-Detection-Quantized/blob/main/Facial-Attribute-Detection-Quantized.onnx) |
68
+
69
+
70
+
71
+
72
+ ## Installation
73
+
74
+ This model can be installed as a Python package via pip.
75
+
76
+ ```bash
77
+ pip install qai-hub-models
78
+ ```
79
+
80
+
81
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
82
+
83
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
84
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
85
+
86
+ With this API token, you can configure your client to run models on the cloud
87
+ hosted devices.
88
+ ```bash
89
+ qai-hub configure --api_token API_TOKEN
90
+ ```
91
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
92
+
93
+
94
+
95
+ ## Demo off target
96
+
97
+ The package contains a simple end-to-end demo that downloads pre-trained
98
+ weights and runs this model on a sample input.
99
+
100
+ ```bash
101
+ python -m qai_hub_models.models.face_attrib_net_quantized.demo
102
+ ```
103
+
104
+ The above demo runs a reference implementation of pre-processing, model
105
+ inference, and post processing.
106
+
107
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
108
+ environment, please add the following to your cell (instead of the above).
109
+ ```
110
+ %run -m qai_hub_models.models.face_attrib_net_quantized.demo
111
+ ```
112
+
113
+
114
+ ### Run model on a cloud-hosted device
115
+
116
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
117
+ device. This script does the following:
118
+ * Performance check on-device on a cloud-hosted device
119
+ * Downloads compiled assets that can be deployed on-device for Android.
120
+ * Accuracy check between PyTorch and on-device outputs.
121
+
122
+ ```bash
123
+ python -m qai_hub_models.models.face_attrib_net_quantized.export
124
+ ```
125
+ ```
126
+ Profiling Results
127
+ ------------------------------------------------------------
128
+ Facial-Attribute-Detection-Quantized
129
+ Device : Samsung Galaxy S23 (13)
130
+ Runtime : TFLITE
131
+ Estimated inference time (ms) : 0.5
132
+ Estimated peak memory usage (MB): [0, 9]
133
+ Total # Ops : 170
134
+ Compute Unit(s) : NPU (170 ops)
135
+ ```
136
+
137
+
138
+
139
+
140
+ ## Run demo on a cloud-hosted device
141
+
142
+ You can also run the demo on-device.
143
+
144
+ ```bash
145
+ python -m qai_hub_models.models.face_attrib_net_quantized.demo --on-device
146
+ ```
147
+
148
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
149
+ environment, please add the following to your cell (instead of the above).
150
+ ```
151
+ %run -m qai_hub_models.models.face_attrib_net_quantized.demo -- --on-device
152
+ ```
153
+
154
+
155
+ ## Deploying compiled model to Android
156
+
157
+
158
+ The models can be deployed using multiple runtimes:
159
+ - TensorFlow Lite (`.tflite` export): [This
160
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
161
+ guide to deploy the .tflite model in an Android application.
162
+
163
+
164
+ - QNN (`.so` export ): This [sample
165
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
166
+ provides instructions on how to use the `.so` shared library in an Android application.
167
+
168
+
169
+ ## View on Qualcomm® AI Hub
170
+ Get more details on Facial-Attribute-Detection-Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/face_attrib_net_quantized).
171
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
172
+
173
+
174
+ ## License
175
+ * The license for the original implementation of Facial-Attribute-Detection-Quantized can be found [here](https://github.com/qcom-ai-hub/ai-hub-models-internal/blob/main/LICENSE).
176
+ * 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)
177
+
178
+
179
+
180
+ ## References
181
+ * [None](None)
182
+ * [Source Model Implementation](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/face_attrib_net/model.py)
183
+
184
+
185
+
186
+ ## Community
187
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
188
+ * For questions or feedback please [reach out to us](mailto:[email protected]).
189
+
190
+