FoundationStereo (fastforks)
FoundationStereo (Wen et al. 2025): zero-shot stereo foundation model with Depth Anything ViT + CNN features, a 3-D regularised cost volume with a disparity transformer and selective ConvGRU updates, 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/NVlabs/FoundationStereo at 6e8806816b53.
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 |
|---|---|---|---|---|
foundationstereo-vit-l@1 |
23-51-11/model_best_bp2.pth | 60e79bde9c6a |
LicenseRef-NVIDIA-Source-Code-License-NC | no |
foundationstereo-vit-s@1 |
11-33-40/model_best_bp2.pth | 8d7850b9dc68 |
LicenseRef-NVIDIA-Source-Code-License-NC | no |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: LicenseRef-NVIDIA-Source-Code-License-NC AND Apache-2.0. Files: LICENSE.
Training data: Foundation Stereo Dataset (FSD, synthetic, NVIDIA) plus SceneFlow, Falling Things, Sintel, CREStereo, InStereo2K and others; no per-dataset terms checked.
- Licence note: Code and weights are under the NVIDIA Source Code License-NC (non-commercial research use only). Our kernels for this family count as derived work and inherit the NC limit; the family ships in fastforks-nc.
Licence evidence: https://github.com/NVlabs/FoundationStereo/blob/6e8806816b533e4d13ddbb95ffa907b797060a62/readme.md#L158
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): foundationstereo-vit-l 1988x2880 (7.1 GiB peak allocated, 11.4 reserved); foundationstereo-vit-s 1988x2880 (6.5 GiB peak allocated, 10.7 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 |
|---|---|---|---|---|---|---|---|---|---|
foundationstereo-vit-l |
9228.0 | 4237.0 | 2989.84 | 1513.07 | 2.8x | 2.0x | 8286 / 8750 | 3141 / 3436 | 2818 / 3300 |
foundationstereo-vit-s |
7128.8 | 3608.6 | 2513.8 | 1120.17 | 3.2x | 2.2x | 6987 / 7280 | 2493 / 2606 | 2169 / 2470 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
foundationstereo-vit-l |
10.86 (375x1242) | 1.98 | 1.17โ | 2.56 (375x1242) | 2.99โ | 1.52โ |
foundationstereo-vit-s |
1.44 (375x1242) | 1.03 | 0.33โ | 1.06 (375x1242) | 2.51โ | 1.12โ |
Fixed-size speed and peak memory, all models
| model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
|---|---|---|---|---|---|
foundationstereo-vit-l |
portable | 577.7 ms / 1654 / 2216 | 1846.4 ms / 2676 / 3370 | 3776.7 ms (n=3) / 3570 / 5048 | OOM |
foundationstereo-vit-l |
kernels | 320.0 ms / 1296 / 1642 | 961.0 ms / 2232 / 2800 | 1788.5 ms / 3254 / 4506 | 9521.9 ms (n=3) / 12653 / 14398 |
foundationstereo-vit-s |
portable | 481.4 ms / 1042 / 1352 | 1508.2 ms / 2047 / 2678 | 3424.1 ms (n=3) / 2900 / 4592 | OOM |
foundationstereo-vit-s |
kernels | 245.6 ms / 685 / 862 | 687.1 ms / 1604 / 2008 | 1499.8 ms / 2585 / 3440 | 8960.9 ms (n=3) / 12058 / 13800 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
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 | original | portable | kernels | note |
|---|---|---|---|---|---|
foundationstereo-vit-l |
ETH3D two-view train, bad > 1 px % / EPE | 0.65 / 0.168 | 0.65 / 0.168 | 0.65 / 0.167 | possibly in the training data |
foundationstereo-vit-l |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 2.48 / 0.561 | 2.47 / 0.561 | 2.47 / 0.561 | possibly in the training data |
foundationstereo-vit-s |
ETH3D two-view train, bad > 1 px % / EPE | 1.10 / 0.202 | 1.10 / 0.202 | possibly in the training data | |
foundationstereo-vit-s |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 3.32 / 0.680 | 3.30 / 0.680 | 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
- ONNX export needs torch >= 2.14 (older exporters fail on this network).
Usage
from fastforks import stereo
model = stereo.load("foundationstereo-vit-l") # 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: foundationstereo-vit-l, foundationstereo-vit-s.
Kernels backend
stereo.load("foundationstereo-vit-l", mode="kernels") runs our CUDA kernels (fs, fs_cutlass, cudnn_hacc, fastbb). 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.