Models · Stereo matching

DEFOM-Stereo

A stereo network from the Insta360 Research Team that uses Depth Anything V2 features and an initial depth prior. Non-commercial weights.

stable Fork of Insta360-Research-Team/DEFOM-Stereo@5b27591 · backends: portable, kernels

Checkpoint defom-stereo-vitl-sceneflow

Paper 2025 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 642 ms 994x1482, fp16
vs the faster original 4.4× original fp16: 2816 ms
Peak memory 3,154 MiB original: 8,639 MiB
Accuracy vs original fp32 −0.04 kernels bad px %, ETH3D two-view train (2.40 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("defom-stereo-vitl-sceneflow")  # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend  # what ran: mode, device, dtype, kernels

The weights are non-commercial: fastforks downloads them only with FASTFORKS_NONCOMMERCIAL=1 set.

fastforks bench defom-stereo-vitl-sceneflow

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 bf16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 41750.67×10.6 GiB/10.8 GiB10.84.18
Original fp16the authors' mixed-precision option (float16)fp16 2816–8,639 MiB/8,766 MiB4.22.83
Portable fp32fp32not measured ––––
Portablebf16 15311.8×4,362 MiB/4,838 MiB2.31.53
Kernelsfp16 6424.4×3,154 MiB/3,522 MiB2.70.65
Portable + torch.compile 10022.8×3,021 MiB/3,292 MiB122 (build)–
TensorRTplanned for 0.2.1fails––––

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-03 to 2026-11-12. 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-12Originalfp32out of memory–994x1482
Portablefp3211105 12.8 GiB processmatches994x1482
Kernelsfp168224 8,328 MiB processmatches994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablebf161641 4,333 MiB/4,792 MiB–994x1482
Kernelsfp16921 3,124 MiB/3,522 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablebf16499 4,333 MiB/4,812 MiB–994x1482
Kernelsfp16271 3,124 MiB/3,542 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablebf161211 4,333 MiB/4,792 MiB–994x1482
Kernelsfp16689 3,124 MiB/3,522 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablebf16475 4,333 MiB/4,792 MiB–994x1482
Kernelsfp16248 3,124 MiB/3,522 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablebf16266 4,357 MiB/4,972 MiB–994x1482
Kernelsfp16146 3,148 MiB/3,542 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

Non-commercial only

Code
MIT LICENSE
Weights
CC-BY-NC-4.0 source
Training data
  • weights: CC-BY-NC-4.0
  • 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.

Our reading of the licences, not legal advice.

Weights

defomstereo_vitl_sceneflow.pth 1.5 GB· hosted on Google Drive

fastforks downloads and checks these files on first use (fastforks download defom-stereo-vitl-sceneflow). Non-commercial weights need FASTFORKS_NONCOMMERCIAL=1.

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.400.337 reference 27 748
Original fp16fp1699.9213.132 – 27NaN / inf output 405
Portable fp32fp322.340.328 +0.06 27 713
Portablebf162.370.356 +0.03 27 336
Kernelsfp162.440.341 −0.04 27 150

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 % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp326.030.837 reference 15 3410
Original fp16fp16100.0071.272 – 15NaN / inf output 2270
Portable fp32fp326.020.837 +0.01 15 3002
Portablebf166.150.845 −0.12 15 1274
Kernelsfp166.020.834 +0.01 15 544

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, portable bfloat16 and kernels float16 (the defaults): 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.00143 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.00808 px

Recorded for defom-stereo-vitl-sceneflow on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12, with these kernels: cudnn_hacccutlass_convdpt_fusedfastbbigev

Details

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.

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 1988x2880 (12.0 GiB allocated)
Options
  • iters=32>= 1· changes the output
  • scale_iters=8>= 0· changes the output
Outputs
disparity
CUDA kernels
  • igevIGEV stereo: convolution epilogues, correlation lookups, GRU gates
  • cutlass_convCUTLASS convolutions with the recurrent update (GRU) fused in
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • dpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth heads
Apple (MPS)
stereo_metalMetal: stereo kernels. fp32

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.
Full reference, generated from the repository

A stereo network from the Insta360 Research Team that uses Depth Anything V2 features and an initial depth prior. Non-commercial weights.

Commercial use: no (weights: CC-BY-NC-4.0).

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
defom-stereo-vitl-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
4175
2816
1531
642
1002
planned for 0.2.1
10896 / 11072
8639 / 8766
4362 / 4838
3154 / 3522
3021 / 3292
–
Details
  • Original code: https://github.com/Insta360-Research-Team/DEFOM-Stereo at 5b27591d8395
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: CC-BY-NC-4.0
  • Licence evidence: https://github.com/Insta360-Research-Team/DEFOM-Stereo/blob/5b27591d83956e5d329ff66704271a9e68b1c75f/README.md
  • 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.
  • Options: iters = 32 (>= 1), scale_iters = 8 (>= 0)
  • Kernel libraries: igev, cutlass_conv, cudnn_hacc, fastbb, dpt_fused
  • Variants: defom-stereo-vitl-sceneflow
  • Not in this release (planned for 0.2.1): defom-stereo-vitl-sceneflow TensorRT export: the TensorRT 10 engine build fails (Myelin tactic check)
  • 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): defom-stereo-vitl-sceneflow 1988x2880 (12.0 GiB peak allocated, 14.5 reserved)
  • defom-stereo-vitl-sceneflow 994x1482, first call: portable + torch.compile 122 s (cold Inductor cache).
  • defom-stereo-vitl-sceneflow original 994x1482: the authors' mixed-precision option (float16)
  • defom-stereo-vitl-sceneflow load / first call: original 4.24 s / 2.83 s, portable 2.31 s / 1.534† s, kernels 2.74 s / 0.305 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
defom-stereo-vitl-sceneflowETH3D two-view train, bad > 1 px % / EPE2.40 / 0.33799.92 / 13.132 (NaN / inf output)2.37 / 0.3562.34 / 0.3282.44 / 0.341
defom-stereo-vitl-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE6.03 / 0.837100.00 / 71.272 (NaN / inf output)6.15 / 0.8456.02 / 0.8376.02 / 0.834

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, portable bfloat16 and kernels float16 (the defaults): mean |diff| <= 0.02 px and p99 <= 0.25 px.

variantkernels error vs original, mean / p99GPU, torchkernels used
defom-stereo-vitl-sceneflow0.00143 / 0.00808RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120, igev@f075827d68c6:sm_120

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.

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