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
- Paper High-Frequency Stereo Matching Network CVPR 2023 · first released 18 Jun 2023
Paper 2023 Added in 0.1.0 Evaluated with 0.2.0
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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 978 | 0.61× | 3,191 MiB/3,608 MiB | – | – |
| Original fp16 | fp16 | 598 | – | 3,004 MiB/3,552 MiB | – | – |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 398 | 1.5× | 2,635 MiB/3,142 MiB | 0.6 | 0.40 |
| Kernels | fp16 | 214 | 2.8× | 1,236 MiB/1,606 MiB | 0.3 | 0.21 |
| Portable + torch.compile | 301 | 2.0× | 1,343 MiB/1,672 MiB | 69 (build) | – | |
| TensorRT fp16 | fp16 | 241 | 2.5× | 1,492 MiBenginenot comparable | 161 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12 | Original | fp32 | 3258 | 7,469 MiB process | matches | 994x1482 |
| Portable | fp16 | 2143 | 4,094 MiB process | matches | 994x1482 | |
| Portable | fp32 | 2699 | 6,162 MiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 460 | 2,608 MiB/3,016 MiB | – | 994x1482 |
| Kernels | fp16 | 293 | 1,210 MiB/1,384 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 143 | 2,608 MiB/3,016 MiB | – | 994x1482 |
| Kernels | fp16 | 94.6 | 1,210 MiB/1,382 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 346 | 2,608 MiB/3,016 MiB | – | 994x1482 |
| Kernels | fp16 | 224 | 1,080 MiB/1,262 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 141 | 2,608 MiB/3,016 MiB | – | 994x1482 |
| Kernels | fp16 | 95.4 | 1,210 MiB/1,382 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 76.4 | 2,632 MiB/3,216 MiB | – | 994x1482 |
| Kernels | fp16 | 48.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
-
- Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa) research-only, non-commercial
- 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 GitHubfastforks 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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 30.26 | 5.931 | reference | 27 | 238 |
| Original fp16 | fp16 | 30.27 | 5.924 | −0.01 | 27 | 151 |
| Portable fp32 | fp32 | 30.26 | 5.940 | ±0.00 | 27 | 175 |
| Portable | fp16 | 30.26 | 5.935 | ±0.00 | 27 | 97.0 |
| Kernels | fp16 | 30.27 | 5.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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 11.42 | 1.650 | reference | 15 | 829 |
| Original fp16 | fp16 | 11.43 | 1.650 | −0.01 | 15 | 510 |
| Portable fp32 | fp32 | 11.43 | 1.650 | −0.01 | 15 | 641 |
| Portable | fp16 | 11.42 | 1.651 | ±0.00 | 15 | 336 |
| Kernels | fp16 | 11.42 | 1.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.
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 px | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 px | 0.00216 px |
| GPU default dtypes, p99 |diff| | ≤ 0.25 px | 0.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, upsamplingigevIGEV stereo: convolution epilogues, correlation lookups, GRU gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_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.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
dlnr-sceneflow | Middlebury 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-sceneflow1988x2880 (10.1 GiB peak allocated, 12.7 reserved);dlnr-middlebury1988x2880 (10.1 GiB peak allocated, 12.7 reserved) dlnr-middlebury: same network and settings asdlnr-sceneflow, measured once (rows not repeated).dlnr-sceneflow994x1482, first call: portable + torch.compile 69 s (cold Inductor cache), TensorRT fp16 161 s (ONNX + engine).dlnr-sceneflowload / first call: original 0.83 s / 1.712 s (375x1242), portable 0.63 s / 0.399† s, kernels 0.26† s / 0.213† sdlnr-middleburyload / 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.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
dlnr-sceneflow | ETH3D two-view train, bad > 1 px % / EPE | 30.26 / 5.931 | 30.27 / 5.924 | 30.26 / 5.935 | 30.26 / 5.940 | 30.27 / 5.944 | |
dlnr-sceneflow | Middlebury 2014 trainingH, bad > 2 px % / EPE | 11.42 / 1.650 | 11.43 / 1.650 | 11.42 / 1.651 | 11.43 / 1.650 | 11.42 / 1.650 | |
dlnr-middlebury | ETH3D two-view train, bad > 1 px % / EPE | 34.41 / 5.845 | 34.41 / 5.853 | 34.40 / 5.848 | 34.38 / 5.835 | 34.38 / 5.868 | |
dlnr-middlebury | Middlebury 2014 trainingH, bad > 2 px % / EPE | 7.17 / 0.989 | 7.18 / 0.988 | 7.18 / 0.988 | 7.18 / 0.988 | 7.18 / 0.992 | trained 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.
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
dlnr-sceneflow | 0.00216 / 0.03303 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, igev@f075827d68c6:sm_120, raft@9524a68234cc:sm_120 |
dlnr-middlebury | 0.00161 / 0.02686 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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).
Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).