Models · Stereo matching

DLNR

A stereo network in the RAFT-Stereo style with a decoupled LSTM and normalization refinement.

stable Fork of David-Zhao-1997/High-frequency-Stereo-Matching-Network@c10475f · backends: portable, kernels

Checkpoint

Paper 2023 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 214 ms 994x1482, fp16
vs the faster original 2.8× original fp16: 598 ms
Peak memory 1,236 MiB original: 3,004 MiB
Accuracy vs original fp32 −0.01 kernels bad px %, ETH3D two-view train (30.26 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("dlnr-sceneflow")  # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench dlnr-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 fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 9780.61×3,191 MiB/3,608 MiB––
Original fp16fp16 598–3,004 MiB/3,552 MiB––
Portable fp32fp32not measured ––––
Portablefp16 3981.5×2,635 MiB/3,142 MiB0.60.40
Kernelsfp16 2142.8×1,236 MiB/1,606 MiB0.30.21
Portable + torch.compile 3012.0×1,343 MiB/1,672 MiB69 (build)–
TensorRT fp16fp16 2412.5×1,492 MiBenginenot comparable161 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-03. 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. 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-12Originalfp323258 7,469 MiB processmatches994x1482
Portablefp162143 4,094 MiB processmatches994x1482
Portablefp322699 6,162 MiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16460 2,608 MiB/3,016 MiB–994x1482
Kernelsfp16293 1,210 MiB/1,384 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16143 2,608 MiB/3,016 MiB–994x1482
Kernelsfp1694.6 1,210 MiB/1,382 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16346 2,608 MiB/3,016 MiB–994x1482
Kernelsfp16224 1,080 MiB/1,262 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16141 2,608 MiB/3,016 MiB–994x1482
Kernelsfp1695.4 1,210 MiB/1,382 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1676.4 2,632 MiB/3,216 MiB–994x1482
Kernelsfp1648.6 1,234 MiB/1,342 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

Commercial use allowed

Code
MIT LICENSE
Weights
MIT (assumed from code)(not stated by the authors; assumed to follow the code) source
Training data
  • weights licence not stated by the original authors; assumed to be the code licence

Our reading of the licences, not legal advice.

Weights

DLNR_SceneFlow.pth 230 MB· hosted on GitHub

fastforks downloads and checks these files on first use (fastforks download dlnr-sceneflow).

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 fp32fp3230.265.931 reference 27 238
Original fp16fp1630.275.924 −0.01 27 151
Portable fp32fp3230.265.940 ±0.00 27 175
Portablefp1630.265.935 ±0.00 27 97.0
Kernelsfp1630.275.944 −0.01 27 61.5

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 fp32fp3211.421.650 reference 15 829
Original fp16fp1611.431.650 −0.01 15 510
Portable fp32fp3211.431.650 −0.01 15 641
Portablefp1611.421.651 ±0.00 15 336
Kernelsfp1611.421.650 ±0.00 15 181

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

Recorded for dlnr-sceneflow on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: cudnn_hacccutlass_convfastbbigevraft

Details

DLNR (Zhao et al. 2023): Restormer channel-attention feature extractor, a RAFT-Stereo style 1-D correlation pyramid and 3-level LSTM updates with normalization refinement, 10 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 (10.1 GiB allocated)
Options
  • iters=10>= 1· changes the output
Outputs
disparity
CUDA kernels
  • raftRAFT-Stereo: normalisation, GRU gates, correlation, upsampling
  • 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
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

A stereo network in the RAFT-Stereo style with a decoupled LSTM and normalization refinement.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
dlnr-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
978
598
398
214
301
241
3191 / 3608
3004 / 3552
2635 / 3142
1236 / 1606
1343 / 1672
1711 / 1784
Details
  • Original code: https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network at c10475fe30ff
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: MIT (assumed from code)
  • Licence evidence: https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network/blob/c10475fe30ff198781ecc7c712c24c781ff05096/README.md#L84
  • Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
    • dlnr-middlebury: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa), Middlebury stereo (2014) (SceneFlow, then fine-tuned on Middlebury (README; the training set is not stated))
  • Options: iters = 10 (>= 1)
  • Kernel libraries: raft, igev, cutlass_conv, cudnn_hacc, fastbb
  • Variants: dlnr-sceneflow, dlnr-middlebury
  • 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): dlnr-sceneflow 1988x2880 (10.1 GiB peak allocated, 12.7 reserved); dlnr-middlebury 1988x2880 (10.1 GiB peak allocated, 12.7 reserved)
  • dlnr-middlebury: same network and settings as dlnr-sceneflow, measured once (rows not repeated).
  • dlnr-sceneflow 994x1482, first call: portable + torch.compile 69 s (cold Inductor cache), TensorRT fp16 161 s (ONNX + engine).
  • dlnr-sceneflow load / first call: original 0.83 s / 1.712 s (375x1242), portable 0.63 s / 0.399† s, kernels 0.26† s / 0.213† s
  • dlnr-middlebury load / first call: original 0.83 s / 1.712 s (375x1242), portable 0.63 s / 0.399† s, kernels 0.26† s / 0.213† s
  • † 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
dlnr-sceneflowETH3D two-view train, bad > 1 px % / EPE30.26 / 5.93130.27 / 5.92430.26 / 5.93530.26 / 5.94030.27 / 5.944
dlnr-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE11.42 / 1.65011.43 / 1.65011.42 / 1.65111.43 / 1.65011.42 / 1.650
dlnr-middleburyETH3D two-view train, bad > 1 px % / EPE34.41 / 5.84534.41 / 5.85334.40 / 5.84834.38 / 5.83534.38 / 5.868
dlnr-middleburyMiddlebury 2014 trainingH, bad > 2 px % / EPE7.17 / 0.9897.18 / 0.9887.18 / 0.9887.18 / 0.9887.18 / 0.992trained on this dataset's public images; not a zero-shot result

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

variantkernels error vs original, mean / p99GPU, torchkernels used
dlnr-sceneflow0.00216 / 0.03303RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, igev@f075827d68c6:sm_120, raft@9524a68234cc:sm_120
dlnr-middlebury0.00161 / 0.02686RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, igev@f075827d68c6:sm_120, raft@9524a68234cc:sm_120

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