GwcNet
A classic stereo network by Xiaoyang Guo et al. that builds a group-wise correlation cost volume.
stable Fork of xy-guo/GwcNet@0987074 · backends: portable, kernels
- Paper Group-wise Correlation Stereo Network CVPR 2019 · first released 10 Mar 2019
Paper 2019 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("gwcnet-gc-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 gwcnet-gc-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 | 632 | 0.58× | 8,252 MiB/8,822 MiB | – | – |
| Original fp16torch.autocast(fp16) around the forward | fp16 | 365 | – | 5,887 MiB/6,214 MiB | – | – |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 353 | 1.0× | 2,082 MiB/2,402 MiB | 0.4 | 0.35 |
| Kernels | fp16 | 257 | 1.4× | 1,768 MiB/1,962 MiB | 0.4 | 0.26 |
| Portable + torch.compile | 420 | 0.87× | 1,774 MiB/2,246 MiB | 84 (build) | – | |
| TensorRT fp16 | fp16 | 669 | 0.55× | 2,644 MiBenginenot comparable | 117 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-03. Median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls. 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 | out of memory | – | 994x1482 | |
| Portable | fp16 | 2455 | 7,108 MiB process | matches | 994x1482 | |
| Portable | fp32 | 4461 | 12.1 GiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 413 | 1,801 MiB/2,102 MiB | – | 994x1482 |
| Kernels | fp16 | 342 | 1,783 MiB/2,322 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 152 | 1,801 MiB/2,102 MiB | – | 994x1482 |
| Kernels | fp16 | 109 | 1,783 MiB/2,322 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 297 | 1,801 MiB/2,102 MiB | – | 994x1482 |
| Kernels | fp16 | 244 | 1,765 MiB/1,942 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 166 | 1,801 MiB/2,102 MiB | – | 994x1482 |
| Kernels | fp16 | 97.7 | 1,765 MiB/1,942 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 104 | 2,047 MiB/2,142 MiB | – | 994x1482 |
| Kernels | fp16 | 56.7 | 1,765 MiB/1,942 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
sceneflow/gwcnet-gc/checkpoint_000015.ckpt 83.1 MB· inside a 298 MB archive· hosted on Google Drivefastforks downloads and checks these files on first use (fastforks download gwcnet-gc-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 | 10.97 | 1.794 | reference | 27 | 147 |
| Original fp16 | fp16 | 10.97 | 1.794 | ±0.00 | 27 | 88.1 |
| Portable fp32 | fp32 | 10.97 | 1.794 | ±0.00 | 27 | 152 |
| Portable | fp16 | 10.95 | 1.787 | +0.02 | 27 | 86.9 |
| Kernels | fp16 | 10.96 | 1.793 | +0.01 | 27 | 64.7 |
| Original .half() | fp16 | 10.95 | 1.787 | +0.02 | 27 | 84.9 |
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 | 25.63 | 6.967 | reference | 15 | 533 |
| Original fp16 | fp16 | 25.63 | 6.970 | ±0.00 | 15 | 308 |
| Portable fp32 | fp32 | 25.63 | 6.971 | ±0.00 | 15 | 527 |
| Portable | fp16 | 25.63 | 6.968 | ±0.00 | 15 | 299 |
| Kernels | fp16 | 25.63 | 6.974 | ±0.00 | 15 | 218 |
| Original .half() | fp16 | 25.61 | 6.968 | +0.02 | 15 | 295 |
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.00494 px |
| GPU default dtypes, p99 |diff| | ≤ 0.5 px | 0.01739 px |
Recorded for gwcnet-gc-sceneflow on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: cudnn_hacccutlass_convigev
Details
GwcNet (Guo et al. 2019): group-wise correlation 3-D cost volume, 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 >= 32, padded to a multiple of 32; tested up to 3000x4000 (13.6 GiB allocated)
- Outputs
disparity- Checkpoint
concat_volume=true- 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
Limitations
- The original code's KITTI 2012 / 2015 fine-tuned weights are not included.
- The dominant 3D convolutions run in cuDNN in both modes, so kernels gains less over portable than for other stereo models. Portable is slightly slower than the original code at 994x1482 but allocates less than half the memory.
Full reference, generated from the repository
A classic stereo network by Xiaoyang Guo et al. that builds a group-wise correlation cost volume.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
gwcnet-gc-sceneflow | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 632 365 353 257 420 669 | 8252 / 8822 5887 / 6214 2082 / 2402 1768 / 1962 1774 / 2246 2732 / 2786 |
gwcnet-g-sceneflow | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 604 352 344 238 417 275 | 6691 / 7280 5105 / 5414 2081 / 2402 1799 / 2102 1527 / 1864 3634 / 3648 |
Details
- Original code: https://github.com/xy-guo/GwcNet at
0987074f48b0 - Code licence: MIT (permissive); files:
LICENSE - Weights licence: MIT (assumed from code)
- Licence evidence: https://github.com/xy-guo/GwcNet/blob/0987074f48b098c6e975a58ca5aacf233b0fb0eb/README.md#L27
- Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
- Kernel libraries:
igev,cutlass_conv,cudnn_hacc - Variants:
gwcnet-gc-sceneflow,gwcnet-g-sceneflow - Outputs: disparity
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
gwcnet-gc-sceneflow3000x4000 (13.6 GiB peak allocated, 13.7 reserved);gwcnet-g-sceneflow3000x4000 (13.3 GiB peak allocated, 14.8 reserved) gwcnet-gc-sceneflow994x1482, first call: portable + torch.compile 84 s (cold Inductor cache), TensorRT fp16 117 s (ONNX + engine).gwcnet-g-sceneflow994x1482, first call: portable + torch.compile 53 s (cold Inductor cache), TensorRT fp16 66 s (ONNX + engine).gwcnet-gc-scenefloworiginal 994x1482: torch.autocast(fp16) around the forwardgwcnet-g-scenefloworiginal 994x1482: torch.autocast(fp16) around the forwardgwcnet-gc-sceneflowload / first call: original 0.29 s / 0.119 s (375x1242), portable 0.39 s / 0.353† s, kernels 0.44† s / 0.258† sgwcnet-g-sceneflowload / first call: original 0.26 s / 0.46 s (375x1242), portable 0.4 s / 0.344† s, kernels 0.14† s / 0.238† s- † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
- Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls
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 |
|---|---|---|---|---|---|---|---|---|
gwcnet-gc-sceneflow | ETH3D two-view train, bad > 1 px % / EPE | 10.97 / 1.794 | 10.97 / 1.794 | 10.95 / 1.787 | 10.95 / 1.787 | 10.97 / 1.794 | 10.96 / 1.793 | |
gwcnet-gc-sceneflow | Middlebury 2014 trainingH, bad > 2 px % / EPE | 25.63 / 6.967 | 25.63 / 6.970 | 25.61 / 6.968 | 25.63 / 6.968 | 25.63 / 6.971 | 25.63 / 6.974 | |
gwcnet-g-sceneflow | ETH3D two-view train, bad > 1 px % / EPE | 9.60 / 0.620 | 9.60 / 0.622 | 9.60 / 0.624 | 9.60 / 0.624 | 9.59 / 0.622 | 9.59 / 0.621 | |
gwcnet-g-sceneflow | Middlebury 2014 trainingH, bad > 2 px % / EPE | 25.84 / 6.712 | 25.84 / 6.714 | 25.82 / 6.713 | 25.84 / 6.713 | 25.84 / 6.714 | 25.84 / 6.713 |
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 |
|---|---|---|---|
gwcnet-gc-sceneflow | 0.00494 / 0.01739 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120 |
gwcnet-g-sceneflow | 0.00375 / 0.01272 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120 |
Limitations
- The original code's KITTI 2012 / 2015 fine-tuned weights are not included.
- The dominant 3D convolutions run in cuDNN in both modes, so kernels gains less over portable than for other stereo models. Portable is slightly slower than the original code at 994x1482 but allocates less than half the memory.
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).