DEFOM-Stereo (fastforks)
DEFOM-Stereo (Jiang et al. 2025): Depth Anything V2 (ViT-L) features and initial disparity, then RAFT-style ConvGRU updates with scale 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/Insta360-Research-Team/DEFOM-Stereo at 5b27591d8395.
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 |
|---|---|---|---|---|
defom-stereo-vitl-sceneflow@1 |
defomstereo_vitl_sceneflow.pth | 0be5c5ddd25e |
CC-BY-NC-4.0 | no |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: LICENSE.
Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa).
- Licence note: The weights embed Depth Anything V2 ViT-L weights released under CC-BY-NC-4.0, so they are non-commercial even though the code is MIT.
Licence evidence: https://github.com/Insta360-Research-Team/DEFOM-Stereo/blob/5b27591d83956e5d329ff66704271a9e68b1c75f/README.md
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): defom-stereo-vitl-sceneflow 1988x2880 (12.0 GiB peak allocated, 14.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 |
|---|---|---|---|---|---|---|---|---|---|
defom-stereo-vitl-sceneflow |
4175.5 | β | 1530.89 | 658.71 | β | 2.3x | β | 4362 / 4838 | 3154 / 3566 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
defom-stereo-vitl-sceneflow |
9.54 (375x1242) | 2.31 | 1.18β | 1.04 (375x1242) | 1.53β | 0.66β |
Fixed-size speed and peak memory, all models
| model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
|---|---|---|---|---|---|
defom-stereo-vitl-sceneflow |
portable | 263.9 ms / 2070 / 2368 | 860.4 ms / 3248 / 4044 | 2169.2 ms (n=3) / 5378 / 7082 | OOM |
defom-stereo-vitl-sceneflow |
kernels | 120.5 ms / 1357 / 1702 | 376.5 ms / 2275 / 3190 | 936.5 ms / 2991 / 3578 | 5950.0 ms (n=3) / 11923 / 15526 |
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 |
|---|---|---|---|---|---|
defom-stereo-vitl-sceneflow |
ETH3D two-view train, bad > 1 px % / EPE | 2.40 / 0.337 | 2.42 / 0.362 | 2.44 / 0.341 | |
defom-stereo-vitl-sceneflow |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 6.03 / 0.837 | 6.14 / 0.848 | 6.02 / 0.834 |
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, portable bfloat16 and kernels float16 (the defaults): mean |diff| <= 0.02 px and p99 <= 0.25 px.
Limitations
- Only the ViT-L SceneFlow checkpoint is included (ViT-S / ViT-B and the Middlebury / ETH3D / KITTI fine-tunes are not).
- Portable is faster than the original code but allocates more memory (about 1.25x at 994x1482); kernels is several times faster and needs a fraction of the memory.
Usage
from fastforks import stereo
model = stereo.load("defom-stereo-vitl-sceneflow") # 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: defom-stereo-vitl-sceneflow.
Kernels backend
stereo.load("defom-stereo-vitl-sceneflow", mode="kernels") runs our CUDA kernels (igev, cutlass_conv, 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.