RAFT-Stereo (fastforks)
RAFT-Stereo (Lipson et al. 2021): multi-level GRU updates over a 1-D all-pairs correlation pyramid, 32 iterations.
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/princeton-vl/RAFT-Stereo at 6e93ed2169bd.
Task: stereo. Tier: stable. Outputs: disparity. Backends: portable, kernels.
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
raft-stereo-eth3d@1 |
raftstereo-eth3d.pth | 9ea862904b5b |
MIT (assumed from code) | yes |
raft-stereo-middlebury@1 |
raftstereo-middlebury.pth | d22e84c0e431 |
MIT (assumed from code) | yes |
raft-stereo-sceneflow@1 |
raftstereo-sceneflow.pth | ba75bdcb379b |
MIT (assumed from code) | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: LICENSE.
Code licence: MIT; the authors do not state a separate weights licence.
Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa).
Licence evidence: https://github.com/princeton-vl/RAFT-Stereo/blob/6e93ed2169bd858dbb43033988563f3b0bb49506/README.md#L79
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-eth3d 3000x4000 (10.2 GiB peak allocated, 12.5 reserved); raft-stereo-middlebury 3000x4000 (10.2 GiB peak allocated, 12.5 reserved); raft-stereo-sceneflow 3000x4000 (10.2 GiB peak allocated, 12.5 reserved)
Speed and memory
Stereo, Middlebury 2014 half, 994x1482
| model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|
raft-stereo-eth3d |
1774.7 | 1036.7 | 745.64 | 272.78 | 3.8x | 2.7x | 2516 / 2628 | 1388 / 1492 | 765 / 802 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
raft-stereo-eth3d |
0.27 (375x1242) | 0.25 | 0.05โ | 1.45 (375x1242) | 0.75โ | 0.27โ |
Fixed-size speed and peak memory, all models
| model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
|---|---|---|---|---|---|
raft-stereo-eth3d |
portable | 143.6 ms / 320 / 376 | 433.7 ms / 864 / 1058 | 1036.0 ms / 1852 / 2258 | 6289.1 ms (n=3) / 10406 / 12814 |
raft-stereo-eth3d |
kernels | 57.8 ms / 201 / 214 | 166.5 ms / 569 / 590 | 370.4 ms / 1233 / 1264 | 2138.5 ms (n=3) / 7295 / 7436 |
raft-stereo-middlebury |
portable | 143.7 ms / 320 / 376 | 433.7 ms / 864 / 1058 | 1035.8 ms / 1852 / 2258 | 6287.7 ms (n=3) / 10406 / 12814 |
raft-stereo-middlebury |
kernels | 57.8 ms / 201 / 214 | 165.9 ms / 569 / 590 | 370.5 ms / 1233 / 1264 | 2139.9 ms (n=3) / 7295 / 7436 |
raft-stereo-sceneflow |
portable | 143.7 ms / 320 / 376 | 433.6 ms / 864 / 1058 | 1035.8 ms / 1852 / 2258 | 6286.9 ms (n=3) / 10406 / 12814 |
raft-stereo-sceneflow |
kernels | 57.6 ms / 201 / 214 | 166.0 ms / 569 / 590 | 370.4 ms / 1233 / 1264 | 2138.4 ms (n=3) / 7295 / 7436 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
raft-stereo-middlebury,raft-stereo-sceneflow: same network and settings asraft-stereo-eth3d, measured once (rows not repeated).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
Original = the authors' code, same checkpoint and protocol.
| variant | dataset | portable | kernels | note |
|---|---|---|---|---|
raft-stereo-middlebury |
ETH3D two-view train, bad > 1 px % / EPE | 2.77 / 0.289 | 2.79 / 0.289 | |
raft-stereo-middlebury |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 7.20 / 1.069 | 7.21 / 1.071 | trained on this dataset's public images; not a zero-shot result |
raft-stereo-sceneflow |
ETH3D two-view train, bad > 1 px % / EPE | 2.60 / 0.267 | 2.60 / 0.267 | |
raft-stereo-sceneflow |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 11.23 / 1.438 | 11.23 / 1.452 | |
raft-stereo-eth3d |
ETH3D two-view train, bad > 1 px % / EPE | 2.60 / 0.274 | 2.61 / 0.274 | possibly in the training data |
raft-stereo-eth3d |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 12.00 / 1.635 | 11.98 / 1.635 | possibly in the training data |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-27.
Parity with the original code
Every variant is checked against golden outputs of the original code at its pinned commit. 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.
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.
Usage
from fastforks import stereo
model = stereo.load("raft-stereo-eth3d") # portable PyTorch on the GPU if there is one, else the CPU
result = model("left.png", "right.png")
result.disparity # [H, W] float32 tensor, input resolution
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: raft-stereo-eth3d, raft-stereo-middlebury, raft-stereo-sceneflow.
Kernels backend
stereo.load("raft-stereo-eth3d", mode="kernels") runs our CUDA kernels (raft, cutlass_conv, cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.