Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -35,48 +35,47 @@ More details on model performance across various devices, can be found
|
|
35 |
|
36 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
37 |
|---|---|---|---|---|---|---|---|---|
|
38 |
-
| Midas-V2-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 1.
|
39 |
| Midas-V2-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 1.439 ms | 0 - 64 MB | INT8 | NPU | [Midas-V2-Quantized.so](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.so) |
|
40 |
-
| Midas-V2-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 9.
|
41 |
-
| Midas-V2-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.
|
42 |
-
| Midas-V2-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 1.
|
43 |
-
| Midas-V2-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 7.
|
44 |
-
| Midas-V2-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.
|
45 |
-
| Midas-V2-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN |
|
46 |
-
| Midas-V2-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 7.
|
47 |
-
| Midas-V2-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 3.
|
48 |
-
| Midas-V2-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 5.
|
49 |
-
| Midas-V2-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 15.
|
50 |
-
| Midas-V2-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 1.
|
51 |
-
| Midas-V2-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 1.
|
52 |
-
| Midas-V2-Quantized | SA7255P ADP | SA7255P | TFLITE |
|
53 |
-
| Midas-V2-Quantized | SA7255P ADP | SA7255P | QNN | 12.
|
54 |
-
| Midas-V2-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 1.
|
55 |
-
| Midas-V2-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 1.
|
56 |
-
| Midas-V2-Quantized | SA8295P ADP | SA8295P | TFLITE | 1.
|
57 |
-
| Midas-V2-Quantized | SA8295P ADP | SA8295P | QNN | 2.
|
58 |
-
| Midas-V2-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 1.
|
59 |
-
| Midas-V2-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 1.
|
60 |
-
| Midas-V2-Quantized | SA8775P ADP | SA8775P | TFLITE | 1.
|
61 |
-
| Midas-V2-Quantized | SA8775P ADP | SA8775P | QNN | 2.
|
62 |
-
| Midas-V2-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 1.
|
63 |
-
| Midas-V2-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 1.
|
64 |
-
| Midas-V2-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 1.
|
65 |
-
| Midas-V2-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 8.
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
## Installation
|
71 |
|
72 |
-
This model can be installed as a Python package via pip.
|
73 |
|
|
|
74 |
```bash
|
75 |
-
pip install "qai-hub-models[
|
76 |
```
|
77 |
|
78 |
|
79 |
-
|
80 |
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
81 |
|
82 |
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
@@ -128,12 +127,88 @@ Midas-V2-Quantized
|
|
128 |
Device : Samsung Galaxy S23 (13)
|
129 |
Runtime : TFLITE
|
130 |
Estimated inference time (ms) : 1.1
|
131 |
-
Estimated peak memory usage (MB): [0,
|
132 |
Total # Ops : 145
|
133 |
Compute Unit(s) : NPU (145 ops)
|
134 |
```
|
135 |
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
|
139 |
## Run demo on a cloud-hosted device
|
@@ -171,7 +246,8 @@ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
|
171 |
|
172 |
|
173 |
## License
|
174 |
-
* The license for the original implementation of Midas-V2-Quantized can be found
|
|
|
175 |
* 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)
|
176 |
|
177 |
|
|
|
35 |
|
36 |
| Model | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
|
37 |
|---|---|---|---|---|---|---|---|---|
|
38 |
+
| Midas-V2-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | TFLITE | 1.097 ms | 0 - 60 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
39 |
| Midas-V2-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | QNN | 1.439 ms | 0 - 64 MB | INT8 | NPU | [Midas-V2-Quantized.so](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.so) |
|
40 |
+
| Midas-V2-Quantized | Samsung Galaxy S23 | Snapdragon® 8 Gen 2 | ONNX | 9.111 ms | 0 - 80 MB | INT8 | NPU | [Midas-V2-Quantized.onnx](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.onnx) |
|
41 |
+
| Midas-V2-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | TFLITE | 0.76 ms | 0 - 35 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
42 |
+
| Midas-V2-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | QNN | 1.012 ms | 0 - 27 MB | INT8 | NPU | [Midas-V2-Quantized.so](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.so) |
|
43 |
+
| Midas-V2-Quantized | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 | ONNX | 7.0 ms | 0 - 144 MB | INT8 | NPU | [Midas-V2-Quantized.onnx](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.onnx) |
|
44 |
+
| Midas-V2-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | TFLITE | 0.723 ms | 0 - 32 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
45 |
+
| Midas-V2-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | QNN | 0.976 ms | 0 - 29 MB | INT8 | NPU | Use Export Script |
|
46 |
+
| Midas-V2-Quantized | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite | ONNX | 7.494 ms | 0 - 130 MB | INT8 | NPU | [Midas-V2-Quantized.onnx](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.onnx) |
|
47 |
+
| Midas-V2-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | TFLITE | 3.796 ms | 0 - 27 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
48 |
+
| Midas-V2-Quantized | RB3 Gen 2 (Proxy) | QCS6490 Proxy | QNN | 5.825 ms | 0 - 12 MB | INT8 | NPU | Use Export Script |
|
49 |
+
| Midas-V2-Quantized | RB5 (Proxy) | QCS8250 Proxy | TFLITE | 15.706 ms | 0 - 3 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
50 |
+
| Midas-V2-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | TFLITE | 1.097 ms | 0 - 59 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
51 |
+
| Midas-V2-Quantized | QCS8550 (Proxy) | QCS8550 Proxy | QNN | 1.318 ms | 0 - 3 MB | INT8 | NPU | Use Export Script |
|
52 |
+
| Midas-V2-Quantized | SA7255P ADP | SA7255P | TFLITE | 10.93 ms | 0 - 22 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
53 |
+
| Midas-V2-Quantized | SA7255P ADP | SA7255P | QNN | 12.132 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
54 |
+
| Midas-V2-Quantized | SA8255 (Proxy) | SA8255P Proxy | TFLITE | 1.099 ms | 0 - 48 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
55 |
+
| Midas-V2-Quantized | SA8255 (Proxy) | SA8255P Proxy | QNN | 1.342 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
|
56 |
+
| Midas-V2-Quantized | SA8295P ADP | SA8295P | TFLITE | 1.948 ms | 0 - 29 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
57 |
+
| Midas-V2-Quantized | SA8295P ADP | SA8295P | QNN | 2.531 ms | 0 - 14 MB | INT8 | NPU | Use Export Script |
|
58 |
+
| Midas-V2-Quantized | SA8650 (Proxy) | SA8650P Proxy | TFLITE | 1.096 ms | 0 - 60 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
59 |
+
| Midas-V2-Quantized | SA8650 (Proxy) | SA8650P Proxy | QNN | 1.327 ms | 0 - 2 MB | INT8 | NPU | Use Export Script |
|
60 |
+
| Midas-V2-Quantized | SA8775P ADP | SA8775P | TFLITE | 1.611 ms | 0 - 22 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
61 |
+
| Midas-V2-Quantized | SA8775P ADP | SA8775P | QNN | 2.122 ms | 0 - 10 MB | INT8 | NPU | Use Export Script |
|
62 |
+
| Midas-V2-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | TFLITE | 1.427 ms | 0 - 33 MB | INT8 | NPU | [Midas-V2-Quantized.tflite](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.tflite) |
|
63 |
+
| Midas-V2-Quantized | QCS8450 (Proxy) | QCS8450 Proxy | QNN | 1.859 ms | 0 - 30 MB | INT8 | NPU | Use Export Script |
|
64 |
+
| Midas-V2-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN | 1.465 ms | 0 - 0 MB | INT8 | NPU | Use Export Script |
|
65 |
+
| Midas-V2-Quantized | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 8.898 ms | 23 - 23 MB | INT8 | NPU | [Midas-V2-Quantized.onnx](https://huggingface.co/qualcomm/Midas-V2-Quantized/blob/main/Midas-V2-Quantized.onnx) |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
## Installation
|
71 |
|
|
|
72 |
|
73 |
+
Install the package via pip:
|
74 |
```bash
|
75 |
+
pip install "qai-hub-models[midas-quantized]"
|
76 |
```
|
77 |
|
78 |
|
|
|
79 |
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
80 |
|
81 |
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
|
|
127 |
Device : Samsung Galaxy S23 (13)
|
128 |
Runtime : TFLITE
|
129 |
Estimated inference time (ms) : 1.1
|
130 |
+
Estimated peak memory usage (MB): [0, 60]
|
131 |
Total # Ops : 145
|
132 |
Compute Unit(s) : NPU (145 ops)
|
133 |
```
|
134 |
|
135 |
|
136 |
+
## How does this work?
|
137 |
+
|
138 |
+
This [export script](https://aihub.qualcomm.com/models/midas_quantized/qai_hub_models/models/Midas-V2-Quantized/export.py)
|
139 |
+
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
140 |
+
on-device. Lets go through each step below in detail:
|
141 |
+
|
142 |
+
Step 1: **Compile model for on-device deployment**
|
143 |
+
|
144 |
+
To compile a PyTorch model for on-device deployment, we first trace the model
|
145 |
+
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
146 |
+
|
147 |
+
```python
|
148 |
+
import torch
|
149 |
+
|
150 |
+
import qai_hub as hub
|
151 |
+
from qai_hub_models.models.midas_quantized import Model
|
152 |
+
|
153 |
+
# Load the model
|
154 |
+
torch_model = Model.from_pretrained()
|
155 |
+
|
156 |
+
# Device
|
157 |
+
device = hub.Device("Samsung Galaxy S24")
|
158 |
+
|
159 |
+
# Trace model
|
160 |
+
input_shape = torch_model.get_input_spec()
|
161 |
+
sample_inputs = torch_model.sample_inputs()
|
162 |
+
|
163 |
+
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
164 |
+
|
165 |
+
# Compile model on a specific device
|
166 |
+
compile_job = hub.submit_compile_job(
|
167 |
+
model=pt_model,
|
168 |
+
device=device,
|
169 |
+
input_specs=torch_model.get_input_spec(),
|
170 |
+
)
|
171 |
+
|
172 |
+
# Get target model to run on-device
|
173 |
+
target_model = compile_job.get_target_model()
|
174 |
+
|
175 |
+
```
|
176 |
+
|
177 |
+
|
178 |
+
Step 2: **Performance profiling on cloud-hosted device**
|
179 |
+
|
180 |
+
After compiling models from step 1. Models can be profiled model on-device using the
|
181 |
+
`target_model`. Note that this scripts runs the model on a device automatically
|
182 |
+
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
183 |
+
provided job URL to view a variety of on-device performance metrics.
|
184 |
+
```python
|
185 |
+
profile_job = hub.submit_profile_job(
|
186 |
+
model=target_model,
|
187 |
+
device=device,
|
188 |
+
)
|
189 |
+
|
190 |
+
```
|
191 |
+
|
192 |
+
Step 3: **Verify on-device accuracy**
|
193 |
+
|
194 |
+
To verify the accuracy of the model on-device, you can run on-device inference
|
195 |
+
on sample input data on the same cloud hosted device.
|
196 |
+
```python
|
197 |
+
input_data = torch_model.sample_inputs()
|
198 |
+
inference_job = hub.submit_inference_job(
|
199 |
+
model=target_model,
|
200 |
+
device=device,
|
201 |
+
inputs=input_data,
|
202 |
+
)
|
203 |
+
on_device_output = inference_job.download_output_data()
|
204 |
+
|
205 |
+
```
|
206 |
+
With the output of the model, you can compute like PSNR, relative errors or
|
207 |
+
spot check the output with expected output.
|
208 |
+
|
209 |
+
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
210 |
+
AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
211 |
+
|
212 |
|
213 |
|
214 |
## Run demo on a cloud-hosted device
|
|
|
246 |
|
247 |
|
248 |
## License
|
249 |
+
* The license for the original implementation of Midas-V2-Quantized can be found
|
250 |
+
[here](https://github.com/isl-org/MiDaS/blob/master/LICENSE).
|
251 |
* 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)
|
252 |
|
253 |
|