ZoeDepth (fastforks)

ZoeDepth (Bhat et al. 2023): metric monocular depth from a MiDaS v3.1 BEiT-L/16 core with metric-bins heads (NYU indoor, KITTI outdoor) chosen by a learned domain router (ZoeD_M12_NK).

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/isl-org/ZoeDepth at d87f17b.

Task: depth. Tier: experimental. Outputs: depth. Backends: portable, kernels.

Input: one RGB image. Output: a depth or inverse-depth map. kind (a card field, result.kind) says what the numbers mean: metric = metres; scale_invariant, affine_invariant and affine_invariant_inverse are relative (unknown scale or shift, not metres). Metric models that use the focal length take model(image, intrinsics=K) (K [3, 3], pixels of the input): metric3d-vit-large and da3metric-large need it for correct metres (da3metric-large: metres = output x focal / 300; without intrinsics= a 300 px focal length is assumed, wrong for a real camera). unidepth-v2-vitl14, unik3d-vitl, depth-pro and MoGe estimate the camera themselves (given intrinsics= replace fx); zoedepth-nk and the relative models (da3mono-large too) take none.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
zoedepth-nk@1 ZoeD_M12_NK.pt 5d26daa15d42 MIT (assumed from code) yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: LICENSE.

Code licence: MIT; the authors do not state a separate weights licence.

Training data: MiDaS v3.1 BEiT-L relative-depth pre-training on 12 datasets, then metric fine-tuning on NYU Depth V2 and KITTI (ZoeDepth paper, arXiv 2302.12288).

Licence evidence: https://github.com/isl-org/ZoeDepth/blob/d87f17b2f5fdcb174cf4fb115491f4a6c60de152/LICENSE (weights are release assets of the same repository)

Input size

any H x W >= 8, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): zoedepth-nk 3000x4000 (2.4 GiB peak allocated, 2.6 reserved)

Speed and memory

Depth, Middlebury 2014 half, 994x1482

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
zoedepth-nk 408.0 271.2 123.96 88.87 3.1x 1.4x 2040 / 2146 2037 / 2124 1771 / 1960

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
zoedepth-nk 8.35 1.92 0.33† 1.53 0.28 0.12

torch.compile and TensorRT

model input portable ms compile ms compile s (cold) TensorRT fp16 ms ONNX + build s kernels ms peak MiB (alloc / reserved): portable compile TensorRT (device)
zoedepth-nk 994x1482 123.96 fails: Dynamo: numpy size in model code – fails: ONNX export: torch.export failed – 88.87 2037 / 2124 – –

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
zoedepth-nk portable 107.5 ms / 1857 / 1966 147.2 ms / 2046 / 2184 147.6 ms / 2107 / 2220 113.0 ms / 2451 / 2658
zoedepth-nk kernels 74.9 ms / 1548 / 1802 105.6 ms / 1847 / 2138 106.2 ms / 1907 / 2230 80.3 ms / 2142 / 2486

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Resizes to its working resolution: time depends on the aspect ratio, not the input pixels.

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the authors' code, same checkpoint and protocol.

variant dataset original portable kernels note
zoedepth-nk NYUv2 test, AbsRel / delta1 0.0532 / 0.9737 0.0528 / 0.9743 0.0528 / 0.9743
zoedepth-nk iBims-1, AbsRel / delta1 0.0669 / 0.9545 0.0668 / 0.9546 0.0668 / 0.9546
zoedepth-nk ETH3D two-view train left, AbsRel / delta1 0.1139 / 0.8648 0.1130 / 0.8653 0.1130 / 0.8654 possibly in the training data
zoedepth-nk Middlebury 2014 trainingH left, AbsRel / delta1 0.0449 / 0.9860 0.0449 / 0.9860 0.0449 / 0.9860 possibly in the training data

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-27.

Parity with the original code

Every variant is checked against golden outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1 % and p99 <= 3 % of the reference's median |value| (absolute error of the output depth).

Limitations

  • torch.compile(fullgraph=True) and torch.export are not supported: graph break in the vendored MiDaS core call and data-dependent NYU / KITTI head routing (documented xfail).
  • Inputs below 5 px per side raise InputError when pad_input is on.

Usage

from fastforks import depth

model = depth.load("zoedepth-nk")  # mode="auto": the preferred backend from recorded measurements
result = model("room.jpg")
result.depth  # [H, W] float32 tensor; result.kind says what the maps mean
# models that take a camera: model("room.jpg", intrinsics=K), K [3, 3] in pixels
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: zoedepth-nk.

Kernels backend

depth.load("zoedepth-nk", mode="kernels") runs our CUDA kernels (cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support