Models · Monocular depth

Metric3D v2

Metric3D v2 (Wei Yin and Mu Hu et al.): metric depth and surface normals from one image, given the focal length. Commercially usable; the authors ask commercial users to contact them.

stable Fork of YvanYin/Metric3D@eb5b6fa · backends: portable, kernels

Checkpoint metric3d-vit-large

Paper 2024 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 155 ms 994x1482, fp16
vs the faster original 2.8× original fp16: 439 ms
Peak memory 1,475 MiB original: 3,275 MiB
Accuracy vs original fp32 +0.0001 kernels AbsRel, NYUv2 test (0.0547 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import depth

model = depth.load("metric3d-vit-large")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.depth  # also: normals, confidence
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench metric3d-vit-large

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 6290.70×3,077 MiB/3,122 MiB3.90.73
Original fp16torch.autocast(fp16) around the forwardfp16 439–3,275 MiB/3,350 MiB10.00.88
Portable fp32fp32not measured ––––
Portablefp16 2012.2×1,443 MiB/1,576 MiB2.40.20
Kernelsfp16 1552.8×1,475 MiB/1,588 MiB0.70.16
Portable + torch.compile 1493.0×1,126 MiB/1,148 MiB55 (build)–
TensorRT fp16fp16 91.44.8×1,010 MiBenginenot comparable97 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp321946 4,973 MiB processmatches994x1482
Portablefp161861 3,636 MiB processmatches994x1482
Portablefp321822 4,523 MiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16218 1,424 MiB/1,576 MiB–994x1482
Kernelsfp16193 1,455 MiB/1,528 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1663.8 1,424 MiB/1,576 MiB–994x1482
Kernelsfp1656.9 1,455 MiB/1,528 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16175 1,424 MiB/1,576 MiB–994x1482
Kernelsfp16166 1,455 MiB/1,528 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1668.5 1,424 MiB/1,576 MiB–994x1482
Kernelsfp1661.5 1,455 MiB/1,528 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1641.3 1,447 MiB/1,598 MiB–994x1482
Kernelsfp1638.9 1,479 MiB/1,628 MiB–994x1482

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
BSD-2-Clause LICENSE
Weights
BSD-2-Clause (assumed from code)(not stated by the authors; assumed to follow the code) source
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
  • weights licence not stated by the original authors; assumed to be the code licence
  • 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.

Our reading of the licences, not legal advice.

Weights

metric_depth_vit_large_800k.pth 1.6 GB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download metric3d-vit-large).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

NYUv2 test

AbsRel / delta1

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.05470.9673 reference 654 633
Original fp16fp160.05470.9673 ±0.0000 654 440
Portable fp32fp320.05470.9673 ±0.0000 654 553
Portablefp160.05470.9673 ±0.0000 654 200
Kernelsfp160.05460.9673 +0.0001 654 158

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

iBims-1

AbsRel / delta1

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.03340.9855 reference 100 628
Original fp16fp160.03340.9855 ±0.0000 100 440
Portable fp32fp320.03340.9855 ±0.0000 100 554
Portablefp160.03340.9855 ±0.0000 100 200
Kernelsfp160.03340.9855 ±0.0000 100 158

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

ETH3D two-view train left

AbsRel / delta1training data not stated: possibly seen

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.07400.9411 reference 27 628
Original fp16fp160.07400.9411 ±0.0000 27 440
Portable fp32not measured
Portablefp160.07400.9411 ±0.0000 27 200
Kernelsfp160.07410.9410 −0.0001 27 158

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Middlebury 2014 trainingH left

AbsRel / delta1training data not stated: possibly seen

RundtypeAbsRel ↓δ1 ↑Δ AbsRel vs fp32 originalimagesms / image
Original fp32fp320.02470.9961 reference 15 641
Original fp16fp160.02470.9961 ±0.0000 15 449
Portable fp32not measured
Portablefp160.02470.9961 ±0.0000 15 200
Kernelsfp160.02470.9961 ±0.0000 15 158

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. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

NYUv2 test normals

mean / median angle deg, % < 11.25 / < 30 deg

Rundtypeang_mean ↑ang_median ↑a11.25 ↑a30 ↑imagesms / image
Original fp32not measured
Original fp16not measured
Portable fp32fp3213.727.2765.4387.44 654 554
Portablefp1613.727.2765.4387.44 654 201
Kernelsfp1613.717.2765.4487.45 654 158

The original code was not run on this dataset, so the table cannot show the distance to it.

AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Normals: angle to the ground-truth normal over the pixels with ground truth (Marigold's evaluation sets), mean over images. Measured on RTX 5060 Ti, torch 2.14.1+cu130, fastforks 4e890760, 2026-11-12.

iBims-1 normals

mean / median angle deg, % < 11.25 / < 30 deg

Rundtypeang_mean ↑ang_median ↑a11.25 ↑a30 ↑imagesms / image
Original fp32not measured
Original fp16not measured
Portable fp32fp3214.475.8471.3385.85 100 556
Portablefp1614.475.8471.3385.85 100 200
Kernelsfp1614.475.8471.3385.85 100 158

The original code was not run on this dataset, so the table cannot show the distance to it.

AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Measured on RTX 5060 Ti, torch 2.14.1+cu130, fastforks 4e890760, 2026-11-12.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 (relative)not recorded
GPU default dtypes, mean |diff|≤ 0.01 (relative)0.00139 (relative)
GPU default dtypes, p99 |diff|≤ 0.03 (relative)0.00198 (relative)

Recorded for metric3d-vit-large on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12, with these kernels: dpt_fusedfastbb

Details

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.

Input / output
Input: one RGB image. Output: a depth or inverse-depth map.
What the numbers mean, and which models need the camera focal length

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).

Input size
any H x W >= 8, resized or padded inside the model; tested up to 3000x4000 (2,401 MiB allocated)
Outputs
depth, normals, confidence
CUDA kernels
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • dpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth heads
Apple (MPS)
fp32, fp16

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.
Full reference, generated from the repository

Metric3D v2 (Wei Yin and Mu Hu et al.): metric depth and surface normals from one image, given the focal length. Commercially usable; the authors ask commercial users to contact them.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
metric3d-vit-largeMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
629
438
201
155
149
91.4
3077 / 3122
3275 / 3350
1443 / 1576
1475 / 1588
1126 / 1148
1867 / 1952
Details
  • Original code: https://github.com/YvanYin/Metric3D at eb5b6fa
  • Code licence: BSD-2-Clause (permissive); files: LICENSE
  • Weights licence: BSD-2-Clause (assumed from code)
  • Licence evidence: https://github.com/YvanYin/Metric3D/blob/eb5b6fac0dc155e4e52f576e304fbf11655ff339/README.md#license-and-contact
  • 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.
  • Kernel libraries: fastbb, dpt_fused
  • Variants: metric3d-vit-large
  • Outputs: depth, normals, confidence; kind: metric
  • 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)
  • metric3d-vit-large 994x1482, first call: portable + torch.compile 55 s (cold Inductor cache), TensorRT fp16 97 s (ONNX + engine).
  • metric3d-vit-large original 994x1482: torch.autocast(fp16) around the forward
  • metric3d-vit-large load / first call: original 9.96 s / 0.876 s, portable 2.39 s / 0.423 s (518x770), kernels 0.71 s / 0.504 s (518x770)
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean 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.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
metric3d-vit-largeNYUv2 test, AbsRel / delta10.0547 / 0.96730.0547 / 0.96730.0547 / 0.96730.0547 / 0.96730.0546 / 0.9673
metric3d-vit-largeiBims-1, AbsRel / delta10.0334 / 0.98550.0334 / 0.98550.0334 / 0.98550.0334 / 0.98550.0334 / 0.9855
metric3d-vit-largeETH3D two-view train left, AbsRel / delta10.0740 / 0.94110.0740 / 0.94110.0740 / 0.94110.0741 / 0.9410possibly in the training data
metric3d-vit-largeMiddlebury 2014 trainingH left, AbsRel / delta10.0247 / 0.99610.0247 / 0.99610.0247 / 0.99610.0247 / 0.9961possibly in the training data
metric3d-vit-largeNYUv2 test normals, mean / median angle deg, % < 11.25 / < 30 deg13.72 / 7.27 / 65.43 / 87.4413.72 / 7.27 / 65.43 / 87.4413.71 / 7.27 / 65.44 / 87.45
metric3d-vit-largeiBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg14.47 / 5.84 / 71.33 / 85.8514.47 / 5.84 / 71.33 / 85.8514.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

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).

variantkernels error vs original, mean / p99GPU, torchkernels used
metric3d-vit-large0.00139 / 0.00198RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120

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.

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Input
Output
A cup of coffee, input
Input · 100%

Input: A cup of coffee, Rachel Michetti (CC0).