Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -14,11 +14,9 @@ tags:
|
|
14 |
|
15 |
OpenPose is a machine learning model that estimates body and hand pose in an image and returns location and confidence for each of 19 joints.
|
16 |
|
17 |
-
This
|
18 |
-
|
19 |
-
|
20 |
-
[here](https://aihub.qualcomm.com/models/openpose).
|
21 |
-
|
22 |
|
23 |
### Model Details
|
24 |
|
@@ -29,189 +27,66 @@ More details on model performance across various devices, can be found
|
|
29 |
- Number of parameters: 52.3M
|
30 |
- Model size: 200 MB
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
|
35 |
-
| Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
36 |
-
| ---|---|---|---|---|---|---|---|
|
37 |
-
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 11.699 ms | 0 - 2 MB | FP16 | NPU | [OpenPose.tflite](https://huggingface.co/qualcomm/OpenPose/blob/main/OpenPose.tflite)
|
38 |
-
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 11.933 ms | 1 - 219 MB | FP16 | NPU | OpenPose
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
## Installation
|
43 |
-
|
44 |
-
This model can be installed as a Python package via pip.
|
45 |
-
|
46 |
-
```bash
|
47 |
-
pip install "qai-hub-models[openpose]"
|
48 |
-
```
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
53 |
-
|
54 |
-
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
55 |
-
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
56 |
-
|
57 |
-
With this API token, you can configure your client to run models on the cloud
|
58 |
-
hosted devices.
|
59 |
-
```bash
|
60 |
-
qai-hub configure --api_token API_TOKEN
|
61 |
-
```
|
62 |
-
Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
## Demo off target
|
67 |
-
|
68 |
-
The package contains a simple end-to-end demo that downloads pre-trained
|
69 |
-
weights and runs this model on a sample input.
|
70 |
-
|
71 |
-
```bash
|
72 |
-
python -m qai_hub_models.models.openpose.demo
|
73 |
-
```
|
74 |
-
|
75 |
-
The above demo runs a reference implementation of pre-processing, model
|
76 |
-
inference, and post processing.
|
77 |
-
|
78 |
-
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
79 |
-
environment, please add the following to your cell (instead of the above).
|
80 |
-
```
|
81 |
-
%run -m qai_hub_models.models.openpose.demo
|
82 |
-
```
|
83 |
-
|
84 |
-
|
85 |
-
### Run model on a cloud-hosted device
|
86 |
-
|
87 |
-
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
88 |
-
device. This script does the following:
|
89 |
-
* Performance check on-device on a cloud-hosted device
|
90 |
-
* Downloads compiled assets that can be deployed on-device for Android.
|
91 |
-
* Accuracy check between PyTorch and on-device outputs.
|
92 |
-
|
93 |
-
```bash
|
94 |
-
python -m qai_hub_models.models.openpose.export
|
95 |
-
```
|
96 |
-
|
97 |
-
```
|
98 |
-
Profile Job summary of OpenPose
|
99 |
-
--------------------------------------------------
|
100 |
-
Device: Snapdragon X Elite CRD (11)
|
101 |
-
Estimated Inference Time: 12.32 ms
|
102 |
-
Estimated Peak Memory Range: 0.57-0.57 MB
|
103 |
-
Compute Units: NPU (186) | Total (186)
|
104 |
-
|
105 |
-
|
106 |
-
```
|
107 |
-
|
108 |
-
|
109 |
-
## How does this work?
|
110 |
-
|
111 |
-
This [export script](https://aihub.qualcomm.com/models/openpose/qai_hub_models/models/OpenPose/export.py)
|
112 |
-
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
113 |
-
on-device. Lets go through each step below in detail:
|
114 |
-
|
115 |
-
Step 1: **Compile model for on-device deployment**
|
116 |
-
|
117 |
-
To compile a PyTorch model for on-device deployment, we first trace the model
|
118 |
-
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
119 |
-
|
120 |
-
```python
|
121 |
-
import torch
|
122 |
-
|
123 |
-
import qai_hub as hub
|
124 |
-
from qai_hub_models.models.openpose import
|
125 |
-
|
126 |
-
# Load the model
|
127 |
-
|
128 |
-
# Device
|
129 |
-
device = hub.Device("Samsung Galaxy S23")
|
130 |
-
|
131 |
-
|
132 |
-
```
|
133 |
-
|
134 |
-
|
135 |
-
Step 2: **Performance profiling on cloud-hosted device**
|
136 |
-
|
137 |
-
After compiling models from step 1. Models can be profiled model on-device using the
|
138 |
-
`target_model`. Note that this scripts runs the model on a device automatically
|
139 |
-
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
140 |
-
provided job URL to view a variety of on-device performance metrics.
|
141 |
-
```python
|
142 |
-
profile_job = hub.submit_profile_job(
|
143 |
-
model=target_model,
|
144 |
-
device=device,
|
145 |
-
)
|
146 |
-
|
147 |
-
```
|
148 |
-
|
149 |
-
Step 3: **Verify on-device accuracy**
|
150 |
-
|
151 |
-
To verify the accuracy of the model on-device, you can run on-device inference
|
152 |
-
on sample input data on the same cloud hosted device.
|
153 |
-
```python
|
154 |
-
input_data = torch_model.sample_inputs()
|
155 |
-
inference_job = hub.submit_inference_job(
|
156 |
-
model=target_model,
|
157 |
-
device=device,
|
158 |
-
inputs=input_data,
|
159 |
-
)
|
160 |
-
on_device_output = inference_job.download_output_data()
|
161 |
-
|
162 |
-
```
|
163 |
-
With the output of the model, you can compute like PSNR, relative errors or
|
164 |
-
spot check the output with expected output.
|
165 |
-
|
166 |
-
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
167 |
-
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
## Run demo on a cloud-hosted device
|
172 |
-
|
173 |
-
You can also run the demo on-device.
|
174 |
-
|
175 |
-
```bash
|
176 |
-
python -m qai_hub_models.models.openpose.demo --on-device
|
177 |
-
```
|
178 |
-
|
179 |
-
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
180 |
-
environment, please add the following to your cell (instead of the above).
|
181 |
-
```
|
182 |
-
%run -m qai_hub_models.models.openpose.demo -- --on-device
|
183 |
-
```
|
184 |
-
|
185 |
-
|
186 |
-
## Deploying compiled model to Android
|
187 |
-
|
188 |
-
|
189 |
-
The models can be deployed using multiple runtimes:
|
190 |
-
- TensorFlow Lite (`.tflite` export): [This
|
191 |
-
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
192 |
-
guide to deploy the .tflite model in an Android application.
|
193 |
-
|
194 |
-
|
195 |
-
- QNN (`.so` export ): This [sample
|
196 |
-
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
197 |
-
provides instructions on how to use the `.so` shared library in an Android application.
|
198 |
|
|
|
|
|
|
|
199 |
|
200 |
-
## View on Qualcomm® AI Hub
|
201 |
-
Get more details on OpenPose's performance across various devices [here](https://aihub.qualcomm.com/models/openpose).
|
202 |
-
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
203 |
|
204 |
-
## License
|
205 |
-
- The license for the original implementation of OpenPose can be found
|
206 |
-
[here](https://cmu.flintbox.com/technologies/b820c21d-8443-4aa2-a49f-8919d93a8740).
|
207 |
-
- The license for the compiled assets for on-device deployment can be found [here](https://cmu.flintbox.com/technologies/b820c21d-8443-4aa2-a49f-8919d93a8740)
|
208 |
|
209 |
## References
|
210 |
* [OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields](https://arxiv.org/abs/1812.08008)
|
211 |
* [Source Model Implementation](https://github.com/CMU-Perceptual-Computing-Lab/openpose)
|
212 |
|
|
|
|
|
213 |
## Community
|
214 |
-
* Join [our AI Hub Slack community](https://
|
215 |
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
216 |
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
OpenPose is a machine learning model that estimates body and hand pose in an image and returns location and confidence for each of 19 joints.
|
16 |
|
17 |
+
This is based on the implementation of OpenPose found
|
18 |
+
[here]({source_repo}). More details on model performance
|
19 |
+
accross various devices, can be found [here](https://aihub.qualcomm.com/models/openpose).
|
|
|
|
|
20 |
|
21 |
### Model Details
|
22 |
|
|
|
27 |
- Number of parameters: 52.3M
|
28 |
- Model size: 200 MB
|
29 |
|
30 |
+
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
31 |
+
|---|---|---|---|---|---|---|---|---|
|
32 |
+
| OpenPose | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 11.959 ms | 0 - 2 MB | FP16 | NPU | -- |
|
33 |
+
| OpenPose | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 11.864 ms | 1 - 205 MB | FP16 | NPU | -- |
|
34 |
+
| OpenPose | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 12.08 ms | 0 - 114 MB | FP16 | NPU | -- |
|
35 |
+
| OpenPose | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 11.393 ms | 0 - 41 MB | FP16 | NPU | -- |
|
36 |
+
| OpenPose | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 11.479 ms | 1 - 18 MB | FP16 | NPU | -- |
|
37 |
+
| OpenPose | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 11.482 ms | 0 - 45 MB | FP16 | NPU | -- |
|
38 |
+
| OpenPose | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 11.74 ms | 0 - 3 MB | FP16 | NPU | -- |
|
39 |
+
| OpenPose | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 12.078 ms | 1 - 2 MB | FP16 | NPU | -- |
|
40 |
+
| OpenPose | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 11.737 ms | 0 - 2 MB | FP16 | NPU | -- |
|
41 |
+
| OpenPose | SA8255 (Proxy) | SA8255P Proxy | QNN | 12.134 ms | 1 - 2 MB | FP16 | NPU | -- |
|
42 |
+
| OpenPose | SA8775 (Proxy) | SA8775P Proxy | TFLITE | 11.702 ms | 0 - 2 MB | FP16 | NPU | -- |
|
43 |
+
| OpenPose | SA8775 (Proxy) | SA8775P Proxy | QNN | 12.105 ms | 1 - 2 MB | FP16 | NPU | -- |
|
44 |
+
| OpenPose | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 11.688 ms | 0 - 2 MB | FP16 | NPU | -- |
|
45 |
+
| OpenPose | SA8650 (Proxy) | SA8650P Proxy | QNN | 12.118 ms | 1 - 2 MB | FP16 | NPU | -- |
|
46 |
+
| OpenPose | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 23.527 ms | 0 - 41 MB | FP16 | NPU | -- |
|
47 |
+
| OpenPose | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 23.749 ms | 1 - 18 MB | FP16 | NPU | -- |
|
48 |
+
| OpenPose | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 8.656 ms | 0 - 23 MB | FP16 | NPU | -- |
|
49 |
+
| OpenPose | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 8.742 ms | 1 - 16 MB | FP16 | NPU | -- |
|
50 |
+
| OpenPose | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 7.177 ms | 1 - 27 MB | FP16 | NPU | -- |
|
51 |
+
| OpenPose | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 12.659 ms | 1 - 1 MB | FP16 | NPU | -- |
|
52 |
+
| OpenPose | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 12.628 ms | 102 - 102 MB | FP16 | NPU | -- |
|
53 |
|
54 |
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
## License
|
58 |
+
* The license for the original implementation of OpenPose can be found [here](https://cmu.flintbox.com/technologies/b820c21d-8443-4aa2-a49f-8919d93a8740).
|
59 |
+
* The license for the compiled assets for on-device deployment can be found [here](https://cmu.flintbox.com/technologies/b820c21d-8443-4aa2-a49f-8919d93a8740)
|
60 |
|
|
|
|
|
|
|
61 |
|
|
|
|
|
|
|
|
|
62 |
|
63 |
## References
|
64 |
* [OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields](https://arxiv.org/abs/1812.08008)
|
65 |
* [Source Model Implementation](https://github.com/CMU-Perceptual-Computing-Lab/openpose)
|
66 |
|
67 |
+
|
68 |
+
|
69 |
## Community
|
70 |
+
* 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.
|
71 |
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
72 |
|
73 |
+
## Usage and Limitations
|
74 |
+
|
75 |
+
Model may not be used for or in connection with any of the following applications:
|
76 |
+
|
77 |
+
- Accessing essential private and public services and benefits;
|
78 |
+
- Administration of justice and democratic processes;
|
79 |
+
- Assessing or recognizing the emotional state of a person;
|
80 |
+
- Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics;
|
81 |
+
- Education and vocational training;
|
82 |
+
- Employment and workers management;
|
83 |
+
- Exploitation of the vulnerabilities of persons resulting in harmful behavior;
|
84 |
+
- General purpose social scoring;
|
85 |
+
- Law enforcement;
|
86 |
+
- Management and operation of critical infrastructure;
|
87 |
+
- Migration, asylum and border control management;
|
88 |
+
- Predictive policing;
|
89 |
+
- Real-time remote biometric identification in public spaces;
|
90 |
+
- Recommender systems of social media platforms;
|
91 |
+
- Scraping of facial images (from the internet or otherwise); and/or
|
92 |
+
- Subliminal manipulation
|