qaihm-bot commited on
Commit
d420746
·
verified ·
1 Parent(s): 2fe2c79

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

Files changed (1) hide show
  1. README.md +45 -216
README.md CHANGED
@@ -10,234 +10,63 @@ pipeline_tag: object-detection
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/rtmdet/web-assets/model_demo.png)
12
 
13
- # RTMDet: Optimized for Mobile Deployment
14
- ## Real-time object detection optimized for mobile and edge
15
-
16
 
17
  RTMDet is a highly efficient model for real-time object detection,capable of predicting both the bounding boxes and classes of objects within an image.It is highly optimized for real-time applications, making it reliable for industrial and commercial use
18
 
19
- This model is an implementation of RTMDet found [here](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet).
20
-
21
-
22
- This repository provides scripts to run RTMDet on Qualcomm® devices.
23
- More details on model performance across various devices, can be found
24
- [here](https://aihub.qualcomm.com/models/rtmdet).
25
-
26
- **WARNING**: The model assets are not readily available for download due to licensing restrictions.
27
-
28
- ### Model Details
29
-
30
- - **Model Type:** Model_use_case.object_detection
31
- - **Model Stats:**
32
- - Model checkpoint: RTMDet Medium
33
- - Input resolution: 640x640
34
- - Number of parameters: 27.5M
35
- - Model size (float): 105 MB
36
-
37
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
38
- |---|---|---|---|---|---|---|---|---|
39
- | RTMDet | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 84.135 ms | 0 - 179 MB | NPU | -- |
40
- | RTMDet | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 37.357 ms | 0 - 315 MB | NPU | -- |
41
- | RTMDet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 15.61 ms | 0 - 2 MB | NPU | -- |
42
- | RTMDet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 14.197 ms | 0 - 54 MB | NPU | -- |
43
- | RTMDet | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 23.01 ms | 0 - 179 MB | NPU | -- |
44
- | RTMDet | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 84.135 ms | 0 - 179 MB | NPU | -- |
45
- | RTMDet | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 30.077 ms | 0 - 234 MB | NPU | -- |
46
- | RTMDet | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 23.01 ms | 0 - 179 MB | NPU | -- |
47
- | RTMDet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 11.753 ms | 0 - 257 MB | NPU | -- |
48
- | RTMDet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 10.626 ms | 5 - 180 MB | NPU | -- |
49
- | RTMDet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 9.043 ms | 0 - 182 MB | NPU | -- |
50
- | RTMDet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 8.324 ms | 2 - 125 MB | NPU | -- |
51
- | RTMDet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 6.635 ms | 0 - 184 MB | NPU | -- |
52
- | RTMDet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 6.217 ms | 5 - 134 MB | NPU | -- |
53
- | RTMDet | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 14.534 ms | 51 - 51 MB | NPU | -- |
54
-
55
-
56
-
57
-
58
- ## Installation
59
-
60
-
61
- Install the package via pip:
62
- ```bash
63
- # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
64
- pip install "qai-hub-models[rtmdet]"
65
- ```
66
-
67
-
68
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
69
-
70
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
71
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
72
-
73
- With this API token, you can configure your client to run models on the cloud
74
- hosted devices.
75
- ```bash
76
- qai-hub configure --api_token API_TOKEN
77
- ```
78
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
79
-
80
-
81
-
82
- ## Demo off target
83
-
84
- The package contains a simple end-to-end demo that downloads pre-trained
85
- weights and runs this model on a sample input.
86
-
87
- ```bash
88
- python -m qai_hub_models.models.rtmdet.demo
89
- ```
90
-
91
- The above demo runs a reference implementation of pre-processing, model
92
- inference, and post processing.
93
-
94
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
95
- environment, please add the following to your cell (instead of the above).
96
- ```
97
- %run -m qai_hub_models.models.rtmdet.demo
98
- ```
99
-
100
-
101
- ### Run model on a cloud-hosted device
102
-
103
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
104
- device. This script does the following:
105
- * Performance check on-device on a cloud-hosted device
106
- * Downloads compiled assets that can be deployed on-device for Android.
107
- * Accuracy check between PyTorch and on-device outputs.
108
-
109
- ```bash
110
- python -m qai_hub_models.models.rtmdet.export
111
- ```
112
-
113
-
114
-
115
- ## How does this work?
116
-
117
- This [export script](https://aihub.qualcomm.com/models/rtmdet/qai_hub_models/models/RTMDet/export.py)
118
- leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
119
- on-device. Lets go through each step below in detail:
120
-
121
- Step 1: **Compile model for on-device deployment**
122
-
123
- To compile a PyTorch model for on-device deployment, we first trace the model
124
- in memory using the `jit.trace` and then call the `submit_compile_job` API.
125
-
126
- ```python
127
- import torch
128
-
129
- import qai_hub as hub
130
- from qai_hub_models.models.rtmdet import Model
131
-
132
- # Load the model
133
- torch_model = Model.from_pretrained()
134
-
135
- # Device
136
- device = hub.Device("Samsung Galaxy S25")
137
-
138
- # Trace model
139
- input_shape = torch_model.get_input_spec()
140
- sample_inputs = torch_model.sample_inputs()
141
-
142
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
143
-
144
- # Compile model on a specific device
145
- compile_job = hub.submit_compile_job(
146
- model=pt_model,
147
- device=device,
148
- input_specs=torch_model.get_input_spec(),
149
- )
150
-
151
- # Get target model to run on-device
152
- target_model = compile_job.get_target_model()
153
-
154
- ```
155
-
156
-
157
- Step 2: **Performance profiling on cloud-hosted device**
158
-
159
- After compiling models from step 1. Models can be profiled model on-device using the
160
- `target_model`. Note that this scripts runs the model on a device automatically
161
- provisioned in the cloud. Once the job is submitted, you can navigate to a
162
- provided job URL to view a variety of on-device performance metrics.
163
- ```python
164
- profile_job = hub.submit_profile_job(
165
- model=target_model,
166
- device=device,
167
- )
168
-
169
- ```
170
-
171
- Step 3: **Verify on-device accuracy**
172
-
173
- To verify the accuracy of the model on-device, you can run on-device inference
174
- on sample input data on the same cloud hosted device.
175
- ```python
176
- input_data = torch_model.sample_inputs()
177
- inference_job = hub.submit_inference_job(
178
- model=target_model,
179
- device=device,
180
- inputs=input_data,
181
- )
182
- on_device_output = inference_job.download_output_data()
183
-
184
- ```
185
- With the output of the model, you can compute like PSNR, relative errors or
186
- spot check the output with expected output.
187
-
188
- **Note**: This on-device profiling and inference requires access to Qualcomm®
189
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
190
-
191
-
192
-
193
- ## Run demo on a cloud-hosted device
194
-
195
- You can also run the demo on-device.
196
-
197
- ```bash
198
- python -m qai_hub_models.models.rtmdet.demo --eval-mode on-device
199
- ```
200
-
201
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
202
- environment, please add the following to your cell (instead of the above).
203
- ```
204
- %run -m qai_hub_models.models.rtmdet.demo -- --eval-mode on-device
205
- ```
206
-
207
-
208
- ## Deploying compiled model to Android
209
-
210
-
211
- The models can be deployed using multiple runtimes:
212
- - TensorFlow Lite (`.tflite` export): [This
213
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
214
- guide to deploy the .tflite model in an Android application.
215
-
216
-
217
- - QNN (`.so` export ): This [sample
218
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
219
- provides instructions on how to use the `.so` shared library in an Android application.
220
-
221
-
222
- ## View on Qualcomm® AI Hub
223
- Get more details on RTMDet's performance across various devices [here](https://aihub.qualcomm.com/models/rtmdet).
224
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
225
-
226
 
227
  ## License
228
  * The license for the original implementation of RTMDet can be found
229
  [here](https://github.com/open-mmlab/mmdetection/blob/3.x/LICENSE).
230
 
231
-
232
-
233
  ## References
234
  * [RTMDet: An Empirical Study of Designing Real-Time Object Detectors](https://github.com/open-mmlab/mmdetection/blob/3.x/README.md)
235
  * [Source Model Implementation](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet)
236
 
237
-
238
-
239
  ## Community
240
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
241
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
242
-
243
-
 
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/rtmdet/web-assets/model_demo.png)
12
 
13
+ # RTMDet: Optimized for Qualcomm Devices
 
 
14
 
15
  RTMDet is a highly efficient model for real-time object detection,capable of predicting both the bounding boxes and classes of objects within an image.It is highly optimized for real-time applications, making it reliable for industrial and commercial use
16
 
17
+ This is based on the implementation of RTMDet found [here](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet).
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/rtmdet) 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
+ Due to licensing restrictions, we cannot distribute pre-exported model assets for this model.
24
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/rtmdet) Python library to compile and export the model with your own:
25
+ - Custom weights (e.g., fine-tuned checkpoints)
26
+ - Custom input shapes
27
+ - Target device and runtime configurations
28
+
29
+ See our repository for [RTMDet on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/rtmdet) for usage instructions.
30
+
31
+
32
+ ## Model Details
33
+
34
+ **Model Type:** Model_use_case.object_detection
35
+
36
+ **Model Stats:**
37
+ - Model checkpoint: RTMDet Medium
38
+ - Input resolution: 640x640
39
+ - Number of parameters: 27.5M
40
+ - Model size (float): 105 MB
41
+
42
+ ## Performance Summary
43
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
44
+ |---|---|---|---|---|---|---
45
+ | RTMDet | ONNX | float | Snapdragon® X Elite | 14.503 ms | 51 - 51 MB | NPU
46
+ | RTMDet | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 10.617 ms | 5 - 178 MB | NPU
47
+ | RTMDet | ONNX | float | Qualcomm® QCS8550 (Proxy) | 14.209 ms | 5 - 7 MB | NPU
48
+ | RTMDet | ONNX | float | Qualcomm® QCS9075 | 24.305 ms | 5 - 12 MB | NPU
49
+ | RTMDet | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 8.341 ms | 1 - 127 MB | NPU
50
+ | RTMDet | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 6.26 ms | 5 - 136 MB | NPU
51
+ | RTMDet | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 11.853 ms | 0 - 284 MB | NPU
52
+ | RTMDet | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 83.912 ms | 0 - 208 MB | NPU
53
+ | RTMDet | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 15.707 ms | 0 - 4 MB | NPU
54
+ | RTMDet | TFLITE | float | Qualcomm® SA8775P | 22.95 ms | 0 - 208 MB | NPU
55
+ | RTMDet | TFLITE | float | Qualcomm® QCS9075 | 24.718 ms | 0 - 62 MB | NPU
56
+ | RTMDet | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 38.102 ms | 0 - 348 MB | NPU
57
+ | RTMDet | TFLITE | float | Qualcomm® SA7255P | 83.912 ms | 0 - 208 MB | NPU
58
+ | RTMDet | TFLITE | float | Qualcomm® SA8295P | 30.0 ms | 0 - 269 MB | NPU
59
+ | RTMDet | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 9.21 ms | 0 - 210 MB | NPU
60
+ | RTMDet | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 6.713 ms | 0 - 206 MB | NPU
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  ## License
63
  * The license for the original implementation of RTMDet can be found
64
  [here](https://github.com/open-mmlab/mmdetection/blob/3.x/LICENSE).
65
 
 
 
66
  ## References
67
  * [RTMDet: An Empirical Study of Designing Real-Time Object Detectors](https://github.com/open-mmlab/mmdetection/blob/3.x/README.md)
68
  * [Source Model Implementation](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet)
69
 
 
 
70
  ## Community
71
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
72
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).