Metric3D v2 (fastforks)

Metric3D v2 (Hu et al. 2024): metric depth and surface normals from one image; a DINOv2-reg ViT-L encoder and a RAFT-style iterative depth / normal decoder in a canonical camera space (focal 1000 px), rescaled by the given focal length.

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/YvanYin/Metric3D at eb5b6fa.

Author weight repos: https://huggingface.co/JUGGHM/Metric3D.

Task: depth. Tier: stable. Outputs: depth, normals, confidence. 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, affine_invariant_log (log depth) 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. Normals-only models (kind none) return result.normals [B, H, W, 3] (unit vectors, camera frame: x right, y down, z forward).

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
metric3d-vit-large@1 metric_depth_vit_large_800k.pth 15328ffc42b5 LicenseRef-none no

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: BSD-2-Clause. Licence files: LICENSE.

Training data: 16M images from 18 public metric-depth datasets (indoor, outdoor, driving) per the Metric3D v2 paper (arXiv 2404.15506); original asks commercial users to contact the authors.

  • Licence note: The upstream README says 'for further commercial inquiries, please contact' the authors; no weights licence is stated, so the BSD-2-Clause code licence is assumed.

Licence evidence: https://github.com/YvanYin/Metric3D/blob/eb5b6fac0dc155e4e52f576e304fbf11655ff339/README.md#license-and-contact

Input size

any H x W >= 8, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): metric3d-vit-large 3000x4000 (2.3 GiB peak allocated, 2.9 reserved)

Speed and memory

Depth, synthetic

model input time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
metric3d-vit-large 994x1482 – – 181 146 – 1.2x – 1188 / 1256 1412 / 1486

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
metric3d-vit-large 629 438 – – – – 3275 / 3350 – –

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
metric3d-vit-large 9.96 2.39 (518x770) 0.71 (518x770) 0.88 0.42 (518x770) 0.50 (518x770)

torch.compile and TensorRT

model input time: portable compile TensorRT (fp16 unless shown) kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
metric3d-vit-large 994x1482 181 ms 149 ms 91.4 ms 146 ms 54.7 s 96.6 s 1188 / 1256 1126 / 1148 1412 / 1486 1867 / 1952

Fixed-size speed and peak memory, all models

model mode 480x640 720x1280 1080x1920 12 MP 3000x4000
metric3d-vit-large portable 207.0 ms / 2219 / 2422 207.0 ms / 2228 / 2440 207.3 ms / 2242 / 2428 211.9 ms / 2401 / 2926
metric3d-vit-large kernels 158.4 ms / 1471 / 1796 158.4 ms / 1478 / 1812 158.8 ms / 1492 / 1822 162.9 ms / 1616 / 2022

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

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above 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

Aligned depth scores fit scale and shift by least squares, in disparity space for inverse-depth models. Metric depth scores follow each dataset's protocol. Both average over images. Normals: angle to the ground-truth normal over the pixels with ground truth (Marigold's evaluation sets), mean over images. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable portable fp32 kernels note
metric3d-vit-large NYUv2 test, AbsRel / delta1 0.0547 / 0.9673 0.0547 / 0.9673 0.0547 / 0.9673 0.0547 / 0.9673 0.0546 / 0.9673
metric3d-vit-large iBims-1, AbsRel / delta1 0.0334 / 0.9855 0.0334 / 0.9855 0.0334 / 0.9855 0.0334 / 0.9855 0.0334 / 0.9855
metric3d-vit-large ETH3D two-view train left, AbsRel / delta1 0.0740 / 0.9411 0.0740 / 0.9411 0.0740 / 0.9411 0.0741 / 0.9410 possibly in the training data
metric3d-vit-large Middlebury 2014 trainingH left, AbsRel / delta1 0.0247 / 0.9961 0.0247 / 0.9961 0.0247 / 0.9961 0.0247 / 0.9961 possibly in the training data
metric3d-vit-large NYUv2 test normals, mean / median angle deg, % < 11.25 / < 30 deg 13.72 / 7.27 / 65.43 / 87.44 13.72 / 7.27 / 65.43 / 87.44 13.71 / 7.27 / 65.44 / 87.45
metric3d-vit-large iBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg 14.47 / 5.84 / 71.33 / 85.85 14.47 / 5.84 / 71.33 / 85.85 14.47 / 5.84 / 71.33 / 85.85

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 4e890760 / 939adfe8, 2026-11-06 to 2026-11-12; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 4e890760 / 6d3bab64, 2026-11-12 to 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 4e890760 / 939adfe8, 2026-11-06 to 2026-11-12.

Parity with the original code

Every variant is checked against reference 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

  • metric3d-vit-large: the kernels runner prepares its buffers at load, so the model right after load holds more than portable; the run peak is within 2 % of portable's.

Usage

from fastforks import depth

# non-commercial weights: run with FASTFORKS_NONCOMMERCIAL=1 in the environment
model = depth.load("metric3d-vit-large")  # 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: metric3d-vit-large.

Kernels backend

depth.load("metric3d-vit-large", mode="kernels") runs our CUDA kernels (fastbb, dpt_fused). 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

Model tree for fastforks/metric3d

Base model

JUGGHM/Metric3D
Finetuned
(1)
this model

Collection including fastforks/metric3d