NeuFlow v2 (fastforks)

NeuFlow v2 (Zhang, Gupta, Singh & Jiang 2024): a light optical-flow network for robots and edge devices. A plain convolutional backbone on the image averaged down by 2, 4 and 8, cross-attention and global matching at 1/16 resolution for the initial flow (large motions), then one refinement at 1/16 and 8 at 1/8 with a 9 x 9 correlation lookup and plain 3 x 3 convs (no GRU), convex upsampling. The authors' released weights; the network is ported from neufieldrobotics/NeuFlow_v2. neuflow-v2 is the authors' mixed-dataset checkpoint (their default), -things the FlyingThings3D one (zero-shot elsewhere), -sintel the Sintel fine-tune stage.

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/neufieldrobotics/NeuFlow_v2 at 204b5e374446.

Task: flow. Tier: experimental. Outputs: flow. Backends: portable, kernels.

Input: two RGB images (consecutive frames). Output: per-pixel motion from the first to the second (dx, dy in pixels).

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
neuflow-v2@1 neuflow_mixed.pth 76152c8068f2 Apache-2.0 yes
neuflow-v2-sintel@1 neuflow_sintel.pth 9bc12c9ef829 Apache-2.0 yes
neuflow-v2-things@1 neuflow_things.pth 733d13b1b220 Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.

Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa), MPI Sintel optical flow, KITTI stereo / optical flow 2012 / 2015, HCI HD1K optical flow benchmark (README: "trained with multiple datasets" (not listed); the mixed stages of upstream's data_utils/datasets.py use FlyingThings3D (part of SceneFlow), Sintel, KITTI 2015, HD1K and, in one stage, VIPER).

Licence evidence: https://huggingface.co/Study-is-happy/neuflow-v2/blob/79ae2f4589456d4d369aaef4955c7db5918c3436/README.md

Input size

any H x W >= 32, padded to a multiple of 16 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): neuflow-v2 1024x2048 (8.2 GiB peak allocated, 9.0 reserved); neuflow-v2-sintel 1024x2048 (8.2 GiB peak allocated, 9.0 reserved); neuflow-v2-things 1024x2048 (8.2 GiB peak allocated, 9.0 reserved)

Speed and memory

Flow, synthetic

model input time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
neuflow-v2 1080x1920 171 75.6 71.2 59.1 1.3x 1.2x 4367 / 4556 2366 / 2398 790 / 896
neuflow-v2-sintel 1080x1920 171 75.7 71.3 58.9 1.3x 1.2x 4367 / 4576 2366 / 2398 790 / 896
neuflow-v2-things 1080x1920 172 75.8 71.4 58.9 1.3x 1.2x 4374 / 4720 2366 / 2398 779 / 896

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
neuflow-v2 0.20 0.26 0.96 (375x1242) 0.22 0.07 0.18 (375x1242)
neuflow-v2-sintel 0.17 1.29 (375x1242) 0.95 (375x1242) 0.08 0.81 (375x1242) 0.18 (375x1242)
neuflow-v2-things 0.17 0.38 0.26 0.08 0.07 0.06

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
neuflow-v2 1080x1920 71.2 ms 91.4 ms 65.0 ms 59.1 ms 28.5 s 104 s 2366 / 2398 4529 / 4558 790 / 896 8710 / 8748
neuflow-v2-sintel 1080x1920 71.3 ms 91.4 ms 64.9 ms 58.9 ms 28.5 s 102 s 2366 / 2398 4529 / 4558 790 / 896 8710 / 8748
neuflow-v2-things 1080x1920 71.4 ms 91.5 ms 65.0 ms 58.9 ms 28.8 s 104 s 2366 / 2398 4529 / 4558 779 / 896 8710 / 8748

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 original code named above 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

Frames _10 -> _11 at full size against the flow_occ ground truth; EPE = mean of the per-pair mean end-point error, Fl-all = share of all valid pixels with an error > 3 px and > 5 % of the GT magnitude. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
neuflow-v2 KITTI 2015 train, EPE / Fl-all % 1.568 / 5.27 1.588 / 5.28 1.579 / 5.28 1.577 / 5.28 trained on this dataset's public images; not a zero-shot result
neuflow-v2-sintel KITTI 2015 train, EPE / Fl-all % 1.566 / 5.61 1.573 / 5.61 1.567 / 5.61 1.566 / 5.61 trained on this dataset's public images; not a zero-shot result
neuflow-v2-things KITTI 2015 train, EPE / Fl-all % 4.099 / 15.02 4.098 / 15.01 4.095 / 15.01 4.095 / 15.01

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks c4a67979, 2026-11-11; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks f3875362, 2026-11-11.

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.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0014 and p99 <= 0.0067 (absolute error of the output flow).

Limitations

  • Portable at 375 x 1242 runs 13.9 ms vs 12.2 ms for the authors' half-precision lookup (14 % slower, 235 vs 310 MB): lookup, matching and upsampling stay float32 on purpose (lower KITTI EPE, all three checkpoints); fp16 lookup output or channels_last gave no speed-up without changing the flow.
  • Kernels (raft_flow) run 12.0 ms / 205 MB, faster than the original, but the binary is not on Hugging Face yet; it is built locally and found through FASTFORKS_KERNEL_PATH.

Usage

from fastforks import flow

model = flow.load("neuflow-v2")  # mode="auto": the preferred backend from recorded measurements
result = model("frame1.png", "frame2.png")
result.flow  # [2, H, W] float32 tensor: dx, dy in input pixels
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: neuflow-v2, neuflow-v2-sintel, neuflow-v2-things.

Kernels backend

flow.load("neuflow-v2", mode="kernels") runs our CUDA kernels (raft_flow). 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

Collection including fastforks/neuflow-v2