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: experimental. Outputs: depth, normals, confidence. Backends: portable, kernels.

Input: one RGB image. Output: a depth or inverse-depth map (metric for the models marked metric).

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 BSD-2-Clause (assumed from code) yes

Licence

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

Code licence: BSD-2-Clause; the authors do not state a separate weights licence.

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, 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 628.7 438.5 200.31 158.46 2.8x 1.3x 3275 / 3350 1484 / 1696 1516 / 1688

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
metric3d-vit-large 9.96 3.45 0.31โ€  0.88 0.23 0.16

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
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 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
metric3d-vit-large NYUv2 test, AbsRel / delta1 0.0546 / 0.9676 0.0547 / 0.9673 0.0546 / 0.9673
metric3d-vit-large iBims-1, AbsRel / delta1 0.0334 / 0.9853 0.0334 / 0.9855 0.0334 / 0.9855
metric3d-vit-large ETH3D two-view train left, AbsRel / delta1 0.0746 / 0.9406 0.0740 / 0.9410 0.0741 / 0.9410 possibly in the training data
metric3d-vit-large Middlebury 2014 trainingH left, AbsRel / delta1 0.0248 / 0.9961 0.0247 / 0.9961 0.0247 / 0.9961 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|.

Limitations

  • The normals convention (camera axes / sign) is not checked against a dataset; it is passed through as original returns it.

Usage

from fastforks import depth

model = depth.load("metric3d-vit-large")  # portable PyTorch on the GPU if there is one, else the CPU
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). 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