Models · Monocular depth

MiDaS v3.1

MiDaS v3.1 from Intel ISL, with a BEiT-L encoder: relative depth from one image.

stable Fork of isl-org/MiDaS@4545977 · backends: portable, kernels

Checkpoint midas-dpt-beit-large-512

Paper 2023 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 63.9 ms 994x1482, fp16
vs the faster original 5.2× original fp16: 333 ms
Peak memory 1,003 MiB original: 2,759 MiB
Accuracy vs original fp32 ±0.0000 kernels AbsRel, NYUv2 test (0.0487 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("midas-dpt-beit-large-512")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.inverse_depth
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench midas-dpt-beit-large-512

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 3860.86×3,616 MiB/3,778 MiB3.80.70
Original fp16torch.autocast(fp16) around the forwardfp16 333–2,759 MiB/2,898 MiB5.21.14
Portable fp32fp32not measured ––––
Portablefp16 78.84.2×992 MiB/1,418 MiB2.50.09
Kernelsfp16 63.95.2×1,003 MiB/1,436 MiB0.30.07
Portable + torch.compile 58.85.7×1,088 MiB/1,116 MiB33 (build)–
TensorRT fp16fp16 52.26.4×800 MiBenginenot comparable54 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-03. Median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls. 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-12Originalfp321107 4,976 MiB processmatches994x1482
Portablefp16635 2,407 MiB processmatches994x1482
Portablefp32679 3,443 MiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1691.7 932 MiB/1,058 MiB–994x1482
Kernelsfp1691.5 944 MiB/1,056 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1627.8 932 MiB/1,058 MiB–994x1482
Kernelsfp1626.8 944 MiB/1,016 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1673.1 932 MiB/1,058 MiB–994x1482
Kernelsfp1674.1 942 MiB/1,036 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1628.5 932 MiB/1,058 MiB–994x1482
Kernelsfp1628.5 944 MiB/1,036 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1617.8 955 MiB/1,078 MiB–994x1482
Kernelsfp1617.8 970 MiB/1,076 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
MIT LICENSE
Weights
MIT (assumed from code)(not stated by the authors; assumed to follow the code) source
Training data
  • weights licence not stated by the original authors; assumed to be the code licence

Our reading of the licences, not legal advice.

Weights

dpt_beit_large_512.pt 1.6 GB· hosted on GitHub

fastforks downloads and checks these files on first use (fastforks download midas-dpt-beit-large-512).

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.04870.9789 reference 654 332
Original fp16fp160.04870.9789 ±0.0000 654 264
Portable fp32fp320.04870.9789 ±0.0000 654 185
Portablefp160.04870.9789 ±0.0000 654 65.4
Kernelsfp160.04870.9789 ±0.0000 654 56.3

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.04770.9727 reference 100 311
Original fp16fp160.04780.9727 −0.0001 100 246
Portable fp32fp320.04770.9727 ±0.0000 100 166
Portablefp160.04770.9727 ±0.0000 100 60.9
Kernelsfp160.04780.9726 −0.0001 100 51.9

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.09040.8978 reference 27 592
Original fp16fp160.09060.8977 −0.0002 27 520
Portable fp32not measured
Portablefp160.09030.8979 +0.0001 27 107
Kernelsfp160.09060.8974 −0.0002 27 95.5

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.04250.9906 reference 15 433
Original fp16fp160.04240.9906 +0.0001 15 388
Portable fp32not measured
Portablefp160.04250.9906 ±0.0000 15 71.9
Kernelsfp160.04260.9907 −0.0001 15 64.1

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.

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.02 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.5 % and p99 <= 2 % of the reference's median |value| (absolute error of the output inverse_depth).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.02 (relative)not recorded
GPU default dtypes, mean |diff|≤ 0.005 (relative)0.00213 (relative)
GPU default dtypes, p99 |diff|≤ 0.02 (relative)0.00388 (relative)

Recorded for midas-dpt-beit-large-512 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-29, with these kernels: cudnn_hacc

Details

MiDaS v3.1 (Birkl et al. 2023): relative monocular depth from a BEiT-L/16 encoder and a DPT decoder, trained on a mix of 12 depth datasets.

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 (1,863 MiB allocated)
Options
  • input_size=512>= 32· changes the output
Outputs
inverse_depth
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

MiDaS v3.1 from Intel ISL, with a BEiT-L encoder: relative depth from one image.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
midas-dpt-beit-large-512Middlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
386
333
78.8
63.9
58.8
52.2
3616 / 3778
2759 / 2898
992 / 1418
1003 / 1436
1088 / 1116
1514 / 1592
Details
  • Original code: https://github.com/isl-org/MiDaS at 4545977
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: MIT (assumed from code)
  • Licence evidence: https://github.com/isl-org/MiDaS/blob/454597711a62eabcbf7d1e89f3fb9f569051ac9b/LICENSE (weights are release assets of the same repository)
  • Training data: KITTI stereo / optical flow 2012 / 2015, NYU Depth V2, MegaDepth (Internet photo collections with SfM / MVS depth), TartanAir, not stated by the authors (12 datasets (ReDWeb, DIML, Movies, MegaDepth, WSVD, TartanAir, HRWSI, ApolloScape, BlendedMVS, IRS, KITTI, NYU Depth V2) per the MiDaS v3.1 paper (arXiv 2307.14460))
  • Options: input_size = 512 (>= 32)
  • Kernel libraries: cudnn_hacc
  • Variants: midas-dpt-beit-large-512
  • Outputs: inverse_depth; kind: affine_invariant_inverse
  • Input size: any H x W >= 8, resized or padded inside the model
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): midas-dpt-beit-large-512 3000x4000 (1.8 GiB peak allocated, 1.9 reserved)
  • midas-dpt-beit-large-512 994x1482, first call: portable + torch.compile 33 s (cold Inductor cache), TensorRT fp16 54 s (ONNX + engine).
  • midas-dpt-beit-large-512 original 994x1482: torch.autocast(fp16) around the forward
  • midas-dpt-beit-large-512 load / first call: original 5.16 s / 1.135 s, portable 2.49 s / 0.093 s, kernels 0.28† s / 0.067 s
  • † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
  • Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls

Measured

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

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
midas-dpt-beit-large-512NYUv2 test, AbsRel / delta10.0487 / 0.97890.0487 / 0.97890.0487 / 0.97890.0487 / 0.97890.0487 / 0.9789
midas-dpt-beit-large-512iBims-1, AbsRel / delta10.0477 / 0.97270.0478 / 0.97270.0477 / 0.97270.0477 / 0.97270.0478 / 0.9726
midas-dpt-beit-large-512ETH3D two-view train left, AbsRel / delta10.0904 / 0.89780.0906 / 0.89770.0903 / 0.89790.0906 / 0.8974possibly in the training data
midas-dpt-beit-large-512Middlebury 2014 trainingH left, AbsRel / delta10.0425 / 0.99060.0424 / 0.99060.0425 / 0.99060.0426 / 0.9907possibly in the training data

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

Parity

CPU, float32: max |diff| <= 0.02 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.5 % and p99 <= 2 % of the reference's median |value| (absolute error of the output inverse_depth).

variantkernels error vs original, mean / p99GPU, torchkernels used
midas-dpt-beit-large-5120.00213 / 0.00388RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400

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