PSMNet (fastforks)

PSMNet (Chang and Chen 2018): spatial-pyramid features, a concatenation 3-D cost volume with three stacked 3-D hourglasses and soft-argmin regression (max disparity 192).

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/JiaRenChang/PSMNet at 87ac9093afbf.

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
psmnet-sceneflow@1 pretrained_sceneflow_new.tar eb3029f7ed5e 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/JiaRenChang/PSMNet/blob/87ac9093afbf6545c093bd9d26c5ffd66e49a7b8/README.md#L96-L98

Input size

any H x W >= 241, padded to a multiple of 16 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): psmnet-sceneflow 1988x2880 (7.6 GiB peak allocated, 10.6 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
psmnet-sceneflow 759.6 607.8 339.98 231.81 2.6x 1.5x 6015 / 6090 2078 / 2442 1786 / 2122

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
psmnet-sceneflow 0.20 (375x1242) 0.10 0.08โ€  0.53 (375x1242) 0.35โ€  0.23โ€ 

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
psmnet-sceneflow portable 69.0 ms / 426 / 606 206.2 ms / 1256 / 1780 479.2 ms / 2834 / 3966 OOM
psmnet-sceneflow kernels 49.6 ms / 415 / 518 140.3 ms / 1108 / 1414 329.2 ms / 2459 / 3104 OOM

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.002 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("psmnet-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: psmnet-sceneflow.

Kernels backend

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