DLNR (fastforks)
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.
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/David-Zhao-1997/High-frequency-Stereo-Matching-Network at c10475fe30ff.
Task: stereo. Tier: experimental. 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 |
|---|---|---|---|---|
dlnr-middlebury@1 |
DLNR_Middlebury.pth | 57e46b8fed66 |
MIT (assumed from code) | yes |
dlnr-sceneflow@1 |
DLNR_SceneFlow.pth | 76e5e6669491 |
MIT (assumed from code) | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: LICENSE.
Code licence: MIT; the authors do not state a separate weights licence.
Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa).
Licence evidence: https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network/blob/c10475fe30ff198781ecc7c712c24c781ff05096/README.md#L84
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): dlnr-middlebury 1988x2880 (10.1 GiB peak allocated, 12.7 reserved); dlnr-sceneflow 1988x2880 (10.1 GiB peak allocated, 12.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 |
|---|---|---|---|---|---|---|---|---|---|
dlnr-middlebury |
978 | 598 | 398 | 214 | 2.8x | 1.9x | 3004 / 3552 | 2635 / 3142 | 1236 / 1606 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
dlnr-middlebury |
0.83 (375x1242) | 0.63 | 0.26โ | 1.71 (375x1242) | 0.40โ | 0.21โ |
torch.compile and TensorRT
| model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) |
|---|---|---|---|---|---|---|---|---|---|---|
dlnr-sceneflow |
994x1482 | 398 | 301.3 | 69.0 | 240.5 | 161 | 214 | 2635 / 3142 | 1343 / 1672 | 1492 |
Fixed-size speed and peak memory, all models
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|---|---|---|---|---|---|
dlnr-middlebury |
portable | 81.8 ms / 623 / 774 | 235.4 ms / 1651 / 2134 | 548.9 ms / 3617 / 4726 | OOM |
dlnr-middlebury |
kernels | 52.8 ms / 372 / 470 | 126.7 ms / 815 / 1070 | 297.2 ms / 1617 / 1958 | 1775.1 ms / 8572 / 12080 |
dlnr-sceneflow |
portable | 81.8 ms / 623 / 774 | 235.2 ms / 1651 / 2134 | 549.1 ms / 3617 / 4726 | OOM |
dlnr-sceneflow |
kernels | 52.9 ms / 372 / 470 | 126.8 ms / 815 / 1070 | 297.4 ms / 1617 / 1958 | 1775.1 ms / 8572 / 12080 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
dlnr-sceneflow: same network and settings asdlnr-middlebury, measured once (rows not repeated).
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 fp32 | original fp16 | portable | 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.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.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.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.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, 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.
Usage
from fastforks import stereo
model = stereo.load("dlnr-middlebury") # 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: dlnr-middlebury, dlnr-sceneflow.
Kernels backend
stereo.load("dlnr-middlebury", mode="kernels") runs our CUDA kernels (raft, 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.