Models · Stereo matching

BridgeDepth

A stereo network that aligns Depth Anything V2 features with NMRF-style disparity proposals. Non-commercial weights.

stable Fork of aeolusguan/BridgeDepth@9a23160 · backends: portable, kernels

Checkpoint

Paper 2025 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 348 ms 994x1482, fp16
vs the faster original 1.3× original fp16: 460 ms
Peak memory 2,310 MiB original: 2,852 MiB
Accuracy vs original fp32 +0.01 kernels bad px %, ETH3D two-view train (1.25 original)

Use it

pip install fastforks

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

from fastforks import stereo

model = stereo.load("bridgedepth-sf")  # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend  # what ran: mode, device, dtype, kernels

The weights are non-commercial: fastforks downloads them only with FASTFORKS_NONCOMMERCIAL=1 set.

fastforks bench bridgedepth-sf

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 fp32original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocastfp32 6170.75×2,852 MiB/3,128 MiB––
Original fp16torch.autocast(fp16) around the forward; original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocastfp16 460–2,852 MiB/3,144 MiB––
Portable fp32fp32not measured ––––
Portablefp16 4371.1×2,916 MiB/3,214 MiB1.50.44
Kernelsfp16 3481.3×2,310 MiB/2,634 MiB0.70.35
Portable + torch.compile 3251.4×2,280 MiB/2,308 MiB111 (build)–
TensorRTplanned for 0.2.1fails––––

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-14Originalfp324279 7,464 MiB processmatches994x1482
Portablefp163782 6,271 MiB processmatches994x1482
Portablefp324280 8,300 MiB processmatches994x1482
Kernelsfp163693 6,270 MiB processmatches994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16481 2,516 MiB/2,792 MiB–994x1482
Kernelsfp16430 1,905 MiB/2,212 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16135 2,516 MiB/2,832 MiB–994x1482
Kernelsfp16122 1,905 MiB/2,210 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16368 2,516 MiB/2,792 MiB–994x1482
Kernelsfp16333 1,905 MiB/2,210 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16155 2,516 MiB/2,832 MiB–994x1482
Kernelsfp16141 1,905 MiB/2,212 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1671.6 2,906 MiB/3,192 MiB–994x1482
Kernelsfp1668.8 2,295 MiB/2,592 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

Non-commercial only

Code
MIT LICENSELICENSE-torchvision
Weights
CC-BY-NC-4.0 source
Training data
  • weights: CC-BY-NC-4.0
  • The weights embed Depth Anything V2 weights released under CC-BY-NC-4.0, so they are non-commercial even though the code is MIT.

Our reading of the licences, not legal advice.

Weights

bridge_sf.pth 1.4 GB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download bridgedepth-sf). Non-commercial weights need FASTFORKS_NONCOMMERCIAL=1.

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.

ETH3D two-view train

bad > 1 px % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp321.250.230 reference 27 134
Original fp16fp161.250.229 ±0.00 27 116
Portable fp32fp321.250.230 ±0.00 27 218
Portablefp161.240.229 +0.01 27 93.4
Kernelsfp161.240.229 +0.01 27 76.7
Original .half()fp16fails: RuntimeError: invalid dtype for bias - should match query's dtype

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16, original .half(): RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Middlebury 2014 trainingH

bad > 2 px % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp329.972.111 reference 15 525
Original fp16fp169.992.109 −0.02 15 394
Portable fp32fp329.972.112 ±0.00 15 1052
Portablefp1610.002.111 −0.03 15 371
Kernelsfp1610.002.109 −0.03 15 303
Original .half()fp16fails: RuntimeError: invalid dtype for bias - should match query's dtype

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16, original .half(): RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

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| <= 0.02 px and p99 <= 0.25 px.

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 pxnot recorded
GPU default dtypes, mean |diff|≤ 0.02 px0.00036 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.00123 px
real_gpu_mean≤ 0.06 pxnot recorded
real_gpu_p99≤ 1 pxnot recorded

Recorded for bridgedepth-sf on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-01, with these kernels: fastbb

Details

BridgeDepth (Guan et al. 2025): Depth Anything V2 (ViT-L) features combined with NMRF stereo hypotheses; window-attention message passing between mono and stereo embeddings, inference at 1/8 resolution plus a 1/4 refinement.

Input / output
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Input size
any H x W >= 16, padded to a multiple of 16; tested up to 3000x4000 (13.3 GiB allocated)
Outputs
disparity
CUDA kernels
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
Apple (MPS)
stereo_metalMetal: stereo kernels. fp32, fp16

Limitations

  • ONNX Runtime resolves top-k ties differently from PyTorch on noise pairs: bridgedepth-sf differs by up to 0.010 px (mean 0.001) on a synthetic textured pair.
Full reference, generated from the repository

A stereo network that aligns Depth Anything V2 features with NMRF-style disparity proposals. Non-commercial weights.

Commercial use: no (weights: CC-BY-NC-4.0).

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
bridgedepth-sfMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
616
460
437
348
325
planned for 0.2.1
2852 / 3128
2852 / 3144
2916 / 3214
2310 / 2634
2280 / 2308
–
bridgedepth-rvc-pretrainMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
629
470
442
354
337
planned for 0.2.1
2903 / 3178
2903 / 3200
2968 / 3246
2361 / 2686
2329 / 2360
–
Details
  • Original code: https://github.com/aeolusguan/BridgeDepth at 9a231601e698
  • Code licence: MIT (permissive); files: LICENSE, LICENSE-torchvision
  • Weights licence: CC-BY-NC-4.0
  • Licence evidence: https://github.com/aeolusguan/BridgeDepth/blob/9a231601e6981d3536fa6a78ebaccebc1edb99a4/README.md#L40
  • Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
    • bridgedepth-rvc-pretrain: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa), NVIDIA Falling Things (FAT), CREStereo synthetic stereo dataset (Megvii), TartanAir, MPI Sintel stereo, not stated by the authors (configs/rvc_pretrain.yaml: Scene Flow, Falling Things, CREStereo, TartanAir, CARLA high-res, Sintel, Virtual KITTI 2 (started from l_sf, Scene Flow); README recommends it for in-the-wild use)
  • Licence note: The weights embed Depth Anything V2 weights released under CC-BY-NC-4.0, so they are non-commercial even though the code is MIT.
  • Kernel libraries: fastbb
  • Variants: bridgedepth-sf, bridgedepth-rvc-pretrain
  • Not in this release (planned for 0.2.1): bridgedepth-sf TensorRT export: the TensorRT 10 engine build fails (Myelin tactic check); bridgedepth-rvc-pretrain TensorRT export: the TensorRT 10 engine build fails (Myelin tactic check)
  • Outputs: disparity
  • Input size: any H x W >= 16, padded to a multiple of 16
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): bridgedepth-sf 3000x4000 (13.3 GiB peak allocated, 14.2 reserved); bridgedepth-rvc-pretrain 3000x4000 (13.3 GiB peak allocated, 14.2 reserved)
  • bridgedepth-sf 994x1482, first call: portable + torch.compile 111 s (cold Inductor cache).
  • bridgedepth-rvc-pretrain 994x1482, first call: portable + torch.compile 118 s (cold Inductor cache).
  • bridgedepth-sf original (fp32) 994x1482: original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocast
  • bridgedepth-sf original 994x1482: torch.autocast(fp16) around the forward; original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocast
  • bridgedepth-rvc-pretrain original (fp32) 994x1482: original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocast
  • bridgedepth-rvc-pretrain original 994x1482: torch.autocast(fp16) around the forward; original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocast
  • bridgedepth-sf load / first call: original 4.86 s / 0.119 s (375x1242), portable 1.53 s / 0.442† s, kernels 0.72† s / 0.351† s
  • bridgedepth-rvc-pretrain load / first call: original 5.87 s / 1.363 s (375x1242), portable 1.84 s / 0.453† s, kernels 0.76† s / 0.356† 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

Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16original halfportableportable fp32kernelsnote
bridgedepth-sfETH3D two-view train, bad > 1 px % / EPE1.25 / 0.2301.25 / 0.229fails (RuntimeError: invalid dtype for bias - should match query's dtype)1.24 / 0.2291.25 / 0.2301.24 / 0.229
bridgedepth-sfMiddlebury 2014 trainingH, bad > 2 px % / EPE9.97 / 2.1119.99 / 2.109fails (RuntimeError: invalid dtype for bias - should match query's dtype)10.00 / 2.1119.97 / 2.11210.00 / 2.109
bridgedepth-rvc-pretrainETH3D two-view train, bad > 1 px % / EPE1.22 / 0.1911.22 / 0.192fails (RuntimeError: invalid dtype for bias - should match query's dtype)1.22 / 0.1911.22 / 0.1911.22 / 0.191possibly in the training data
bridgedepth-rvc-pretrainMiddlebury 2014 trainingH, bad > 2 px % / EPE6.35 / 0.9506.35 / 0.948fails (RuntimeError: invalid dtype for bias - should match query's dtype)6.38 / 0.9536.35 / 0.9506.37 / 0.952possibly in the training data

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Parity

CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 px and p99 <= 0.25 px. On real pairs up to 720x1280 the limits are mean 0.06 / p99 1.0 (precision-sensitive there, see Limitations).

variantkernels error vs original, mean / p99GPU, torchkernels used
bridgedepth-sf0.00036 / 0.00123RTX 5060 Ti, torch 2.14.1+cu130fastbb@7d058322634d:sm_120
bridgedepth-rvc-pretrain0.00053 / 0.00327RTX 5060 Ti, torch 2.14.1+cu130fastbb@7d058322634d:sm_120

Limitations

  • ONNX Runtime resolves top-k ties differently from PyTorch on noise pairs: bridgedepth-sf differs by up to 0.010 px (mean 0.001) on a synthetic textured pair.

Example output

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

Left view
Right view
Output
Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), left view
Left view · 100%

Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).