Models · Stereo matching

RAFT-Stereo

A recurrent stereo network from the Princeton Vision & Learning Lab, with checkpoints for several datasets.

stable Fork of princeton-vl/RAFT-Stereo@6e93ed2 · backends: portable, kernels

Checkpoint

Paper 2021 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 274 ms 994x1482, fp16
vs the faster original 3.8× original fp16: 1037 ms
Peak memory 722 MiB original: 2,516 MiB
Accuracy vs original fp32 −0.02 kernels bad px %, ETH3D two-view train (2.77 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("raft-stereo-middlebury")  # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench raft-stereo-middlebury

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 fp32timed with raft-stereo-eth3d (same network, other weights); corr_implementation=reg_cudafp32 17750.58×4,825 MiB/4,928 MiB––
Original fp16timed with raft-stereo-eth3d (same network, other weights); corr_implementation=reg_cudafp16 1037–2,516 MiB/2,628 MiB––
Portable fp32fp32not measured ––––
Portablemeasured on raft-stereo-eth3d (same architecture, other checkpoint)fp16 7461.4×1,388 MiB/1,492 MiB0.30.75
Kernelsfp16 2743.8×722 MiB/758 MiB0.70.27
Portable + torch.compile 5062.0×780 MiB/988 MiB100 (build)–
TensorRT fp16fp16 3343.1×884 MiBenginenot comparable132 (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-12Originalfp325574 9,545 MiB processmatches994x1482
Portablefp163940 4,695 MiB processmatches994x1482
Portablefp324395 4,712 MiB processmatches994x1482
Kernelsfp163634 4,722 MiB processmatches994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16820 1,361 MiB/1,570 MiB–994x1482
Kernelsfp16416 730 MiB/758 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16256 1,361 MiB/1,570 MiB–994x1482
Kernelsfp16121 730 MiB/758 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16643 1,361 MiB/1,570 MiB–994x1482
Kernelsfp16313 730 MiB/758 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16275 1,361 MiB/1,570 MiB–994x1482
Kernelsfp16110 730 MiB/758 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp16148 1,385 MiB/1,490 MiB–994x1482
Kernelsfp1663.6 730 MiB/758 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

raftstereo-middlebury.pth 44.6 MB· inside a 202 MB archive· hosted on Dropbox

fastforks downloads and checks these files on first use (fastforks download raft-stereo-middlebury).

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 fp32fp322.770.287 reference 27 446
Original fp16fp162.770.289 ±0.00 27 249
Portable fp32fp322.770.287 ±0.00 27 368
Portablefp162.770.289 ±0.00 27 178
Kernelsfp162.790.289 −0.02 27 70.2

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: 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 % / EPEtrained on this dataset’s public images: not zero-shot

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp327.201.069 reference 15 1510
Original fp16fp167.191.069 +0.01 15 882
Portable fp32fp327.201.068 ±0.00 15 1331
Portablefp167.201.069 ±0.00 15 627
Kernelsfp167.211.071 −0.01 15 227

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: 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.00836 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.07899 px

Recorded for raft-stereo-middlebury on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: cudnn_hacccutlass_convraft

Details

RAFT-Stereo (Lipson et al. 2021): multi-level GRU updates over a 1-D all-pairs correlation pyramid, 32 iterations.

Input / output
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Input size
any H x W >= 32, padded to a multiple of 32; tested up to 3000x4000 (10.2 GiB allocated)
Options
  • iters=32>= 1· changes the output
Outputs
disparity
CUDA kernels
  • raftRAFT-Stereo: normalisation, GRU gates, correlation, upsampling
  • cutlass_convCUTLASS convolutions with the recurrent update (GRU) fused in
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
stereo_metalMetal: stereo kernels. fp32, fp16

Limitations

  • raftstereo-realtime.pth and iraftstereo_rvc.pth from the original zip (another architecture / instance-norm context) are not included and not supported by the kernels engine.
Full reference, generated from the repository

A recurrent stereo network from the Princeton Vision & Learning Lab, with checkpoints for several datasets.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
raft-stereo-middleburyMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
1775
1037
746
274
506
334
4825 / 4928
2516 / 2628
1388 / 1492
722 / 758
780 / 988
1012 / 1090
raft-stereo-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
1775
1037
746
274
507
333
4825 / 4928
2516 / 2628
1388 / 1492
722 / 758
780 / 988
1014 / 1092
raft-stereo-eth3dMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
1775
1037
746
275
506
333
4825 / 4928
2516 / 2628
1388 / 1492
722 / 738
815 / 988
952 / 972
Details
  • Original code: https://github.com/princeton-vl/RAFT-Stereo at 6e93ed2169bd
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: MIT (assumed from code)
  • Licence evidence: https://github.com/princeton-vl/RAFT-Stereo/blob/6e93ed2169bd858dbb43033988563f3b0bb49506/README.md#L79
  • Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
    • raft-stereo-middlebury: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa), Middlebury stereo (2014) (SceneFlow, then fine-tuned on the 23 Middlebury 2014 training scenes)
    • raft-stereo-eth3d: ETH3D two-view stereo, not stated by the authors (ETH3D submission model: fine-tuned on ETH3D; the rest of its training is not stated)
  • Options: iters = 32 (>= 1)
  • Kernel libraries: raft, cutlass_conv, cudnn_hacc
  • Variants: raft-stereo-middlebury, raft-stereo-sceneflow, raft-stereo-eth3d
  • Outputs: disparity
  • Input size: any H x W >= 32, padded to a multiple of 32
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): raft-stereo-middlebury 3000x4000 (10.2 GiB peak allocated, 12.5 reserved); raft-stereo-sceneflow 3000x4000 (10.2 GiB peak allocated, 12.5 reserved); raft-stereo-eth3d 3000x4000 (10.2 GiB peak allocated, 12.5 reserved)
  • raft-stereo-middlebury 994x1482, first call: portable + torch.compile 100 s (cold Inductor cache), TensorRT fp16 132 s (ONNX + engine).
  • raft-stereo-sceneflow 994x1482, first call: portable + torch.compile 100 s (cold Inductor cache), TensorRT fp16 132 s (ONNX + engine).
  • raft-stereo-eth3d 994x1482, first call: portable + torch.compile 100 s (cold Inductor cache), TensorRT fp16 132 s (ONNX + engine).
  • raft-stereo-middlebury original (fp32) 994x1482, original 994x1482: timed with raft-stereo-eth3d (same network, other weights); corr_implementation=reg_cuda
  • raft-stereo-middlebury portable 994x1482: measured on raft-stereo-eth3d (same architecture, other checkpoint)
  • raft-stereo-sceneflow original (fp32) 994x1482, original 994x1482: timed with raft-stereo-eth3d (same network, other weights); corr_implementation=reg_cuda
  • raft-stereo-sceneflow portable 994x1482: measured on raft-stereo-eth3d (same architecture, other checkpoint)
  • raft-stereo-eth3d original (fp32) 994x1482, original 994x1482: corr_implementation=reg_cuda
  • raft-stereo-middlebury load / first call: original 0.27 s / 1.452 s (375x1242), portable 0.25 s / 0.746† s, kernels 0.73 s / 0.102 s (375x1242)
  • raft-stereo-sceneflow load / first call: original 0.27 s / 1.452 s (375x1242), portable 0.25 s / 0.746† s, kernels 0.46 s / 0.101 s (375x1242)
  • raft-stereo-eth3d load / first call: original 0.27 s / 1.452 s (375x1242), portable 0.25 s / 0.746† s, kernels 0.55 s / 0.103 s (375x1242)
  • † 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 fp16portableportable fp32kernelsnote
raft-stereo-middleburyETH3D two-view train, bad > 1 px % / EPE2.77 / 0.2872.77 / 0.2892.77 / 0.2892.77 / 0.2872.79 / 0.289
raft-stereo-middleburyMiddlebury 2014 trainingH, bad > 2 px % / EPE7.20 / 1.0697.19 / 1.0697.20 / 1.0697.20 / 1.0687.21 / 1.071trained on this dataset's public images; not a zero-shot result
raft-stereo-sceneflowETH3D two-view train, bad > 1 px % / EPE2.61 / 0.2662.61 / 0.2672.60 / 0.2672.61 / 0.2672.60 / 0.267
raft-stereo-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE11.22 / 1.43611.21 / 1.43911.23 / 1.43811.21 / 1.43911.23 / 1.452
raft-stereo-eth3dETH3D two-view train, bad > 1 px % / EPE2.61 / 0.2742.60 / 0.2742.60 / 0.2742.60 / 0.2742.61 / 0.274trained on this dataset's public images; not a zero-shot result
raft-stereo-eth3dMiddlebury 2014 trainingH, bad > 2 px % / EPE11.95 / 1.63511.99 / 1.63412.00 / 1.63511.98 / 1.63611.98 / 1.635possibly 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.

variantkernels error vs original, mean / p99GPU, torchkernels used
raft-stereo-middlebury0.00836 / 0.07899RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, raft@9524a68234cc:sm_120
raft-stereo-sceneflow0.0019 / 0.01941RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, raft@9524a68234cc:sm_120
raft-stereo-eth3d0.00166 / 0.01285RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, raft@9524a68234cc:sm_120

Limitations

  • raftstereo-realtime.pth and iraftstereo_rvc.pth from the original zip (another architecture / instance-norm context) are not included and not supported by the kernels engine.

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