Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- coco
|
4 |
+
library_name: pytorch
|
5 |
+
license: apache-2.0
|
6 |
+
pipeline_tag: image-classification
|
7 |
+
tags:
|
8 |
+
- quantized
|
9 |
+
- android
|
10 |
+
|
11 |
+
---
|
12 |
+
|
13 |
+
![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/posenet_mobilenet_quantized/web-assets/model_demo.png)
|
14 |
+
|
15 |
+
# Posenet-Mobilenet-Quantized: Optimized for Mobile Deployment
|
16 |
+
## Quantized human pose estimator
|
17 |
+
|
18 |
+
Posenet performs pose estimation on human images.
|
19 |
+
|
20 |
+
This model is an implementation of Posenet-Mobilenet-Quantized found [here](https://github.com/rwightman/posenet-pytorch).
|
21 |
+
This repository provides scripts to run Posenet-Mobilenet-Quantized on Qualcomm® devices.
|
22 |
+
More details on model performance across various devices, can be found
|
23 |
+
[here](https://aihub.qualcomm.com/models/posenet_mobilenet_quantized).
|
24 |
+
|
25 |
+
|
26 |
+
### Model Details
|
27 |
+
|
28 |
+
- **Model Type:** Pose estimation
|
29 |
+
- **Model Stats:**
|
30 |
+
- Model checkpoint: mobilenet_v1_101
|
31 |
+
- Input resolution: 513x257
|
32 |
+
- Number of parameters: 3.31M
|
33 |
+
- Model size: 3.47 MB
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
| Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
39 |
+
| ---|---|---|---|---|---|---|---|
|
40 |
+
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 0.591 ms | 0 - 2 MB | INT8 | NPU | [Posenet-Mobilenet-Quantized.tflite](https://huggingface.co/qualcomm/Posenet-Mobilenet-Quantized/blob/main/Posenet-Mobilenet-Quantized.tflite)
|
41 |
+
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 0.622 ms | 0 - 9 MB | INT8 | NPU | [Posenet-Mobilenet-Quantized.so](https://huggingface.co/qualcomm/Posenet-Mobilenet-Quantized/blob/main/Posenet-Mobilenet-Quantized.so)
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
## Installation
|
46 |
+
|
47 |
+
This model can be installed as a Python package via pip.
|
48 |
+
|
49 |
+
```bash
|
50 |
+
pip install qai-hub-models
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
+
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
55 |
+
|
56 |
+
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
57 |
+
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
58 |
+
|
59 |
+
With this API token, you can configure your client to run models on the cloud
|
60 |
+
hosted devices.
|
61 |
+
```bash
|
62 |
+
qai-hub configure --api_token API_TOKEN
|
63 |
+
```
|
64 |
+
Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
## Demo off target
|
69 |
+
|
70 |
+
The package contains a simple end-to-end demo that downloads pre-trained
|
71 |
+
weights and runs this model on a sample input.
|
72 |
+
|
73 |
+
```bash
|
74 |
+
python -m qai_hub_models.models.posenet_mobilenet_quantized.demo
|
75 |
+
```
|
76 |
+
|
77 |
+
The above demo runs a reference implementation of pre-processing, model
|
78 |
+
inference, and post processing.
|
79 |
+
|
80 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
81 |
+
environment, please add the following to your cell (instead of the above).
|
82 |
+
```
|
83 |
+
%run -m qai_hub_models.models.posenet_mobilenet_quantized.demo
|
84 |
+
```
|
85 |
+
|
86 |
+
|
87 |
+
### Run model on a cloud-hosted device
|
88 |
+
|
89 |
+
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
90 |
+
device. This script does the following:
|
91 |
+
* Performance check on-device on a cloud-hosted device
|
92 |
+
* Downloads compiled assets that can be deployed on-device for Android.
|
93 |
+
* Accuracy check between PyTorch and on-device outputs.
|
94 |
+
|
95 |
+
```bash
|
96 |
+
python -m qai_hub_models.models.posenet_mobilenet_quantized.export
|
97 |
+
```
|
98 |
+
|
99 |
+
```
|
100 |
+
Profile Job summary of Posenet-Mobilenet-Quantized
|
101 |
+
--------------------------------------------------
|
102 |
+
Device: Snapdragon X Elite CRD (11)
|
103 |
+
Estimated Inference Time: 0.69 ms
|
104 |
+
Estimated Peak Memory Range: 0.38-0.38 MB
|
105 |
+
Compute Units: NPU (42) | Total (42)
|
106 |
+
|
107 |
+
|
108 |
+
```
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
## Run demo on a cloud-hosted device
|
114 |
+
|
115 |
+
You can also run the demo on-device.
|
116 |
+
|
117 |
+
```bash
|
118 |
+
python -m qai_hub_models.models.posenet_mobilenet_quantized.demo --on-device
|
119 |
+
```
|
120 |
+
|
121 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
122 |
+
environment, please add the following to your cell (instead of the above).
|
123 |
+
```
|
124 |
+
%run -m qai_hub_models.models.posenet_mobilenet_quantized.demo -- --on-device
|
125 |
+
```
|
126 |
+
|
127 |
+
|
128 |
+
## Deploying compiled model to Android
|
129 |
+
|
130 |
+
|
131 |
+
The models can be deployed using multiple runtimes:
|
132 |
+
- TensorFlow Lite (`.tflite` export): [This
|
133 |
+
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
134 |
+
guide to deploy the .tflite model in an Android application.
|
135 |
+
|
136 |
+
|
137 |
+
- QNN (`.so` export ): This [sample
|
138 |
+
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
139 |
+
provides instructions on how to use the `.so` shared library in an Android application.
|
140 |
+
|
141 |
+
|
142 |
+
## View on Qualcomm® AI Hub
|
143 |
+
Get more details on Posenet-Mobilenet-Quantized's performance across various devices [here](https://aihub.qualcomm.com/models/posenet_mobilenet_quantized).
|
144 |
+
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
145 |
+
|
146 |
+
## License
|
147 |
+
- The license for the original implementation of Posenet-Mobilenet-Quantized can be found
|
148 |
+
[here](https://github.com/rwightman/posenet-pytorch/blob/master/LICENSE.txt).
|
149 |
+
- 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)
|
150 |
+
|
151 |
+
## References
|
152 |
+
* [PersonLab: Person Pose Estimation and Instance Segmentation with a Bottom-Up, Part-Based, Geometric Embedding Model](https://arxiv.org/abs/1803.08225)
|
153 |
+
* [Source Model Implementation](https://github.com/rwightman/posenet-pytorch)
|
154 |
+
|
155 |
+
## Community
|
156 |
+
* Join [our AI Hub Slack community](https://qualcomm-ai-hub.slack.com/join/shared_invite/zt-2d5zsmas3-Sj0Q9TzslueCjS31eXG2UA#/shared-invite/email) to collaborate, post questions and learn more about on-device AI.
|
157 |
+
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
|
158 |
+
|
159 |
+
|