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
- Paper Pyramid Stereo Matching Network CVPR 2018 · first released 23 Mar 2018
Checkpoint psmnet-sceneflow
Paper 2018 Added in 0.1.0 Evaluated with 0.2.0
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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 760 | 0.80× | 7,544 MiB/7,640 MiB | – | – |
| Original fp16torch.autocast(fp16) around the forward | fp16 | 608 | – | 6,015 MiB/6,090 MiB | – | – |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 340 | 1.8× | 2,035 MiB/2,422 MiB | 0.3 | 0.34 |
| Kernels | fp16 | 232 | 2.6× | 1,743 MiB/2,002 MiB | 0.6 | 0.23 |
| Portable + torch.compile | 440 | 1.4× | 1,760 MiB/2,082 MiB | 60 (build) | – | |
| TensorRT fp16 | fp16 | 669 | 0.91× | 1,528 MiBenginenot comparable | 89 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 6066 | 10.6 GiB process | matches | 994x1482 |
| Portable | fp16 | 2579 | 6,428 MiB process | matches | 994x1482 | |
| Portable | fp32 | 4615 | 11.0 GiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 360 | 2,043 MiB/2,362 MiB | – | 994x1482 |
| Kernels | fp16 | 290 | 1,752 MiB/2,082 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 132 | 2,043 MiB/2,362 MiB | – | 994x1482 |
| Kernels | fp16 | 90.6 | 1,752 MiB/2,080 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 276 | 2,043 MiB/2,362 MiB | – | 994x1482 |
| Kernels | fp16 | 218 | 1,752 MiB/2,082 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 153 | 2,043 MiB/2,362 MiB | – | 994x1482 |
| Kernels | fp16 | 91.3 | 1,752 MiB/2,082 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 93.1 | 2,043 MiB/2,422 MiB | – | 994x1482 |
| Kernels | fp16 | 48.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
-
- Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa) research-only, non-commercial
- 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 Drivefastforks 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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 15.14 | 2.152 | reference | 27 | 221 |
| Original fp16 | fp16 | 15.13 | 2.152 | +0.01 | 27 | 197 |
| Portable fp32 | fp32 | 15.12 | 2.151 | +0.02 | 27 | 140 |
| Portable | fp16 | 15.11 | 2.154 | +0.03 | 27 | 86.1 |
| Kernels | fp16 | 15.13 | 2.148 | +0.01 | 27 | 63.0 |
| Original .half() | fp16 | 15.11 | 2.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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 36.06 | 11.482 | reference | 15 | 725 |
| Original fp16 | fp16 | 36.06 | 11.484 | ±0.00 | 15 | 628 |
| Portable fp32 | fp32 | 36.07 | 11.484 | −0.01 | 15 | 486 |
| Portable | fp16 | 36.06 | 11.484 | ±0.00 | 15 | 292 |
| Kernels | fp16 | 36.07 | 11.482 | −0.01 | 15 | 198 |
| Original .half() | fp16 | 36.06 | 11.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.
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 px | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.05 px | 0.00412 px |
| GPU default dtypes, p99 |diff| | ≤ 0.5 px | 0.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 gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_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.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
psmnet-sceneflow | Middlebury 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-sceneflow1988x2880 (7.6 GiB peak allocated, 10.6 reserved) psmnet-sceneflow994x1482, first call: portable + torch.compile 60 s (cold Inductor cache), TensorRT fp16 89 s (ONNX + engine).psmnet-scenefloworiginal 994x1482: torch.autocast(fp16) around the forwardpsmnet-sceneflowload / 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.
| variant | dataset | original fp32 | original fp16 | original half | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|---|
psmnet-sceneflow | ETH3D two-view train, bad > 1 px % / EPE | 15.14 / 2.152 | 15.13 / 2.152 | 15.11 / 2.154 | 15.11 / 2.154 | 15.12 / 2.151 | 15.13 / 2.148 | |
psmnet-sceneflow | Middlebury 2014 trainingH, bad > 2 px % / EPE | 36.06 / 11.482 | 36.06 / 11.484 | 36.06 / 11.484 | 36.06 / 11.484 | 36.07 / 11.484 | 36.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.
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
psmnet-sceneflow | 0.00412 / 0.01422 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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).
Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).