Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -26,14 +26,18 @@ More details on model performance across various devices, can be found
|
|
26 |
- **Model Type:** Pose estimation
|
27 |
- **Model Stats:**
|
28 |
- Model checkpoint: hrnet_posenet_FP32_state_dict
|
29 |
-
- Input resolution:
|
30 |
- Number of parameters: 28.5M
|
31 |
- Model size: 109 MB
|
32 |
|
33 |
|
|
|
|
|
34 |
| Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
35 |
| ---|---|---|---|---|---|---|---|
|
36 |
-
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite |
|
|
|
|
|
37 |
|
38 |
|
39 |
## Installation
|
@@ -94,90 +98,15 @@ python -m qai_hub_models.models.hrnet_pose_quantized.export
|
|
94 |
```
|
95 |
Profile Job summary of HRNetPoseQuantized
|
96 |
--------------------------------------------------
|
97 |
-
Device:
|
98 |
-
Estimated Inference Time: 1.
|
99 |
-
Estimated Peak Memory Range: 0.
|
100 |
-
Compute Units: NPU (
|
101 |
|
102 |
|
103 |
```
|
104 |
-
## How does this work?
|
105 |
-
|
106 |
-
This [export script](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/HRNetPoseQuantized/export.py)
|
107 |
-
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
108 |
-
on-device. Lets go through each step below in detail:
|
109 |
-
|
110 |
-
Step 1: **Compile model for on-device deployment**
|
111 |
-
|
112 |
-
To compile a PyTorch model for on-device deployment, we first trace the model
|
113 |
-
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
114 |
-
|
115 |
-
```python
|
116 |
-
import torch
|
117 |
-
|
118 |
-
import qai_hub as hub
|
119 |
-
from qai_hub_models.models.hrnet_pose_quantized import Model
|
120 |
-
|
121 |
-
# Load the model
|
122 |
-
torch_model = Model.from_pretrained()
|
123 |
-
torch_model.eval()
|
124 |
-
|
125 |
-
# Device
|
126 |
-
device = hub.Device("Samsung Galaxy S23")
|
127 |
-
|
128 |
-
# Trace model
|
129 |
-
input_shape = torch_model.get_input_spec()
|
130 |
-
sample_inputs = torch_model.sample_inputs()
|
131 |
-
|
132 |
-
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
133 |
-
|
134 |
-
# Compile model on a specific device
|
135 |
-
compile_job = hub.submit_compile_job(
|
136 |
-
model=pt_model,
|
137 |
-
device=device,
|
138 |
-
input_specs=torch_model.get_input_spec(),
|
139 |
-
)
|
140 |
|
141 |
-
# Get target model to run on-device
|
142 |
-
target_model = compile_job.get_target_model()
|
143 |
-
|
144 |
-
```
|
145 |
-
|
146 |
-
|
147 |
-
Step 2: **Performance profiling on cloud-hosted device**
|
148 |
-
|
149 |
-
After compiling models from step 1. Models can be profiled model on-device using the
|
150 |
-
`target_model`. Note that this scripts runs the model on a device automatically
|
151 |
-
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
152 |
-
provided job URL to view a variety of on-device performance metrics.
|
153 |
-
```python
|
154 |
-
profile_job = hub.submit_profile_job(
|
155 |
-
model=target_model,
|
156 |
-
device=device,
|
157 |
-
)
|
158 |
-
|
159 |
-
```
|
160 |
-
|
161 |
-
Step 3: **Verify on-device accuracy**
|
162 |
-
|
163 |
-
To verify the accuracy of the model on-device, you can run on-device inference
|
164 |
-
on sample input data on the same cloud hosted device.
|
165 |
-
```python
|
166 |
-
input_data = torch_model.sample_inputs()
|
167 |
-
inference_job = hub.submit_inference_job(
|
168 |
-
model=target_model,
|
169 |
-
device=device,
|
170 |
-
inputs=input_data,
|
171 |
-
)
|
172 |
-
|
173 |
-
on_device_output = inference_job.download_output_data()
|
174 |
-
|
175 |
-
```
|
176 |
-
With the output of the model, you can compute like PSNR, relative errors or
|
177 |
-
spot check the output with expected output.
|
178 |
|
179 |
-
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
180 |
-
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
181 |
|
182 |
|
183 |
## Run demo on a cloud-hosted device
|
@@ -216,14 +145,14 @@ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
|
216 |
## License
|
217 |
- The license for the original implementation of HRNetPoseQuantized can be found
|
218 |
[here](https://github.com/quic/aimet-model-zoo/blob/develop/LICENSE.pdf).
|
219 |
-
- The license for the compiled assets for on-device deployment can be found [here](
|
220 |
|
221 |
## References
|
222 |
* [Deep High-Resolution Representation Learning for Human Pose Estimation](https://arxiv.org/abs/1902.09212)
|
223 |
* [Source Model Implementation](https://github.com/quic/aimet-model-zoo/tree/develop/aimet_zoo_torch/hrnet_posenet)
|
224 |
|
225 |
## Community
|
226 |
-
* Join [our AI Hub Slack community](https://
|
227 |
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
|
228 |
|
229 |
|
|
|
26 |
- **Model Type:** Pose estimation
|
27 |
- **Model Stats:**
|
28 |
- Model checkpoint: hrnet_posenet_FP32_state_dict
|
29 |
+
- Input resolution: 256x192
|
30 |
- Number of parameters: 28.5M
|
31 |
- Model size: 109 MB
|
32 |
|
33 |
|
34 |
+
|
35 |
+
|
36 |
| Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
37 |
| ---|---|---|---|---|---|---|---|
|
38 |
+
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 0.958 ms | 0 - 2 MB | INT8 | NPU | [HRNetPoseQuantized.tflite](https://huggingface.co/qualcomm/HRNetPoseQuantized/blob/main/HRNetPoseQuantized.tflite)
|
39 |
+
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 1.238 ms | 0 - 14 MB | INT8 | NPU | [HRNetPoseQuantized.so](https://huggingface.co/qualcomm/HRNetPoseQuantized/blob/main/HRNetPoseQuantized.so)
|
40 |
+
|
41 |
|
42 |
|
43 |
## Installation
|
|
|
98 |
```
|
99 |
Profile Job summary of HRNetPoseQuantized
|
100 |
--------------------------------------------------
|
101 |
+
Device: Snapdragon X Elite CRD (11)
|
102 |
+
Estimated Inference Time: 1.29 ms
|
103 |
+
Estimated Peak Memory Range: 0.32-0.32 MB
|
104 |
+
Compute Units: NPU (488) | Total (488)
|
105 |
|
106 |
|
107 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
|
|
|
|
110 |
|
111 |
|
112 |
## Run demo on a cloud-hosted device
|
|
|
145 |
## License
|
146 |
- The license for the original implementation of HRNetPoseQuantized can be found
|
147 |
[here](https://github.com/quic/aimet-model-zoo/blob/develop/LICENSE.pdf).
|
148 |
+
- 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)
|
149 |
|
150 |
## References
|
151 |
* [Deep High-Resolution Representation Learning for Human Pose Estimation](https://arxiv.org/abs/1902.09212)
|
152 |
* [Source Model Implementation](https://github.com/quic/aimet-model-zoo/tree/develop/aimet_zoo_torch/hrnet_posenet)
|
153 |
|
154 |
## Community
|
155 |
+
* 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.
|
156 |
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
|
157 |
|
158 |
|