|
Download README.md from fastforks/foundationstereo: direct link, hf CLI and curl.
- Browser
- Download file 8.14 kB
-
https://huggingface.co/fastforks/foundationstereo/resolve/main/README.md
- Command line
-
hf download hf://fastforks/foundationstereo/README.md
-
curl -L -o README.md https://huggingface.co/fastforks/foundationstereo/resolve/main/README.md
8.14 kB
| library_name: "fastforks" | |
| pipeline_tag: "depth-estimation" | |
| license: "other" | |
| license_name: "nvidia-source-code-license-nc" | |
| license_link: "https://github.com/NVlabs/FoundationStereo/blob/6e8806816b533e4d13ddbb95ffa907b797060a62/readme.md#L158" | |
| tags: | |
| - "stereo" | |
| - "stereo-matching" | |
| - "disparity" | |
| - "cuda" | |
| - "pytorch" | |
| - "fastforks" | |
| - "fastforks-card" | |
| # 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`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/stereo/models/foundationstereo/card.toml). | |
| | variant | weights (author link) | SHA-256 | weights licence | commercial use | | |
| |---|---|---|---|---| | |
| | `foundationstereo-vit-l@1` | [23-51-11/model_best_bp2.pth](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1Yh_2o9QCUrVqZrnAXZ7RUr0zTp3JrMKe) | `60e79bde9c6a` | LicenseRef-NVIDIA-Source-Code-License-NC | **no** | | |
| | `foundationstereo-vit-s@1` | [11-33-40/model_best_bp2.pth](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1Ei-EBaF3EQA977zdjbXdmoXE7WuyJ1ib) | `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. Licence 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 | 4237 | 2990 | 1513 | 2.8x | 2.0x | 8286 / 8750 | 3141 / 3436 | 2818 / 3300 | | |
| | `foundationstereo-vit-s` | 7129 | 3609 | 2514 | 1120 | 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† | | |
| ### torch.compile and TensorRT | |
| | model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) | | |
| | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | |
| | `foundationstereo-vit-l` | 994x1482 | 2990 ms | deferred (build >5 min) | deferred (build >5 min) | 1513 ms | – | – | 3141 / 3436 | – | 2818 / 3300 | – | | |
| | `foundationstereo-vit-s` | 994x1482 | 2514 ms | 2044 ms | 1196 ms | 1120 ms | 212 s | 545 s | 2493 / 2606 | 2822 / 3646 | 2169 / 2470 | 2794 / 2872 | | |
| ### Fixed-size speed and peak memory, all models | |
| | model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 | | |
| | --- | --- | --- | --- | --- | --- | | |
| | `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](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above 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 original code named under Details, same checkpoint and protocol. | |
| | variant | dataset | original fp32 | original fp16 | 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.168 | 0.65 / 0.168 | possibly in the training data | | |
| | `foundationstereo-vit-l` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 2.48 / 0.562 | 2.48 / 0.561 | 2.47 / 0.561 | 2.48 / 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 | 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.679 | 3.32 / 0.681 | 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, fastforks 468fba10, 2026-11-05. | |
| ### Parity with the original code | |
| Every variant is checked against reference 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 | |
| ```python | |
| from fastforks import stereo | |
| # non-commercial weights: run with FASTFORKS_NONCOMMERCIAL=1 in the environment | |
| model = stereo.load("foundationstereo-vit-l") # mode="auto": the preferred backend from recorded measurements | |
| 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. | |
| <!-- staged from fastforks 1cbf1671 (2026-11-15) --> | |