qaihm-bot commited on
Commit
9ba7759
·
verified ·
1 Parent(s): 45f4d8e

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

Files changed (3) hide show
  1. DeformableDETR_float.onnx.zip +0 -3
  2. README.md +39 -190
  3. tool-versions.yaml +0 -4
DeformableDETR_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:05fe1bf071c41d3f44356c6592b880007287c69d5125a15e75180e9cefbb84ef
3
- size 152083417
 
 
 
 
README.md CHANGED
@@ -10,223 +10,72 @@ pipeline_tag: object-detection
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/deformable_detr/web-assets/model_demo.png)
12
 
13
- # DeformableDETR: Optimized for Mobile Deployment
14
- ## Transformer based object detector with ResNet-50 backbone
15
-
16
 
17
  Deformable DETR is a machine learning model that can detect objects (trained on COCO dataset).
18
 
19
- This model is an implementation of DeformableDETR found [here](https://github.com/fundamentalvision/Deformable-DETR).
20
-
21
-
22
- This repository provides scripts to run DeformableDETR on Qualcomm® devices.
23
- More details on model performance across various devices, can be found
24
- [here](https://aihub.qualcomm.com/models/deformable_detr).
25
-
26
-
27
-
28
- ### Model Details
29
-
30
- - **Model Type:** Model_use_case.object_detection
31
- - **Model Stats:**
32
- - Model checkpoint: deformable-detr
33
- - Input resolution: 480x480
34
- - Number of parameters: 40M
35
- - Model size: 160 MB
36
-
37
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
38
- |---|---|---|---|---|---|---|---|---|
39
- | DeformableDETR | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 1227.951 ms | 96 - 1466 MB | NPU | [DeformableDETR.onnx.zip](https://huggingface.co/qualcomm/DeformableDETR/blob/main/DeformableDETR.onnx.zip) |
40
- | DeformableDETR | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 937.308 ms | 136 - 1019 MB | NPU | [DeformableDETR.onnx.zip](https://huggingface.co/qualcomm/DeformableDETR/blob/main/DeformableDETR.onnx.zip) |
41
- | DeformableDETR | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 759.347 ms | 181 - 1103 MB | NPU | [DeformableDETR.onnx.zip](https://huggingface.co/qualcomm/DeformableDETR/blob/main/DeformableDETR.onnx.zip) |
42
- | DeformableDETR | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 1436.618 ms | 132 - 132 MB | NPU | [DeformableDETR.onnx.zip](https://huggingface.co/qualcomm/DeformableDETR/blob/main/DeformableDETR.onnx.zip) |
43
-
44
-
45
-
46
-
47
- ## Installation
48
-
49
-
50
- Install the package via pip:
51
- ```bash
52
- # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
53
- pip install "qai-hub-models[deformable-detr]"
54
- ```
55
-
56
-
57
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
58
-
59
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
60
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
61
-
62
- With this API token, you can configure your client to run models on the cloud
63
- hosted devices.
64
- ```bash
65
- qai-hub configure --api_token API_TOKEN
66
- ```
67
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
68
-
69
-
70
-
71
- ## Demo off target
72
-
73
- The package contains a simple end-to-end demo that downloads pre-trained
74
- weights and runs this model on a sample input.
75
-
76
- ```bash
77
- python -m qai_hub_models.models.deformable_detr.demo
78
- ```
79
-
80
- The above demo runs a reference implementation of pre-processing, model
81
- inference, and post processing.
82
-
83
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
84
- environment, please add the following to your cell (instead of the above).
85
- ```
86
- %run -m qai_hub_models.models.deformable_detr.demo
87
- ```
88
-
89
-
90
- ### Run model on a cloud-hosted device
91
-
92
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
93
- device. This script does the following:
94
- * Performance check on-device on a cloud-hosted device
95
- * Downloads compiled assets that can be deployed on-device for Android.
96
- * Accuracy check between PyTorch and on-device outputs.
97
-
98
- ```bash
99
- python -m qai_hub_models.models.deformable_detr.export
100
- ```
101
 
 
102
 
 
 
103
 
104
- ## How does this work?
105
 
106
- This [export script](https://aihub.qualcomm.com/models/deformable_detr/qai_hub_models/models/DeformableDETR/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.deformable_detr import Model
120
 
121
- # Load the model
122
- torch_model = Model.from_pretrained()
 
 
123
 
124
- # Device
125
- device = hub.Device("Samsung Galaxy S25")
126
 
127
- # Trace model
128
- input_shape = torch_model.get_input_spec()
129
- sample_inputs = torch_model.sample_inputs()
130
 
131
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
132
 
133
- # Compile model on a specific device
134
- compile_job = hub.submit_compile_job(
135
- model=pt_model,
136
- device=device,
137
- input_specs=torch_model.get_input_spec(),
138
- )
139
 
140
- # Get target model to run on-device
141
- target_model = compile_job.get_target_model()
142
-
143
- ```
144
-
145
-
146
- Step 2: **Performance profiling on cloud-hosted device**
147
-
148
- After compiling models from step 1. Models can be profiled model on-device using the
149
- `target_model`. Note that this scripts runs the model on a device automatically
150
- provisioned in the cloud. Once the job is submitted, you can navigate to a
151
- provided job URL to view a variety of on-device performance metrics.
152
- ```python
153
- profile_job = hub.submit_profile_job(
154
- model=target_model,
155
- device=device,
156
- )
157
-
158
- ```
159
-
160
- Step 3: **Verify on-device accuracy**
161
-
162
- To verify the accuracy of the model on-device, you can run on-device inference
163
- on sample input data on the same cloud hosted device.
164
- ```python
165
- input_data = torch_model.sample_inputs()
166
- inference_job = hub.submit_inference_job(
167
- model=target_model,
168
- device=device,
169
- inputs=input_data,
170
- )
171
- on_device_output = inference_job.download_output_data()
172
-
173
- ```
174
- With the output of the model, you can compute like PSNR, relative errors or
175
- spot check the output with expected output.
176
-
177
- **Note**: This on-device profiling and inference requires access to Qualcomm®
178
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
179
-
180
-
181
-
182
- ## Run demo on a cloud-hosted device
183
-
184
- You can also run the demo on-device.
185
-
186
- ```bash
187
- python -m qai_hub_models.models.deformable_detr.demo --eval-mode on-device
188
- ```
189
-
190
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
191
- environment, please add the following to your cell (instead of the above).
192
- ```
193
- %run -m qai_hub_models.models.deformable_detr.demo -- --eval-mode on-device
194
- ```
195
-
196
-
197
- ## Deploying compiled model to Android
198
-
199
-
200
- The models can be deployed using multiple runtimes:
201
- - TensorFlow Lite (`.tflite` export): [This
202
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
203
- guide to deploy the .tflite model in an Android application.
204
-
205
-
206
- - QNN (`.so` export ): This [sample
207
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
208
- provides instructions on how to use the `.so` shared library in an Android application.
209
-
210
-
211
- ## View on Qualcomm® AI Hub
212
- Get more details on DeformableDETR's performance across various devices [here](https://aihub.qualcomm.com/models/deformable_detr).
213
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
214
 
 
 
 
 
 
 
 
 
 
 
 
 
215
 
216
  ## License
217
  * The license for the original implementation of DeformableDETR can be found
218
  [here](https://github.com/facebookresearch/detr/blob/main/LICENSE).
219
 
220
-
221
-
222
  ## References
223
  * [Deformable DETR: Deformable Transformers for End-to-End Object Detection](https://arxiv.org/abs/2010.04159)
224
  * [Source Model Implementation](https://github.com/fundamentalvision/Deformable-DETR)
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:ai-hub-support@qti.qualcomm.com).
231
-
232
-
 
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/deformable_detr/web-assets/model_demo.png)
12
 
13
+ # DeformableDETR: Optimized for Qualcomm Devices
 
 
14
 
15
  Deformable DETR is a machine learning model that can detect objects (trained on COCO dataset).
16
 
17
+ This is based on the implementation of DeformableDETR found [here](https://github.com/fundamentalvision/Deformable-DETR).
18
+ This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/deformable_detr) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) to run these models on a hosted Qualcomm® device.
21
 
22
+ ## Getting Started
23
+ There are two ways to deploy this model on your device:
24
 
25
+ ### Option 1: Download Pre-Exported Models
26
 
27
+ Below are pre-exported model assets ready for deployment.
 
 
28
 
29
+ | Runtime | Precision | Chipset | SDK Versions | Download |
30
+ |---|---|---|---|---|
31
+ | ONNX | float | Universal | QAIRT 2.42, ONNX Runtime 1.24.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/deformable_detr/releases/v0.47.0/deformable_detr-onnx-float.zip)
32
+ | ONNX | w8a16 | Universal | QAIRT 2.42, ONNX Runtime 1.24.1 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/deformable_detr/releases/v0.47.0/deformable_detr-onnx-w8a16.zip)
33
 
34
+ For more device-specific assets and performance metrics, visit **[DeformableDETR on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/deformable_detr)**.
 
35
 
 
 
36
 
37
+ ### Option 2: Export with Custom Configurations
 
38
 
39
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/deformable_detr) Python library to compile and export the model with your own:
40
+ - Custom weights (e.g., fine-tuned checkpoints)
41
+ - Custom input shapes
42
+ - Target device and runtime configurations
43
 
44
+ This option is ideal if you need to customize the model beyond the default configuration provided here.
 
45
 
46
+ See our repository for [DeformableDETR on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/deformable_detr) for usage instructions.
 
 
47
 
48
+ ## Model Details
49
 
50
+ **Model Type:** Model_use_case.object_detection
 
 
 
 
 
51
 
52
+ **Model Stats:**
53
+ - Model checkpoint: deformable-detr
54
+ - Input resolution: 480x480
55
+ - Number of parameters: 40M
56
+ - Model size: 160 MB
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ ## Performance Summary
59
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
60
+ |---|---|---|---|---|---|---
61
+ | DeformableDETR | ONNX | w8a16 | Snapdragon® X Elite | 2795.423 ms | 90 - 90 MB | NPU
62
+ | DeformableDETR | ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 2355.274 ms | 67 - 2032 MB | NPU
63
+ | DeformableDETR | ONNX | w8a16 | Qualcomm® QCS6490 | 7549.381 ms | 1052 - 1059 MB | CPU
64
+ | DeformableDETR | ONNX | w8a16 | Qualcomm® QCS9075 | 3049.633 ms | 62 - 67 MB | NPU
65
+ | DeformableDETR | ONNX | w8a16 | Qualcomm® QCM6690 | 4179.147 ms | 1030 - 1052 MB | CPU
66
+ | DeformableDETR | ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 1684.91 ms | 63 - 1330 MB | NPU
67
+ | DeformableDETR | ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 3776.96 ms | 1044 - 1067 MB | CPU
68
+ | DeformableDETR | ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 1412.598 ms | 65 - 1358 MB | NPU
69
+ | DeformableDETR | ONNX | w8a16 | Snapdragon® X2 Elite | 1632.94 ms | 93 - 93 MB | NPU
70
 
71
  ## License
72
  * The license for the original implementation of DeformableDETR can be found
73
  [here](https://github.com/facebookresearch/detr/blob/main/LICENSE).
74
 
 
 
75
  ## References
76
  * [Deformable DETR: Deformable Transformers for End-to-End Object Detection](https://arxiv.org/abs/2010.04159)
77
  * [Source Model Implementation](https://github.com/fundamentalvision/Deformable-DETR)
78
 
 
 
79
  ## Community
80
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
81
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
 
tool-versions.yaml DELETED
@@ -1,4 +0,0 @@
1
- tool_versions:
2
- onnx:
3
- qairt: 2.37.1.250807093845_124904
4
- onnx_runtime: 1.23.0