qaihm-bot commited on
Commit
8ae6f66
·
verified ·
1 Parent(s): 0aede3d

See https://github.com/quic/ai-hub-models/releases/v0.41.2 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
BEVDet_float.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7063ce1194183e1ed5bf3b710ad9e09d7e34964a7bdd9055f5013e31b39845a2
3
+ size 165995340
BEVDet_float.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d28443665e46f84910baccdba85cbd880f163c3bae5ca9373187833434b8048c
3
+ size 196507216
BEVDet_w8a16_mixed_fp16.onnx.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1488915bbbf38987bfc3249f02c6bdcae8a73bf8e639a8b187583b16ce69caa5
3
+ size 80571058
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/HuangJunJie2017/BEVDet/blob/dev3.0/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,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/bevdet/web-assets/model_demo.png)
11
+
12
+ # BEVDet: Optimized for Mobile Deployment
13
+ ## Construct a bird’s eye view from sensors mounted on a vehicle
14
+
15
+
16
+ BEVDet 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 BEVDet found [here](https://github.com/HuangJunJie2017/BEVDet/).
19
+
20
+
21
+ This repository provides scripts to run BEVDet on Qualcomm® devices.
22
+ More details on model performance across various devices, can be found
23
+ [here](https://aihub.qualcomm.com/models/bevdet).
24
+
25
+
26
+
27
+ ### Model Details
28
+
29
+ - **Model Type:** Model_use_case.driver_assistance
30
+ - **Model Stats:**
31
+ - Model checkpoint: bevdet-r50.pth
32
+ - Input resolution: 1 x 6 x 3 x 256 x 704
33
+ - Number of parameters: 44M
34
+ - Model size: 171 MB
35
+
36
+ | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
37
+ |---|---|---|---|---|---|---|---|---|
38
+ | BEVDet | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 3066.089 ms | 129 - 141 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
39
+ | BEVDet | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 2366.717 ms | 129 - 150 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
40
+ | BEVDet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 2046.52 ms | 128 - 132 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
41
+ | BEVDet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 2513.257 ms | 298 - 301 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.onnx.zip) |
42
+ | BEVDet | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 2513.882 ms | 128 - 140 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
43
+ | BEVDet | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 3066.089 ms | 129 - 141 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
44
+ | BEVDet | float | SA8255 (Proxy) | Qualcomm® SA8255P (Proxy) | TFLITE | 2016.379 ms | 127 - 130 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
45
+ | BEVDet | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 2018.721 ms | 129 - 144 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
46
+ | BEVDet | float | SA8650 (Proxy) | Qualcomm® SA8650P (Proxy) | TFLITE | 1889.096 ms | 126 - 129 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
47
+ | BEVDet | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 2513.882 ms | 128 - 140 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
48
+ | BEVDet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 1757.655 ms | 123 - 147 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
49
+ | BEVDet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 2041.163 ms | 296 - 316 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.onnx.zip) |
50
+ | BEVDet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 1297.116 ms | 93 - 107 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
51
+ | BEVDet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 1541.601 ms | 266 - 281 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.onnx.zip) |
52
+ | BEVDet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | TFLITE | 1095.612 ms | 111 - 124 MB | CPU | [BEVDet.tflite](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.tflite) |
53
+ | BEVDet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | ONNX | 1532.157 ms | 284 - 295 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.onnx.zip) |
54
+ | BEVDet | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 635.531 ms | 333 - 333 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet.onnx.zip) |
55
+ | BEVDet | w8a16_mixed_fp16 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 2681.45 ms | 354 - 375 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet_w8a16_mixed_fp16.onnx.zip) |
56
+ | BEVDet | w8a16_mixed_fp16 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 2142.514 ms | 313 - 338 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet_w8a16_mixed_fp16.onnx.zip) |
57
+ | BEVDet | w8a16_mixed_fp16 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 1705.028 ms | 328 - 342 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet_w8a16_mixed_fp16.onnx.zip) |
58
+ | BEVDet | w8a16_mixed_fp16 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen5 Mobile | ONNX | 1635.254 ms | 307 - 321 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet_w8a16_mixed_fp16.onnx.zip) |
59
+ | BEVDet | w8a16_mixed_fp16 | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 967.514 ms | 1122 - 1122 MB | CPU | [BEVDet.onnx.zip](https://huggingface.co/qualcomm/BEVDet/blob/main/BEVDet_w8a16_mixed_fp16.onnx.zip) |
60
+
61
+
62
+
63
+
64
+ ## Installation
65
+
66
+
67
+ Install the package via pip:
68
+ ```bash
69
+ # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
70
+ pip install nuscenes-devkit==1.2.0 --no-deps
71
+ pip install "qai-hub-models[bevdet]"
72
+ ```
73
+
74
+
75
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
76
+
77
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
78
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
79
+
80
+ With this API token, you can configure your client to run models on the cloud
81
+ hosted devices.
82
+ ```bash
83
+ qai-hub configure --api_token API_TOKEN
84
+ ```
85
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
86
+
87
+
88
+
89
+ ## Demo off target
90
+
91
+ The package contains a simple end-to-end demo that downloads pre-trained
92
+ weights and runs this model on a sample input.
93
+
94
+ ```bash
95
+ python -m qai_hub_models.models.bevdet.demo
96
+ ```
97
+
98
+ The above demo runs a reference implementation of pre-processing, model
99
+ inference, and post processing.
100
+
101
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
102
+ environment, please add the following to your cell (instead of the above).
103
+ ```
104
+ %run -m qai_hub_models.models.bevdet.demo
105
+ ```
106
+
107
+
108
+ ### Run model on a cloud-hosted device
109
+
110
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
111
+ device. This script does the following:
112
+ * Performance check on-device on a cloud-hosted device
113
+ * Downloads compiled assets that can be deployed on-device for Android.
114
+ * Accuracy check between PyTorch and on-device outputs.
115
+
116
+ ```bash
117
+ python -m qai_hub_models.models.bevdet.export
118
+ ```
119
+
120
+
121
+
122
+ ## How does this work?
123
+
124
+ This [export script](https://aihub.qualcomm.com/models/bevdet/qai_hub_models/models/BEVDet/export.py)
125
+ leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
126
+ on-device. Lets go through each step below in detail:
127
+
128
+ Step 1: **Compile model for on-device deployment**
129
+
130
+ To compile a PyTorch model for on-device deployment, we first trace the model
131
+ in memory using the `jit.trace` and then call the `submit_compile_job` API.
132
+
133
+ ```python
134
+ import torch
135
+
136
+ import qai_hub as hub
137
+ from qai_hub_models.models.bevdet import Model
138
+
139
+ # Load the model
140
+ torch_model = Model.from_pretrained()
141
+
142
+ # Device
143
+ device = hub.Device("Samsung Galaxy S25")
144
+
145
+ # Trace model
146
+ input_shape = torch_model.get_input_spec()
147
+ sample_inputs = torch_model.sample_inputs()
148
+
149
+ pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
150
+
151
+ # Compile model on a specific device
152
+ compile_job = hub.submit_compile_job(
153
+ model=pt_model,
154
+ device=device,
155
+ input_specs=torch_model.get_input_spec(),
156
+ )
157
+
158
+ # Get target model to run on-device
159
+ target_model = compile_job.get_target_model()
160
+
161
+ ```
162
+
163
+
164
+ Step 2: **Performance profiling on cloud-hosted device**
165
+
166
+ After compiling models from step 1. Models can be profiled model on-device using the
167
+ `target_model`. Note that this scripts runs the model on a device automatically
168
+ provisioned in the cloud. Once the job is submitted, you can navigate to a
169
+ provided job URL to view a variety of on-device performance metrics.
170
+ ```python
171
+ profile_job = hub.submit_profile_job(
172
+ model=target_model,
173
+ device=device,
174
+ )
175
+
176
+ ```
177
+
178
+ Step 3: **Verify on-device accuracy**
179
+
180
+ To verify the accuracy of the model on-device, you can run on-device inference
181
+ on sample input data on the same cloud hosted device.
182
+ ```python
183
+ input_data = torch_model.sample_inputs()
184
+ inference_job = hub.submit_inference_job(
185
+ model=target_model,
186
+ device=device,
187
+ inputs=input_data,
188
+ )
189
+ on_device_output = inference_job.download_output_data()
190
+
191
+ ```
192
+ With the output of the model, you can compute like PSNR, relative errors or
193
+ spot check the output with expected output.
194
+
195
+ **Note**: This on-device profiling and inference requires access to Qualcomm®
196
+ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
197
+
198
+
199
+
200
+ ## Run demo on a cloud-hosted device
201
+
202
+ You can also run the demo on-device.
203
+
204
+ ```bash
205
+ python -m qai_hub_models.models.bevdet.demo --eval-mode on-device
206
+ ```
207
+
208
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
209
+ environment, please add the following to your cell (instead of the above).
210
+ ```
211
+ %run -m qai_hub_models.models.bevdet.demo -- --eval-mode on-device
212
+ ```
213
+
214
+
215
+ ## Deploying compiled model to Android
216
+
217
+
218
+ The models can be deployed using multiple runtimes:
219
+ - TensorFlow Lite (`.tflite` export): [This
220
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
221
+ guide to deploy the .tflite model in an Android application.
222
+
223
+
224
+ - QNN (`.so` export ): This [sample
225
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
226
+ provides instructions on how to use the `.so` shared library in an Android application.
227
+
228
+
229
+ ## View on Qualcomm® AI Hub
230
+ Get more details on BEVDet's performance across various devices [here](https://aihub.qualcomm.com/models/bevdet).
231
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
232
+
233
+
234
+ ## License
235
+ * The license for the original implementation of BEVDet can be found
236
+ [here](https://github.com/HuangJunJie2017/BEVDet/blob/dev3.0/LICENSE).
237
+ * 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)
238
+
239
+
240
+
241
+ ## References
242
+ * [BEVDet: High-Performance Multi-Camera 3D Object Detection in Bird-Eye-View](https://arxiv.org/abs/2112.11790)
243
+ * [Source Model Implementation](https://github.com/HuangJunJie2017/BEVDet/)
244
+
245
+
246
+
247
+ ## Community
248
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
249
+ * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
250
+
251
+
tool-versions.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tool_versions:
2
+ onnx:
3
+ onnx_runtime: 1.23.0