qaihm-bot commited on
Commit
a582ab2
·
verified ·
1 Parent(s): d8c5d28

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

PSPNet_float.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e641c06832d93969cc966a84019b941a14f01fb399edcf35d6e9cb4b08f93899
3
- size 263161228
 
 
 
 
PSPNet_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b4e7366490aaf7e95c7e9dcf56526e66fc8a4bce2bd98d2eb97afeac4559096d
3
- size 245551224
 
 
 
 
PSPNet_float.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5230f23ccf1e8362adf33f322c982450bd3dc785a079d086e75a79ea2a5b8d65
3
- size 262937848
 
 
 
 
README.md CHANGED
@@ -10,219 +10,75 @@ pipeline_tag: image-segmentation
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/pspnet/web-assets/model_demo.png)
12
 
13
- # PSPNet: Optimized for Mobile Deployment
14
- ## Deep learning model for pixel-level semantic segmentation using pyramid pooling
15
 
16
  PSPNet (Pyramid Scene Parsing Network) is a semantic segmentation model that captures global context information by applying pyramid pooling modules. It is designed to improve scene understanding by aggregating contextual features at multiple scales.
17
 
18
- This repository provides scripts to run PSPNet on Qualcomm® devices.
19
- More details on model performance across various devices, can be found
20
- [here](https://aihub.qualcomm.com/models/pspnet).
21
 
 
22
 
 
 
23
 
24
- ### Model Details
25
 
26
- - **Model Type:** Model_use_case.semantic_segmentation
27
- - **Model Stats:**
28
- - Model checkpoint: pspnet101_ade20k.pth
29
- - Input resolution: 1x3x473x473
30
- - Number of parameters: 65.7M
31
- - Model size (float): 251 MB
32
 
33
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
34
- |---|---|---|---|---|---|---|---|---|
35
- | PSPNet | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 1668.832 ms | 117 - 878 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
36
- | PSPNet | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 1501.062 ms | 0 - 681 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
37
- | PSPNet | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 1517.133 ms | 15 - 533 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
38
- | PSPNet | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 1115.893 ms | 3 - 400 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
39
- | PSPNet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 599.337 ms | 128 - 131 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
40
- | PSPNet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 593.125 ms | 3 - 5 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
41
- | PSPNet | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 1307.328 ms | 71 - 232 MB | NPU | [PSPNet.onnx.zip](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.onnx.zip) |
42
- | PSPNet | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 3023.934 ms | 119 - 878 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
43
- | PSPNet | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 646.417 ms | 0 - 682 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
44
- | PSPNet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 543.73 ms | 111 - 1069 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
45
- | PSPNet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 473.761 ms | 25 - 921 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
46
- | PSPNet | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 997.496 ms | 78 - 801 MB | NPU | [PSPNet.onnx.zip](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.onnx.zip) |
47
- | PSPNet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 375.278 ms | 110 - 864 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
48
- | PSPNet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 379.078 ms | 2 - 673 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
49
- | PSPNet | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 975.577 ms | 138 - 716 MB | NPU | [PSPNet.onnx.zip](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.onnx.zip) |
50
- | PSPNet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 320.19 ms | 67 - 829 MB | NPU | [PSPNet.tflite](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.tflite) |
51
- | PSPNet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 382.858 ms | 5 - 695 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
52
- | PSPNet | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 1048.343 ms | 13 - 604 MB | NPU | [PSPNet.onnx.zip](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.onnx.zip) |
53
- | PSPNet | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 601.791 ms | 3 - 3 MB | NPU | [PSPNet.dlc](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.dlc) |
54
- | PSPNet | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 1030.685 ms | 265 - 265 MB | NPU | [PSPNet.onnx.zip](https://huggingface.co/qualcomm/PSPNet/blob/main/PSPNet.onnx.zip) |
55
 
 
56
 
57
 
 
58
 
59
- ## Installation
 
 
 
60
 
 
61
 
62
- Install the package via pip:
63
- ```bash
64
- pip install qai-hub-models
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.pspnet.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.pspnet.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.pspnet.export
111
- ```
112
-
113
-
114
-
115
- ## How does this work?
116
-
117
- This [export script](https://aihub.qualcomm.com/models/pspnet/qai_hub_models/models/PSPNet/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.pspnet 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.pspnet.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.pspnet.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 PSPNet's performance across various devices [here](https://aihub.qualcomm.com/models/pspnet).
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 PSPNet can be found
@@ -230,9 +86,6 @@ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
230
 
231
 
232
 
233
-
234
  ## Community
235
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
236
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
237
-
238
-
 
10
 
11
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/pspnet/web-assets/model_demo.png)
12
 
13
+ # PSPNet: Optimized for Qualcomm Devices
 
14
 
15
  PSPNet (Pyramid Scene Parsing Network) is a semantic segmentation model that captures global context information by applying pyramid pooling modules. It is designed to improve scene understanding by aggregating contextual features at multiple scales.
16
 
17
+ 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/pspnet) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
 
 
18
 
19
+ 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.
20
 
21
+ ## Getting Started
22
+ There are two ways to deploy this model on your device:
23
 
24
+ ### Option 1: Download Pre-Exported Models
25
 
26
+ Below are pre-exported model assets ready for deployment.
 
 
 
 
 
27
 
28
+ | Runtime | Precision | Chipset | SDK Versions | Download |
29
+ |---|---|---|---|---|
30
+ | ONNX | float | Universal | QAIRT 2.37, ONNX Runtime 1.23.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/pspnet/releases/v0.46.1/pspnet-onnx-float.zip)
31
+ | QNN_DLC | float | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/pspnet/releases/v0.46.1/pspnet-qnn_dlc-float.zip)
32
+ | TFLITE | float | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/pspnet/releases/v0.46.1/pspnet-tflite-float.zip)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ For more device-specific assets and performance metrics, visit **[PSPNet on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/pspnet)**.
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/pspnet) 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 [PSPNet on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/pspnet) for usage instructions.
 
 
 
47
 
48
+ ## Model Details
49
 
50
+ **Model Type:** Model_use_case.semantic_segmentation
51
 
52
+ **Model Stats:**
53
+ - Model checkpoint: pspnet101_ade20k.pth
54
+ - Input resolution: 1x3x473x473
55
+ - Number of parameters: 65.7M
56
+ - Model size (float): 251 MB
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ ## Performance Summary
59
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
60
+ |---|---|---|---|---|---|---
61
+ | PSPNet | ONNX | float | Snapdragon® X Elite | 1029.088 ms | 265 - 265 MB | NPU
62
+ | PSPNet | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 1007.674 ms | 11 - 732 MB | NPU
63
+ | PSPNet | ONNX | float | Qualcomm® QCS8550 (Proxy) | 1313.456 ms | 0 - 160 MB | NPU
64
+ | PSPNet | ONNX | float | Qualcomm® QCS9075 | 1788.258 ms | 8 - 13 MB | NPU
65
+ | PSPNet | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 972.45 ms | 128 - 706 MB | NPU
66
+ | PSPNet | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 1063.045 ms | 11 - 605 MB | NPU
67
+ | PSPNet | QNN_DLC | float | Snapdragon® X Elite | 531.831 ms | 3 - 3 MB | NPU
68
+ | PSPNet | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 406.212 ms | 3 - 875 MB | NPU
69
+ | PSPNet | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 1333.575 ms | 0 - 718 MB | NPU
70
+ | PSPNet | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 584.235 ms | 3 - 5 MB | NPU
71
+ | PSPNet | QNN_DLC | float | Qualcomm® QCS9075 | 1751.221 ms | 3 - 135 MB | NPU
72
+ | PSPNet | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 1693.424 ms | 0 - 430 MB | NPU
73
+ | PSPNet | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 295.116 ms | 3 - 719 MB | NPU
74
+ | PSPNet | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 272.52 ms | 3 - 733 MB | NPU
75
+ | PSPNet | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 511.644 ms | 127 - 1180 MB | NPU
76
+ | PSPNet | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 1630.453 ms | 126 - 960 MB | NPU
77
+ | PSPNet | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 603.698 ms | 128 - 131 MB | NPU
78
+ | PSPNet | TFLITE | float | Qualcomm® QCS9075 | 1766.35 ms | 0 - 272 MB | NPU
79
+ | PSPNet | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 1561.127 ms | 53 - 628 MB | NPU
80
+ | PSPNet | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 977.818 ms | 116 - 871 MB | NPU
81
+ | PSPNet | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 323.794 ms | 0 - 836 MB | NPU
82
 
83
  ## License
84
  * The license for the original implementation of PSPNet can be found
 
86
 
87
 
88
 
 
89
  ## Community
90
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
91
  * 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