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
- Paper BridgeDepth: Bridging Monocular and Stereo Reasoning with Latent Alignment ICCV 2025 · first released 6 Aug 2025
Paper 2025 Added in 0.1.0 Evaluated with 0.2.0
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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocast | fp32 | 617 | 0.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 autocast | fp16 | 460 | – | 2,852 MiB/3,144 MiB | – | – |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 437 | 1.1× | 2,916 MiB/3,214 MiB | 1.5 | 0.44 |
| Kernels | fp16 | 348 | 1.3× | 2,310 MiB/2,634 MiB | 0.7 | 0.35 |
| Portable + torch.compile | 325 | 1.4× | 2,280 MiB/2,308 MiB | 111 (build) | – | |
| TensorRTplanned for 0.2.1 | fails | – | – | – | – |
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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 4279 | 7,464 MiB process | matches | 994x1482 |
| Portable | fp16 | 3782 | 6,271 MiB process | matches | 994x1482 | |
| Portable | fp32 | 4280 | 8,300 MiB process | matches | 994x1482 | |
| Kernels | fp16 | 3693 | 6,270 MiB process | matches | 994x1482 | |
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 481 | 2,516 MiB/2,792 MiB | – | 994x1482 |
| Kernels | fp16 | 430 | 1,905 MiB/2,212 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 135 | 2,516 MiB/2,832 MiB | – | 994x1482 |
| Kernels | fp16 | 122 | 1,905 MiB/2,210 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 368 | 2,516 MiB/2,792 MiB | – | 994x1482 |
| Kernels | fp16 | 333 | 1,905 MiB/2,210 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 155 | 2,516 MiB/2,832 MiB | – | 994x1482 |
| Kernels | fp16 | 141 | 1,905 MiB/2,212 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 71.6 | 2,906 MiB/3,192 MiB | – | 994x1482 |
| Kernels | fp16 | 68.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
-
- Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa) research-only, non-commercial
- 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 Facefastforks 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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 1.25 | 0.230 | reference | 27 | 134 |
| Original fp16 | fp16 | 1.25 | 0.229 | ±0.00 | 27 | 116 |
| Portable fp32 | fp32 | 1.25 | 0.230 | ±0.00 | 27 | 218 |
| Portable | fp16 | 1.24 | 0.229 | +0.01 | 27 | 93.4 |
| Kernels | fp16 | 1.24 | 0.229 | +0.01 | 27 | 76.7 |
| Original .half() | fp16 | fails: 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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 9.97 | 2.111 | reference | 15 | 525 |
| Original fp16 | fp16 | 9.99 | 2.109 | −0.02 | 15 | 394 |
| Portable fp32 | fp32 | 9.97 | 2.112 | ±0.00 | 15 | 1052 |
| Portable | fp16 | 10.00 | 2.111 | −0.03 | 15 | 371 |
| Kernels | fp16 | 10.00 | 2.109 | −0.03 | 15 | 303 |
| Original .half() | fp16 | fails: 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.
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 px | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 px | 0.00036 px |
| GPU default dtypes, p99 |diff| | ≤ 0.25 px | 0.00123 px |
| real_gpu_mean | ≤ 0.06 px | not recorded |
| real_gpu_p99 | ≤ 1 px | not 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).
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
bridgedepth-sf | Middlebury 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-pretrain | Middlebury 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-sfTensorRT export: the TensorRT 10 engine build fails (Myelin tactic check);bridgedepth-rvc-pretrainTensorRT 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-sf3000x4000 (13.3 GiB peak allocated, 14.2 reserved);bridgedepth-rvc-pretrain3000x4000 (13.3 GiB peak allocated, 14.2 reserved) bridgedepth-sf994x1482, first call: portable + torch.compile 111 s (cold Inductor cache).bridgedepth-rvc-pretrain994x1482, first call: portable + torch.compile 118 s (cold Inductor cache).bridgedepth-sforiginal (fp32) 994x1482: original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocastbridgedepth-sforiginal 994x1482: torch.autocast(fp16) around the forward; original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocastbridgedepth-rvc-pretrainoriginal (fp32) 994x1482: original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocastbridgedepth-rvc-pretrainoriginal 994x1482: torch.autocast(fp16) around the forward; original default: its monocular branch (DepthAnything.infer) runs in fp16 even without autocastbridgedepth-sfload / first call: original 4.86 s / 0.119 s (375x1242), portable 1.53 s / 0.442† s, kernels 0.72† s / 0.351† sbridgedepth-rvc-pretrainload / 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.
| variant | dataset | original fp32 | original fp16 | original half | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|---|
bridgedepth-sf | ETH3D two-view train, bad > 1 px % / EPE | 1.25 / 0.230 | 1.25 / 0.229 | fails (RuntimeError: invalid dtype for bias - should match query's dtype) | 1.24 / 0.229 | 1.25 / 0.230 | 1.24 / 0.229 | |
bridgedepth-sf | Middlebury 2014 trainingH, bad > 2 px % / EPE | 9.97 / 2.111 | 9.99 / 2.109 | fails (RuntimeError: invalid dtype for bias - should match query's dtype) | 10.00 / 2.111 | 9.97 / 2.112 | 10.00 / 2.109 | |
bridgedepth-rvc-pretrain | ETH3D two-view train, bad > 1 px % / EPE | 1.22 / 0.191 | 1.22 / 0.192 | fails (RuntimeError: invalid dtype for bias - should match query's dtype) | 1.22 / 0.191 | 1.22 / 0.191 | 1.22 / 0.191 | possibly in the training data |
bridgedepth-rvc-pretrain | Middlebury 2014 trainingH, bad > 2 px % / EPE | 6.35 / 0.950 | 6.35 / 0.948 | fails (RuntimeError: invalid dtype for bias - should match query's dtype) | 6.38 / 0.953 | 6.35 / 0.950 | 6.37 / 0.952 | possibly 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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
bridgedepth-sf | 0.00036 / 0.00123 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@7d058322634d:sm_120 |
bridgedepth-rvc-pretrain | 0.00053 / 0.00327 | RTX 5060 Ti, torch 2.14.1+cu130 | fastbb@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).
Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).