Models · Stereo matching

PSMNet

A classic stereo network by Jia-Ren Chang with a spatial-pyramid backbone and stacked 3D hourglasses.

stable Fork of JiaRenChang/PSMNet@87ac909 · backends: portable, kernels

Checkpoint psmnet-sceneflow

Paper 2018 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 232 ms 994x1482, fp16
vs the faster original 2.6× original fp16: 608 ms
Peak memory 1,743 MiB original: 6,015 MiB
Accuracy vs original fp32 +0.01 kernels bad px %, ETH3D two-view train (15.14 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import stereo

model = stereo.load("psmnet-sceneflow")  # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench psmnet-sceneflow

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 7600.80×7,544 MiB/7,640 MiB––
Original fp16torch.autocast(fp16) around the forwardfp16 608–6,015 MiB/6,090 MiB––
Portable fp32fp32not measured ––––
Portablefp16 3401.8×2,035 MiB/2,422 MiB0.30.34
Kernelsfp16 2322.6×1,743 MiB/2,002 MiB0.60.23
Portable + torch.compile 4401.4×1,760 MiB/2,082 MiB60 (build)–
TensorRT fp16fp16 6690.91×1,528 MiBenginenot comparable89 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp326066 10.6 GiB processmatches994x1482
Portablefp162579 6,428 MiB processmatches994x1482
Portablefp324615 11.0 GiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16360 2,043 MiB/2,362 MiB–994x1482
Kernelsfp16290 1,752 MiB/2,082 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16132 2,043 MiB/2,362 MiB–994x1482
Kernelsfp1690.6 1,752 MiB/2,080 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16276 2,043 MiB/2,362 MiB–994x1482
Kernelsfp16218 1,752 MiB/2,082 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16153 2,043 MiB/2,362 MiB–994x1482
Kernelsfp1691.3 1,752 MiB/2,082 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1693.1 2,043 MiB/2,422 MiB–994x1482
Kernelsfp1648.9 1,752 MiB/2,080 MiB–994x1482

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
MIT LICENSE
Weights
MIT (assumed from code)(not stated by the authors; assumed to follow the code) source
Training data
  • weights licence not stated by the original authors; assumed to be the code licence

Our reading of the licences, not legal advice.

Weights

pretrained_sceneflow_new.tar 21.1 MB· hosted on Google Drive

fastforks downloads and checks these files on first use (fastforks download psmnet-sceneflow).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

ETH3D two-view train

bad > 1 px % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp3215.142.152 reference 27 221
Original fp16fp1615.132.152 +0.01 27 197
Portable fp32fp3215.122.151 +0.02 27 140
Portablefp1615.112.154 +0.03 27 86.1
Kernelsfp1615.132.148 +0.01 27 63.0
Original .half()fp1615.112.154 +0.03 27 200

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16, original .half(): RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Middlebury 2014 trainingH

bad > 2 px % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp3236.0611.482 reference 15 725
Original fp16fp1636.0611.484 ±0.00 15 628
Portable fp32fp3236.0711.484 −0.01 15 486
Portablefp1636.0611.484 ±0.00 15 292
Kernelsfp1636.0711.482 −0.01 15 198
Original .half()fp1636.0611.484 ±0.00 15 641

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16, original .half(): RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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.

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 pxnot recorded
GPU default dtypes, mean |diff|≤ 0.05 px0.00412 px
GPU default dtypes, p99 |diff|≤ 0.5 px0.01422 px

Recorded for psmnet-sceneflow on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: cudnn_hacccutlass_convigev

Details

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).

Input / output
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Input size
any H x W >= 241, padded to a multiple of 16; tested up to 1988x2880 (7,790 MiB allocated)
Outputs
disparity
CUDA kernels
  • igevIGEV stereo: convolution epilogues, correlation lookups, GRU gates
  • cutlass_convCUTLASS convolutions with the recurrent update (GRU) fused in
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

A classic stereo network by Jia-Ren Chang with a spatial-pyramid backbone and stacked 3D hourglasses.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
psmnet-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
760
608
340
232
440
669
7544 / 7640
6015 / 6090
2035 / 2422
1743 / 2002
1760 / 2082
1611 / 1630
Details
  • Original code: https://github.com/JiaRenChang/PSMNet at 87ac9093afbf
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: MIT (assumed from code)
  • Licence evidence: https://github.com/JiaRenChang/PSMNet/blob/87ac9093afbf6545c093bd9d26c5ffd66e49a7b8/README.md#L96-L98
  • Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
  • Kernel libraries: igev, cutlass_conv, cudnn_hacc
  • Variants: psmnet-sceneflow
  • Outputs: disparity
  • 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)
  • psmnet-sceneflow 994x1482, first call: portable + torch.compile 60 s (cold Inductor cache), TensorRT fp16 89 s (ONNX + engine).
  • psmnet-sceneflow original 994x1482: torch.autocast(fp16) around the forward
  • psmnet-sceneflow load / first call: original 0.2 s / 0.525 s (375x1242), portable 0.3 s / 0.321 s (375x1242), kernels 0.59 s / 0.163 s (375x1242)
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16original halfportableportable fp32kernelsnote
psmnet-sceneflowETH3D two-view train, bad > 1 px % / EPE15.14 / 2.15215.13 / 2.15215.11 / 2.15415.11 / 2.15415.12 / 2.15115.13 / 2.148
psmnet-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE36.06 / 11.48236.06 / 11.48436.06 / 11.48436.06 / 11.48436.07 / 11.48436.07 / 11.482

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Parity

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.

variantkernels error vs original, mean / p99GPU, torchkernels used
psmnet-sceneflow0.00412 / 0.01422RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Left view
Right view
Output
Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), left view
Left view · 100%

Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).