qaihm-bot commited on
Commit
f71da66
·
verified ·
1 Parent(s): 0b1f345

See https://github.com/quic/ai-hub-models/releases/v0.41.0 for changelog.

.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ DEPLOYMENT_MODEL_LICENSE.pdf filter=lfs diff=lfs merge=lfs -text
DEPLOYMENT_MODEL_LICENSE.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4409f93b0e82531303b3e10f52f1fdfb56467a25f05b7441c6bbd8bb8a64b42c
3
+ size 109629
LICENSE ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ The license of the original trained model can be found at https://github.com/xingyizhou/CenterNet/blob/master/LICENSE.
2
+ The license for the deployable model files (.tflite, .onnx, .dlc, .bin, etc.) can be found in DEPLOYMENT_MODEL_LICENSE.pdf.
README.md ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: other
4
+ tags:
5
+ - android
6
+ pipeline_tag: other
7
+
8
+ ---
9
+
10
+ ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/centernet_3d/web-assets/model_demo.png)
11
+
12
+ # CenterNet-3D: Optimized for Mobile Deployment
13
+ ## Construct a bird’s eye view from sensors mounted on a vehicle
14
+
15
+
16
+ CenterNet is a machine learning model for generating a birds eye view represenation from the sensors(cameras) mounted on a vehicle.
17
+
18
+ This model is an implementation of CenterNet-3D found [here](https://github.com/xingyizhou/CenterNet).
19
+
20
+
21
+ This repository provides scripts to run CenterNet-3D on Qualcomm® devices.
22
+ More details on model performance across various devices, can be found
23
+ [here](https://aihub.qualcomm.com/models/centernet_3d).
24
+
25
+
26
+
27
+ ### Model Details
28
+
29
+ - **Model Type:** Model_use_case.driver_assistance
30
+ - **Model Stats:**
31
+ - Model checkpoint: ddd_3dop.pth
32
+ - Input resolution: 1 x 3 x 384 x 1280
33
+ - Number of parameters: 20.6M
34
+ - Model size: 79 MB
35
+
36
+ | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
37
+ |---|---|---|---|---|---|---|---|---|
38
+ | CenterNet-3D | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | PRECOMPILED_QNN_ONNX | 898.005 ms | 1 - 77 MB | NPU | Use Export Script |
39
+ | CenterNet-3D | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | PRECOMPILED_QNN_ONNX | 682.716 ms | 8 - 24 MB | NPU | Use Export Script |
40
+ | CenterNet-3D | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | PRECOMPILED_QNN_ONNX | 524.208 ms | 3 - 19 MB | NPU | Use Export Script |
41
+ | CenterNet-3D | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | PRECOMPILED_QNN_ONNX | 506.514 ms | 6 - 17 MB | NPU | Use Export Script |
42
+ | CenterNet-3D | float | Snapdragon X Elite CRD | Snapdragon® X Elite | PRECOMPILED_QNN_ONNX | 863.597 ms | 61 - 61 MB | NPU | Use Export Script |
43
+
44
+
45
+
46
+
47
+ ## Installation
48
+
49
+
50
+ Install the package via pip:
51
+ ```bash
52
+ pip install qai-hub-models
53
+ ```
54
+
55
+
56
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
57
+
58
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
59
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
60
+
61
+ With this API token, you can configure your client to run models on the cloud
62
+ hosted devices.
63
+ ```bash
64
+ qai-hub configure --api_token API_TOKEN
65
+ ```
66
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
67
+
68
+
69
+
70
+ ## Demo off target
71
+
72
+ The package contains a simple end-to-end demo that downloads pre-trained
73
+ weights and runs this model on a sample input.
74
+
75
+ ```bash
76
+ python -m qai_hub_models.models.centernet_3d.demo
77
+ ```
78
+
79
+ The above demo runs a reference implementation of pre-processing, model
80
+ inference, and post processing.
81
+
82
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
83
+ environment, please add the following to your cell (instead of the above).
84
+ ```
85
+ %run -m qai_hub_models.models.centernet_3d.demo
86
+ ```
87
+
88
+
89
+ ### Run model on a cloud-hosted device
90
+
91
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
92
+ device. This script does the following:
93
+ * Performance check on-device on a cloud-hosted device
94
+ * Downloads compiled assets that can be deployed on-device for Android.
95
+ * Accuracy check between PyTorch and on-device outputs.
96
+
97
+ ```bash
98
+ python -m qai_hub_models.models.centernet_3d.export
99
+ ```
100
+
101
+
102
+
103
+ ## How does this work?
104
+
105
+ This [export script](https://aihub.qualcomm.com/models/centernet_3d/qai_hub_models/models/CenterNet-3D/export.py)
106
+ leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
107
+ on-device. Lets go through each step below in detail:
108
+
109
+ Step 1: **Compile model for on-device deployment**
110
+
111
+ To compile a PyTorch model for on-device deployment, we first trace the model
112
+ in memory using the `jit.trace` and then call the `submit_compile_job` API.
113
+
114
+ ```python
115
+ import torch
116
+
117
+ import qai_hub as hub
118
+ from qai_hub_models.models.centernet_3d import Model
119
+
120
+ # Load the model
121
+ torch_model = Model.from_pretrained()
122
+
123
+ # Device
124
+ device = hub.Device("Samsung Galaxy S25")
125
+
126
+ # Trace model
127
+ input_shape = torch_model.get_input_spec()
128
+ sample_inputs = torch_model.sample_inputs()
129
+
130
+ pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
131
+
132
+ # Compile model on a specific device
133
+ compile_job = hub.submit_compile_job(
134
+ model=pt_model,
135
+ device=device,
136
+ input_specs=torch_model.get_input_spec(),
137
+ )
138
+
139
+ # Get target model to run on-device
140
+ target_model = compile_job.get_target_model()
141
+
142
+ ```
143
+
144
+
145
+ Step 2: **Performance profiling on cloud-hosted device**
146
+
147
+ After compiling models from step 1. Models can be profiled model on-device using the
148
+ `target_model`. Note that this scripts runs the model on a device automatically
149
+ provisioned in the cloud. Once the job is submitted, you can navigate to a
150
+ provided job URL to view a variety of on-device performance metrics.
151
+ ```python
152
+ profile_job = hub.submit_profile_job(
153
+ model=target_model,
154
+ device=device,
155
+ )
156
+
157
+ ```
158
+
159
+ Step 3: **Verify on-device accuracy**
160
+
161
+ To verify the accuracy of the model on-device, you can run on-device inference
162
+ on sample input data on the same cloud hosted device.
163
+ ```python
164
+ input_data = torch_model.sample_inputs()
165
+ inference_job = hub.submit_inference_job(
166
+ model=target_model,
167
+ device=device,
168
+ inputs=input_data,
169
+ )
170
+ on_device_output = inference_job.download_output_data()
171
+
172
+ ```
173
+ With the output of the model, you can compute like PSNR, relative errors or
174
+ spot check the output with expected output.
175
+
176
+ **Note**: This on-device profiling and inference requires access to Qualcomm®
177
+ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
178
+
179
+
180
+
181
+ ## Run demo on a cloud-hosted device
182
+
183
+ You can also run the demo on-device.
184
+
185
+ ```bash
186
+ python -m qai_hub_models.models.centernet_3d.demo --eval-mode on-device
187
+ ```
188
+
189
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
190
+ environment, please add the following to your cell (instead of the above).
191
+ ```
192
+ %run -m qai_hub_models.models.centernet_3d.demo -- --eval-mode on-device
193
+ ```
194
+
195
+
196
+ ## Deploying compiled model to Android
197
+
198
+
199
+ The models can be deployed using multiple runtimes:
200
+ - TensorFlow Lite (`.tflite` export): [This
201
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
202
+ guide to deploy the .tflite model in an Android application.
203
+
204
+
205
+ - QNN (`.so` export ): This [sample
206
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
207
+ provides instructions on how to use the `.so` shared library in an Android application.
208
+
209
+
210
+ ## View on Qualcomm® AI Hub
211
+ Get more details on CenterNet-3D's performance across various devices [here](https://aihub.qualcomm.com/models/centernet_3d).
212
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
213
+
214
+
215
+ ## License
216
+ * The license for the original implementation of CenterNet-3D can be found
217
+ [here](https://github.com/xingyizhou/CenterNet/blob/master/LICENSE).
218
+ * 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)
219
+
220
+
221
+
222
+ ## References
223
+ * [Objects as Points](https://arxiv.org/abs/1904.07850)
224
+ * [Source Model Implementation](https://github.com/xingyizhou/CenterNet)
225
+
226
+
227
+
228
+ ## Community
229
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
230
+ * For questions or feedback please [reach out to us](mailto:[email protected]).
231
+
232
+
precompiled/qualcomm-qcs8550-proxy/CenterNet-3D_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d985f21001dbb837293cdbe49fda7dab4256f17f98875f9a1dff73e46afbc5a2
3
+ size 45943369
precompiled/qualcomm-qcs8550-proxy/tool-versions.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ tool_versions:
2
+ precompiled_qnn_onnx:
3
+ qairt: 2.37.1.250807093845_124904
4
+ onnx_runtime: 1.23.0
precompiled/qualcomm-snapdragon-8-elite-for-galaxy/CenterNet-3D_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4306c5958cd46d77dbf610a73df57c71ab4dbd89e1c126d26a2a7a82cb546b6e
3
+ size 47699309
precompiled/qualcomm-snapdragon-8-elite-for-galaxy/tool-versions.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ tool_versions:
2
+ precompiled_qnn_onnx:
3
+ qairt: 2.37.1.250807093845_124904
4
+ onnx_runtime: 1.23.0
precompiled/qualcomm-snapdragon-8-elite-gen5/CenterNet-3D_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87fa1174802aa275173a2905b63027d0afee69dda34f190b849cbad67f1bf24a
3
+ size 47152917
precompiled/qualcomm-snapdragon-8-elite-gen5/tool-versions.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ tool_versions:
2
+ precompiled_qnn_onnx:
3
+ qairt: 2.37.1.250807093845_124904
4
+ onnx_runtime: 1.23.0
precompiled/qualcomm-snapdragon-8gen3/CenterNet-3D_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff33bd9a87396fb5c66900d109f054502d1ddb9b056289c1032dde7406272fc5
3
+ size 45953253
precompiled/qualcomm-snapdragon-8gen3/tool-versions.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ tool_versions:
2
+ precompiled_qnn_onnx:
3
+ qairt: 2.37.1.250807093845_124904
4
+ onnx_runtime: 1.23.0
precompiled/qualcomm-snapdragon-x-elite/CenterNet-3D_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cb9f01a30e55905bb116983772cb306ebe2353e2a45199b10c3dfff4ca2c4aa
3
+ size 45927934
precompiled/qualcomm-snapdragon-x-elite/tool-versions.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ tool_versions:
2
+ precompiled_qnn_onnx:
3
+ qairt: 2.37.1.250807093845_124904
4
+ onnx_runtime: 1.23.0