Views
No views yet
dpt_large_384.onnx # ~1.3 GB| Spec | |
|---|---|
| Input name | pixel_values (or image — verify in Netron) |
| Input shape | [1, 3, 384, 384] |
| Input dtype | float32 |
| Preprocessing | RGB, divide by 255, normalize by mean=[0.5, 0.5, 0.5] / std=[0.5, 0.5, 0.5] |
| Output shape | [1, 384, 384] |
| Output meaning | Relative depth — not metric. Lower values = farther; higher values = closer. Linearly map to your visualization range. |
1import onnxruntime as ort
2import numpy as np
3from PIL import Image
4
5sess = ort.InferenceSession("dpt_large_384.onnx")
6
7# Resize input image to 384×384, normalize, NCHW
8img = Image.open("photo.jpg").convert("RGB").resize((384, 384))
9arr = (np.asarray(img, dtype=np.float32) / 255.0 - 0.5) / 0.5 # HWC, [-1,1]
10arr = arr.transpose(2, 0, 1)[None, ...] # 1x3x384x384
11
12depth = sess.run(None, {sess.get_inputs()[0].name: arr})[0][0] # 384x384dpt-hybrid or midas-small — not in this repo, but available as separate uploads upstream.LICENSE file included.midas-small Heliosoph repo (sourced from the GitHub release) inherits MIT.