NMRF (fastforks)

NMRF (Guan et al. 2024): neural Markov random field with disparity proposals from a group-wise cost volume, CSWin label-seed propagation and window-attention inference at 1/8 resolution plus a 1/4 refinement.

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/aeolusguan/NMRF at a50bd8f407ae.

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
nmrf-sceneflow@1 sceneflow.pth e7c4a0a4bfe5 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/aeolusguan/NMRF/blob/a50bd8f407ae481c38f95cf141e1b5256e962cb7/README.md#L103

Input size

any H x W >= 9, padded to a multiple of 8 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): nmrf-sceneflow 3000x4000 (11.0 GiB peak allocated, 13.3 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
nmrf-sceneflow 445.3 312.6 216.44 195.66 1.6x 1.1x 1656 / 2054 1510 / 1552 1022 / 1112

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
nmrf-sceneflow 0.21 (375x1242) 0.10 0.07โ€  0.77 (375x1242) 0.22โ€  0.20โ€ 

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
nmrf-sceneflow portable 35.9 ms / 390 / 454 124.3 ms / 953 / 1094 315.1 ms / 2040 / 2402 2021.2 ms (n=3) / 11263 / 13666
nmrf-sceneflow kernels 31.7 ms / 247 / 298 112.1 ms / 626 / 800 286.8 ms / 1356 / 1814 1834.3 ms / 7543 / 10866

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

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.05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 px and p99 <= 0.5 px.

Usage

from fastforks import stereo

model = stereo.load("nmrf-sceneflow")  # 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: nmrf-sceneflow.

Kernels backend

stereo.load("nmrf-sceneflow", mode="kernels") runs our CUDA kernels (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