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 977.6 597.7 398.18 213.87 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โ€ 

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
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 as dlnr-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

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, 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")  # 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: 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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support