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 313 216 196 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โ€ 

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)
nmrf-sceneflow 994x1482 216 160.8 84.8 183.7 142 196 1510 / 1552 854 / 1104 826

Fixed-size speed and peak memory, all models

model mode 480x640 720x1280 1080x1920 12 MP 3000x4000
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

Apple silicon (MPS)

model portable kernels speed-up
nmrf-sceneflow 455 ms / 2408 MiB (float32) 365 ms / 1425 MiB 1.24x

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

On public datasets

Original = the authors' code, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
nmrf-sceneflow ETH3D two-view train, bad > 1 px % / EPE 3.78 / 0.311 3.81 / 0.312 3.81 / 0.311 3.81 / 0.311
nmrf-sceneflow Middlebury 2014 trainingH, bad > 2 px % / EPE 13.36 / 2.920 13.35 / 2.914 13.35 / 2.915 13.35 / 2.915

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 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.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")  # 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: 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