bhushans commited on
Commit
15375b5
·
verified ·
1 Parent(s): f7e9cc7

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +172 -0
README.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: bsd-3-clause
4
+ pipeline_tag: keypoint-detection
5
+ tags:
6
+ - quantized
7
+ - android
8
+
9
+ ---
10
+
11
+ ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/facemap_3dmm_quantized/web-assets/model_demo.png)
12
+
13
+ # Facial-Landmark-Detection-Quantized: Optimized for Mobile Deployment
14
+ ## Facial landmark predictor with 3DMM
15
+
16
+
17
+ Real-time 3D facial landmark detection optimized for mobile and edge.
18
+
19
+ This model is an implementation of Facial-Landmark-Detection-Quantized found [here](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py).
20
+
21
+
22
+ This repository provides scripts to run Facial-Landmark-Detection-Quantized on Qualcomm® devices.
23
+ More details on model performance across various devices, can be found
24
+ [here](https://aihub.qualcomm.com/models/facemap_3dmm_quantized).
25
+
26
+
27
+ ### Model Details
28
+
29
+ - **Model Type:** Pose estimation
30
+ - **Model Stats:**
31
+ - Input resolution: 128x128
32
+ - Number of parameters: 5.424M
33
+ - Model size: 5.314MB
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 | QNN | 0.237 ms | 0 - 5 MB | INT8 | NPU | [Facial-Landmark-Detection-Quantized.so](https://huggingface.co/qualcomm/Facial-Landmark-Detection-Quantized/blob/main/Facial-Landmark-Detection-Quantized.so) |
38
+ | Facial-Landmark-Detection-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 0.191 ms | 0 - 9 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 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.182 ms | 0 - 9 MB | INT8 | NPU | Use Export Script |
40
+ | Facial-Landmark-Detection-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 0.81 ms | 0 - 7 MB | INT8 | NPU | Use Export Script |
41
+ | Facial-Landmark-Detection-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 0.228 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
42
+ | Facial-Landmark-Detection-Quantized | SA7255P ADP | SA7255P | QNN | 1.727 ms | 0 - 5 MB | INT8 | NPU | Use Export Script |
43
+ | Facial-Landmark-Detection-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 0.23 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
44
+ | Facial-Landmark-Detection-Quantized | SA8295P ADP | SA8295P | QNN | 0.661 ms | 0 - 6 MB | INT8 | NPU | Use Export Script |
45
+ | Facial-Landmark-Detection-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 0.228 ms | 0 - 1 MB | INT8 | NPU | Use Export Script |
46
+ | Facial-Landmark-Detection-Quantized | SA8775P ADP | SA8775P | QNN | 0.677 ms | 0 - 6 MB | INT8 | NPU | Use Export Script |
47
+ | Facial-Landmark-Detection-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 0.283 ms | 0 - 12 MB | INT8 | NPU | Use Export Script |
48
+ | Facial-Landmark-Detection-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 0.335 ms | 1 - 1 MB | INT8 | NPU | Use Export Script |
49
+
50
+
51
+
52
+
53
+ ## Installation
54
+
55
+ This model can be installed as a Python package via pip.
56
+
57
+ ```bash
58
+ pip install "qai-hub-models[facemap_3dmm_quantized]"
59
+ ```
60
+
61
+
62
+
63
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
64
+
65
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
66
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
67
+
68
+ With this API token, you can configure your client to run models on the cloud
69
+ hosted devices.
70
+ ```bash
71
+ qai-hub configure --api_token API_TOKEN
72
+ ```
73
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
74
+
75
+
76
+
77
+ ## Demo off target
78
+
79
+ The package contains a simple end-to-end demo that downloads pre-trained
80
+ weights and runs this model on a sample input.
81
+
82
+ ```bash
83
+ python -m qai_hub_models.models.facemap_3dmm_quantized.demo
84
+ ```
85
+
86
+ The above demo runs a reference implementation of pre-processing, model
87
+ inference, and post processing.
88
+
89
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
90
+ environment, please add the following to your cell (instead of the above).
91
+ ```
92
+ %run -m qai_hub_models.models.facemap_3dmm_quantized.demo
93
+ ```
94
+
95
+
96
+ ### Run model on a cloud-hosted device
97
+
98
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
99
+ device. This script does the following:
100
+ * Performance check on-device on a cloud-hosted device
101
+ * Downloads compiled assets that can be deployed on-device for Android.
102
+ * Accuracy check between PyTorch and on-device outputs.
103
+
104
+ ```bash
105
+ python -m qai_hub_models.models.facemap_3dmm_quantized.export
106
+ ```
107
+ ```
108
+ Profiling Results
109
+ ------------------------------------------------------------
110
+ Facial-Landmark-Detection-Quantized
111
+ Device : Samsung Galaxy S23 (13)
112
+ Runtime : QNN
113
+ Estimated inference time (ms) : 0.2
114
+ Estimated peak memory usage (MB): [0, 5]
115
+ Total # Ops : 55
116
+ Compute Unit(s) : NPU (55 ops)
117
+ ```
118
+
119
+
120
+
121
+
122
+ ## Run demo on a cloud-hosted device
123
+
124
+ You can also run the demo on-device.
125
+
126
+ ```bash
127
+ python -m qai_hub_models.models.facemap_3dmm_quantized.demo --on-device
128
+ ```
129
+
130
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
131
+ environment, please add the following to your cell (instead of the above).
132
+ ```
133
+ %run -m qai_hub_models.models.facemap_3dmm_quantized.demo -- --on-device
134
+ ```
135
+
136
+
137
+ ## Deploying compiled model to Android
138
+
139
+
140
+ The models can be deployed using multiple runtimes:
141
+ - TensorFlow Lite (`.tflite` export): [This
142
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
143
+ guide to deploy the .tflite model in an Android application.
144
+
145
+
146
+ - QNN (`.so` export ): This [sample
147
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
148
+ provides instructions on how to use the `.so` shared library in an Android application.
149
+
150
+
151
+ ## View on Qualcomm® AI Hub
152
+ Get more details on Facial-Landmark-Detection-Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/facemap_3dmm_quantized).
153
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
154
+
155
+
156
+ ## License
157
+ * The license for the original implementation of Facial-Landmark-Detection-Quantized can be found [here](https://github.com/pytorch/vision/blob/main/LICENSE).
158
+ * 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)
159
+
160
+
161
+
162
+ ## References
163
+ * [None](None)
164
+ * [Source Model Implementation](https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py)
165
+
166
+
167
+
168
+ ## Community
169
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
170
+ * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
171
+
172
+