qaihm-bot commited on
Commit
e9490c7
·
verified ·
1 Parent(s): 0abfa3e

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

Midas-V2_float.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6cf0bc45e22463a032d5eafea58009c29564c57798d11be095291c3473725f6a
3
- size 66501540
 
 
 
 
Midas-V2_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:335b6adaf40657b84737e2b6e10c0a2b0479435e8fd7c3735e9f2c09446af949
3
- size 61725940
 
 
 
 
Midas-V2_float.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f5f3df2a8a5625e99ba532dd34cd628dbda89c730a59cc823f7e7234bb4db4a5
3
- size 66306460
 
 
 
 
Midas-V2_w8a8.dlc DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:48ecc1055c8c21cb2f4d7a224c238c1b6dd771806f0cdfc9b0c7d5db901092db
3
- size 19262308
 
 
 
 
Midas-V2_w8a8.tflite DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2b725df572b6eb91ba304326e4ab82e59c467c7c705cfcc6e60084abf29dc048
3
- size 17749016
 
 
 
 
README.md CHANGED
@@ -9,273 +9,121 @@ pipeline_tag: depth-estimation
9
 
10
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/midas/web-assets/model_demo.png)
11
 
12
- # Midas-V2: Optimized for Mobile Deployment
13
- ## Deep Convolutional Neural Network model for depth estimation
14
-
15
 
16
  Midas is designed for estimating depth at each point in an image.
17
 
18
- This model is an implementation of Midas-V2 found [here](https://github.com/isl-org/MiDaS).
19
-
20
-
21
- This repository provides scripts to run Midas-V2 on Qualcomm® devices.
22
- More details on model performance across various devices, can be found
23
- [here](https://aihub.qualcomm.com/models/midas).
24
-
25
-
26
-
27
- ### Model Details
28
-
29
- - **Model Type:** Model_use_case.depth_estimation
30
- - **Model Stats:**
31
- - Model checkpoint: MiDaS_small
32
- - Input resolution: 256x256
33
- - Number of parameters: 16.6M
34
- - Model size (float): 63.2 MB
35
- - Model size (w8a8): 16.9 MB
36
-
37
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
38
- |---|---|---|---|---|---|---|---|---|
39
- | Midas-V2 | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 11.992 ms | 0 - 154 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
40
- | Midas-V2 | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 11.941 ms | 1 - 136 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
41
- | Midas-V2 | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 7.437 ms | 0 - 196 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
42
- | Midas-V2 | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 7.415 ms | 1 - 171 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
43
- | Midas-V2 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 2.995 ms | 0 - 2 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
44
- | Midas-V2 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 3.012 ms | 1 - 3 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
45
- | Midas-V2 | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 3.03 ms | 0 - 41 MB | NPU | [Midas-V2.onnx.zip](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.onnx.zip) |
46
- | Midas-V2 | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 4.213 ms | 0 - 153 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
47
- | Midas-V2 | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 4.202 ms | 1 - 136 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
48
- | Midas-V2 | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 11.992 ms | 0 - 154 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
49
- | Midas-V2 | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 11.941 ms | 1 - 136 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
50
- | Midas-V2 | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 5.349 ms | 0 - 139 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
51
- | Midas-V2 | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 5.34 ms | 1 - 138 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
52
- | Midas-V2 | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 4.213 ms | 0 - 153 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
53
- | Midas-V2 | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 4.202 ms | 1 - 136 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
54
- | Midas-V2 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 2.097 ms | 0 - 206 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
55
- | Midas-V2 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 2.094 ms | 1 - 174 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
56
- | Midas-V2 | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 2.108 ms | 0 - 151 MB | NPU | [Midas-V2.onnx.zip](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.onnx.zip) |
57
- | Midas-V2 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 1.545 ms | 0 - 160 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
58
- | Midas-V2 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 1.539 ms | 1 - 137 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
59
- | Midas-V2 | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 1.683 ms | 0 - 111 MB | NPU | [Midas-V2.onnx.zip](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.onnx.zip) |
60
- | Midas-V2 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 1.322 ms | 0 - 159 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.tflite) |
61
- | Midas-V2 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 1.326 ms | 1 - 139 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
62
- | Midas-V2 | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 1.422 ms | 0 - 110 MB | NPU | [Midas-V2.onnx.zip](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.onnx.zip) |
63
- | Midas-V2 | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 3.223 ms | 1 - 1 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.dlc) |
64
- | Midas-V2 | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 2.901 ms | 36 - 36 MB | NPU | [Midas-V2.onnx.zip](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2.onnx.zip) |
65
- | Midas-V2 | w8a8 | Dragonwing Q-6690 MTP | Qualcomm® QCM6690 | TFLITE | 8.456 ms | 0 - 153 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
66
- | Midas-V2 | w8a8 | Dragonwing Q-6690 MTP | Qualcomm® QCM6690 | QNN_DLC | 9.111 ms | 0 - 153 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
67
- | Midas-V2 | w8a8 | Dragonwing RB3 Gen 2 Vision Kit | Qualcomm® QCS6490 | TFLITE | 3.632 ms | 0 - 28 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
68
- | Midas-V2 | w8a8 | Dragonwing RB3 Gen 2 Vision Kit | Qualcomm® QCS6490 | QNN_DLC | 4.203 ms | 0 - 2 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
69
- | Midas-V2 | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 2.51 ms | 0 - 137 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
70
- | Midas-V2 | w8a8 | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 2.961 ms | 0 - 139 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
71
- | Midas-V2 | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 1.591 ms | 0 - 176 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
72
- | Midas-V2 | w8a8 | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 1.902 ms | 0 - 181 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
73
- | Midas-V2 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 1.029 ms | 0 - 2 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
74
- | Midas-V2 | w8a8 | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 1.274 ms | 0 - 2 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
75
- | Midas-V2 | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 1.372 ms | 0 - 137 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
76
- | Midas-V2 | w8a8 | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 1.597 ms | 0 - 139 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
77
- | Midas-V2 | w8a8 | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 2.51 ms | 0 - 137 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
78
- | Midas-V2 | w8a8 | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 2.961 ms | 0 - 139 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
79
- | Midas-V2 | w8a8 | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 1.956 ms | 0 - 143 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
80
- | Midas-V2 | w8a8 | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 2.237 ms | 0 - 146 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
81
- | Midas-V2 | w8a8 | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 1.372 ms | 0 - 137 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
82
- | Midas-V2 | w8a8 | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 1.597 ms | 0 - 139 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
83
- | Midas-V2 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 0.753 ms | 0 - 180 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
84
- | Midas-V2 | w8a8 | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 0.916 ms | 0 - 178 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
85
- | Midas-V2 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 0.597 ms | 0 - 138 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
86
- | Midas-V2 | w8a8 | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 0.679 ms | 0 - 143 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
87
- | Midas-V2 | w8a8 | Snapdragon 7 Gen 4 QRD | Snapdragon® 7 Gen 4 Mobile | TFLITE | 1.363 ms | 0 - 152 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
88
- | Midas-V2 | w8a8 | Snapdragon 7 Gen 4 QRD | Snapdragon® 7 Gen 4 Mobile | QNN_DLC | 1.556 ms | 0 - 153 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
89
- | Midas-V2 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 0.494 ms | 0 - 139 MB | NPU | [Midas-V2.tflite](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.tflite) |
90
- | Midas-V2 | w8a8 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 0.562 ms | 0 - 143 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
91
- | Midas-V2 | w8a8 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 1.456 ms | 0 - 0 MB | NPU | [Midas-V2.dlc](https://huggingface.co/qualcomm/Midas-V2/blob/main/Midas-V2_w8a8.dlc) |
92
-
93
-
94
-
95
-
96
- ## Installation
97
-
98
-
99
- Install the package via pip:
100
- ```bash
101
- # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
102
- pip install "qai-hub-models[midas]"
103
- ```
104
-
105
-
106
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
107
-
108
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
109
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
110
-
111
- With this API token, you can configure your client to run models on the cloud
112
- hosted devices.
113
- ```bash
114
- qai-hub configure --api_token API_TOKEN
115
- ```
116
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
117
-
118
-
119
-
120
- ## Demo off target
121
-
122
- The package contains a simple end-to-end demo that downloads pre-trained
123
- weights and runs this model on a sample input.
124
-
125
- ```bash
126
- python -m qai_hub_models.models.midas.demo
127
- ```
128
-
129
- The above demo runs a reference implementation of pre-processing, model
130
- inference, and post processing.
131
-
132
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
133
- environment, please add the following to your cell (instead of the above).
134
- ```
135
- %run -m qai_hub_models.models.midas.demo
136
- ```
137
-
138
-
139
- ### Run model on a cloud-hosted device
140
-
141
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
142
- device. This script does the following:
143
- * Performance check on-device on a cloud-hosted device
144
- * Downloads compiled assets that can be deployed on-device for Android.
145
- * Accuracy check between PyTorch and on-device outputs.
146
-
147
- ```bash
148
- python -m qai_hub_models.models.midas.export
149
- ```
150
-
151
-
152
-
153
- ## How does this work?
154
-
155
- This [export script](https://aihub.qualcomm.com/models/midas/qai_hub_models/models/Midas-V2/export.py)
156
- leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
157
- on-device. Lets go through each step below in detail:
158
-
159
- Step 1: **Compile model for on-device deployment**
160
-
161
- To compile a PyTorch model for on-device deployment, we first trace the model
162
- in memory using the `jit.trace` and then call the `submit_compile_job` API.
163
-
164
- ```python
165
- import torch
166
-
167
- import qai_hub as hub
168
- from qai_hub_models.models.midas import Model
169
-
170
- # Load the model
171
- torch_model = Model.from_pretrained()
172
-
173
- # Device
174
- device = hub.Device("Samsung Galaxy S25")
175
-
176
- # Trace model
177
- input_shape = torch_model.get_input_spec()
178
- sample_inputs = torch_model.sample_inputs()
179
-
180
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
181
-
182
- # Compile model on a specific device
183
- compile_job = hub.submit_compile_job(
184
- model=pt_model,
185
- device=device,
186
- input_specs=torch_model.get_input_spec(),
187
- )
188
-
189
- # Get target model to run on-device
190
- target_model = compile_job.get_target_model()
191
-
192
- ```
193
-
194
-
195
- Step 2: **Performance profiling on cloud-hosted device**
196
-
197
- After compiling models from step 1. Models can be profiled model on-device using the
198
- `target_model`. Note that this scripts runs the model on a device automatically
199
- provisioned in the cloud. Once the job is submitted, you can navigate to a
200
- provided job URL to view a variety of on-device performance metrics.
201
- ```python
202
- profile_job = hub.submit_profile_job(
203
- model=target_model,
204
- device=device,
205
- )
206
-
207
- ```
208
-
209
- Step 3: **Verify on-device accuracy**
210
-
211
- To verify the accuracy of the model on-device, you can run on-device inference
212
- on sample input data on the same cloud hosted device.
213
- ```python
214
- input_data = torch_model.sample_inputs()
215
- inference_job = hub.submit_inference_job(
216
- model=target_model,
217
- device=device,
218
- inputs=input_data,
219
- )
220
- on_device_output = inference_job.download_output_data()
221
-
222
- ```
223
- With the output of the model, you can compute like PSNR, relative errors or
224
- spot check the output with expected output.
225
-
226
- **Note**: This on-device profiling and inference requires access to Qualcomm®
227
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
228
-
229
-
230
-
231
- ## Run demo on a cloud-hosted device
232
-
233
- You can also run the demo on-device.
234
-
235
- ```bash
236
- python -m qai_hub_models.models.midas.demo --eval-mode on-device
237
- ```
238
-
239
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
240
- environment, please add the following to your cell (instead of the above).
241
- ```
242
- %run -m qai_hub_models.models.midas.demo -- --eval-mode on-device
243
- ```
244
-
245
-
246
- ## Deploying compiled model to Android
247
-
248
-
249
- The models can be deployed using multiple runtimes:
250
- - TensorFlow Lite (`.tflite` export): [This
251
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
252
- guide to deploy the .tflite model in an Android application.
253
-
254
-
255
- - QNN (`.so` export ): This [sample
256
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
257
- provides instructions on how to use the `.so` shared library in an Android application.
258
-
259
-
260
- ## View on Qualcomm® AI Hub
261
- Get more details on Midas-V2's performance across various devices [here](https://aihub.qualcomm.com/models/midas).
262
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
263
-
264
 
265
  ## License
266
  * The license for the original implementation of Midas-V2 can be found
267
  [here](https://github.com/isl-org/MiDaS/blob/master/LICENSE).
268
 
269
-
270
-
271
  ## References
272
  * [Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer](https://arxiv.org/abs/1907.01341v3)
273
  * [Source Model Implementation](https://github.com/isl-org/MiDaS)
274
 
275
-
276
-
277
  ## Community
278
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
279
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
280
-
281
-
 
9
 
10
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/midas/web-assets/model_demo.png)
11
 
12
+ # Midas-V2: Optimized for Qualcomm Devices
 
 
13
 
14
  Midas is designed for estimating depth at each point in an image.
15
 
16
+ This is based on the implementation of Midas-V2 found [here](https://github.com/isl-org/MiDaS).
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/midas) 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/midas/releases/v0.46.1/midas-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/midas/releases/v0.46.1/midas-qnn_dlc-float.zip)
32
+ | QNN_DLC | w8a8 | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/midas/releases/v0.46.1/midas-qnn_dlc-w8a8.zip)
33
+ | 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/midas/releases/v0.46.1/midas-tflite-float.zip)
34
+ | TFLITE | w8a8 | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/midas/releases/v0.46.1/midas-tflite-w8a8.zip)
35
+
36
+ For more device-specific assets and performance metrics, visit **[Midas-V2 on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/midas)**.
37
+
38
+
39
+ ### Option 2: Export with Custom Configurations
40
+
41
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/midas) Python library to compile and export the model with your own:
42
+ - Custom weights (e.g., fine-tuned checkpoints)
43
+ - Custom input shapes
44
+ - Target device and runtime configurations
45
+
46
+ This option is ideal if you need to customize the model beyond the default configuration provided here.
47
+
48
+ See our repository for [Midas-V2 on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/midas) for usage instructions.
49
+
50
+ ## Model Details
51
+
52
+ **Model Type:** Model_use_case.depth_estimation
53
+
54
+ **Model Stats:**
55
+ - Model checkpoint: MiDaS_small
56
+ - Input resolution: 256x256
57
+ - Number of parameters: 16.6M
58
+ - Model size (float): 63.2 MB
59
+ - Model size (w8a8): 16.9 MB
60
+
61
+ ## Performance Summary
62
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
63
+ |---|---|---|---|---|---|---
64
+ | Midas-V2 | ONNX | float | Snapdragon® X Elite | 2.893 ms | 36 - 36 MB | NPU
65
+ | Midas-V2 | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 2.117 ms | 0 - 150 MB | NPU
66
+ | Midas-V2 | ONNX | float | Qualcomm® QCS8550 (Proxy) | 3.065 ms | 0 - 107 MB | NPU
67
+ | Midas-V2 | ONNX | float | Qualcomm® QCS9075 | 4.251 ms | 1 - 4 MB | NPU
68
+ | Midas-V2 | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 1.691 ms | 0 - 111 MB | NPU
69
+ | Midas-V2 | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 1.4 ms | 0 - 111 MB | NPU
70
+ | Midas-V2 | QNN_DLC | float | Snapdragon® X Elite | 3.308 ms | 1 - 1 MB | NPU
71
+ | Midas-V2 | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 2.173 ms | 1 - 199 MB | NPU
72
+ | Midas-V2 | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 12.08 ms | 1 - 161 MB | NPU
73
+ | Midas-V2 | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 3.074 ms | 1 - 3 MB | NPU
74
+ | Midas-V2 | QNN_DLC | float | Qualcomm® SA8775P | 4.29 ms | 1 - 161 MB | NPU
75
+ | Midas-V2 | QNN_DLC | float | Qualcomm® QCS9075 | 4.497 ms | 1 - 3 MB | NPU
76
+ | Midas-V2 | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 6.801 ms | 0 - 192 MB | NPU
77
+ | Midas-V2 | QNN_DLC | float | Qualcomm® SA7255P | 12.08 ms | 1 - 161 MB | NPU
78
+ | Midas-V2 | QNN_DLC | float | Qualcomm® SA8295P | 5.452 ms | 1 - 164 MB | NPU
79
+ | Midas-V2 | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 1.62 ms | 0 - 162 MB | NPU
80
+ | Midas-V2 | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 1.287 ms | 1 - 166 MB | NPU
81
+ | Midas-V2 | QNN_DLC | w8a8 | Snapdragon® X Elite | 1.479 ms | 0 - 0 MB | NPU
82
+ | Midas-V2 | QNN_DLC | w8a8 | Snapdragon® 8 Gen 3 Mobile | 0.917 ms | 0 - 80 MB | NPU
83
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® QCS6490 | 4.171 ms | 0 - 2 MB | NPU
84
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® QCS8275 (Proxy) | 2.907 ms | 0 - 46 MB | NPU
85
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® QCS8550 (Proxy) | 1.32 ms | 0 - 2 MB | NPU
86
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® SA8775P | 1.576 ms | 0 - 50 MB | NPU
87
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® QCS9075 | 1.439 ms | 2 - 4 MB | NPU
88
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® QCM6690 | 9.029 ms | 0 - 174 MB | NPU
89
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® QCS8450 (Proxy) | 1.833 ms | 0 - 80 MB | NPU
90
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® SA7255P | 2.907 ms | 0 - 46 MB | NPU
91
+ | Midas-V2 | QNN_DLC | w8a8 | Qualcomm® SA8295P | 2.237 ms | 0 - 45 MB | NPU
92
+ | Midas-V2 | QNN_DLC | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 0.681 ms | 0 - 47 MB | NPU
93
+ | Midas-V2 | QNN_DLC | w8a8 | Snapdragon® 7 Gen 4 Mobile | 1.585 ms | 0 - 169 MB | NPU
94
+ | Midas-V2 | QNN_DLC | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.556 ms | 0 - 50 MB | NPU
95
+ | Midas-V2 | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 2.151 ms | 0 - 231 MB | NPU
96
+ | Midas-V2 | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 12.113 ms | 0 - 182 MB | NPU
97
+ | Midas-V2 | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 3.068 ms | 0 - 2 MB | NPU
98
+ | Midas-V2 | TFLITE | float | Qualcomm® SA8775P | 4.328 ms | 0 - 181 MB | NPU
99
+ | Midas-V2 | TFLITE | float | Qualcomm® QCS9075 | 4.441 ms | 0 - 39 MB | NPU
100
+ | Midas-V2 | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 6.849 ms | 0 - 215 MB | NPU
101
+ | Midas-V2 | TFLITE | float | Qualcomm® SA7255P | 12.113 ms | 0 - 182 MB | NPU
102
+ | Midas-V2 | TFLITE | float | Qualcomm® SA8295P | 5.46 ms | 0 - 165 MB | NPU
103
+ | Midas-V2 | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 1.619 ms | 0 - 178 MB | NPU
104
+ | Midas-V2 | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 1.287 ms | 0 - 179 MB | NPU
105
+ | Midas-V2 | TFLITE | w8a8 | Snapdragon® 8 Gen 3 Mobile | 0.749 ms | 0 - 79 MB | NPU
106
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® QCS6490 | 3.66 ms | 0 - 28 MB | NPU
107
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® QCS8275 (Proxy) | 2.494 ms | 0 - 46 MB | NPU
108
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® QCS8550 (Proxy) | 1.065 ms | 0 - 4 MB | NPU
109
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® SA8775P | 1.364 ms | 0 - 49 MB | NPU
110
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® QCS9075 | 1.191 ms | 0 - 20 MB | NPU
111
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® QCM6690 | 8.394 ms | 0 - 171 MB | NPU
112
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® QCS8450 (Proxy) | 1.568 ms | 0 - 77 MB | NPU
113
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® SA7255P | 2.494 ms | 0 - 46 MB | NPU
114
+ | Midas-V2 | TFLITE | w8a8 | Qualcomm® SA8295P | 1.944 ms | 0 - 43 MB | NPU
115
+ | Midas-V2 | TFLITE | w8a8 | Snapdragon® 8 Elite For Galaxy Mobile | 0.597 ms | 0 - 52 MB | NPU
116
+ | Midas-V2 | TFLITE | w8a8 | Snapdragon® 7 Gen 4 Mobile | 1.343 ms | 0 - 169 MB | NPU
117
+ | Midas-V2 | TFLITE | w8a8 | Snapdragon® 8 Elite Gen 5 Mobile | 0.49 ms | 0 - 49 MB | NPU
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  ## License
120
  * The license for the original implementation of Midas-V2 can be found
121
  [here](https://github.com/isl-org/MiDaS/blob/master/LICENSE).
122
 
 
 
123
  ## References
124
  * [Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer](https://arxiv.org/abs/1907.01341v3)
125
  * [Source Model Implementation](https://github.com/isl-org/MiDaS)
126
 
 
 
127
  ## Community
128
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
129
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
 
tool-versions.yaml DELETED
@@ -1,3 +0,0 @@
1
- tool_versions:
2
- qnn_dlc:
3
- qairt: 2.41.0.251128145156_191518