Models · Stereo matching

CoEx

A stereo network on a MobileNetV2 backbone with guided cost excitation (correlate and excite).

stable Fork of antabangun/coex@a98b37d · backends: portable, kernels

Checkpoint coex-sceneflow

Paper 2021 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 23.5 ms 994x1482, fp16
vs the faster original 2.6× original fp16: 60.0 ms
Peak memory 368 MiB original: 2,098 MiB
Accuracy vs original fp32 −0.03 kernels bad px %, ETH3D two-view train (33.43 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install "fastforks-core[nc]"

from fastforks import stereo

model = stereo.load("coex-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 coex-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 94.90.63×2,292 MiB/2,384 MiB––
Original fp16torch.autocast(fp16) around the forwardfp16 60.0–2,098 MiB/2,160 MiB––
Portable fp32fp32not measured ––––
Portablefp16 49.91.2×1,093 MiB/1,174 MiB0.30.05
Kernelsfp16 23.52.6×368 MiB/514 MiB0.60.02
Portable + torch.compile 29.42.0×351 MiB/452 MiB22 (build)–
TensorRT fp16fp16 20.62.9×360 MiBenginenot comparable57 (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-12Originalfp321024 5,473 MiB processmatches994x1482
Portablefp16411 3,576 MiB processmatches994x1482
Portablefp32784 5,183 MiB processmatches994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1666.5 1,102 MiB/1,214 MiB–994x1482
Kernelsfp1632.4 444 MiB/654 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1621.9 1,102 MiB/1,214 MiB–994x1482
Kernelsfp1611.9 444 MiB/654 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1662.2 1,102 MiB/1,214 MiB–994x1482
Kernelsfp1627.3 420 MiB/554 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1632.6 1,102 MiB/1,214 MiB–994x1482
Kernelsfp1616.3 447 MiB/634 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1614.9 1,102 MiB/1,194 MiB–994x1482
Kernelsfp166.43 420 MiB/514 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
GPL-3.0-only LICENSE
Weights
GPL-3.0-only (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
  • The code is GPL-3.0 (copyleft) and ships in the separate fastforks-nc distribution (`pip install 'fastforks-core[nc]'`); the authors state no weights licence.

Our reading of the licences, not legal advice.

Weights

sceneflow.ckpt 33.2 MB· hosted on Dropbox

fastforks downloads and checks these files on first use (fastforks download coex-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 fp32fp3233.4316.021 reference 27 22.3
Original fp16fp1633.4615.995 −0.03 27 18.6
Portable fp32fp3233.4316.017 ±0.00 27 22.8
Portablefp1633.4615.989 −0.03 27 17.5
Kernelsfp1633.4616.000 −0.03 27 12.3
Original .half()fp1633.4615.987 −0.03 27 15.0

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 fp32fp3232.257.417 reference 15 82.2
Original fp16fp1632.247.418 +0.01 15 67.1
Portable fp32fp3232.317.416 −0.06 15 84.0
Portablefp1632.327.428 −0.07 15 59.2
Kernelsfp1632.317.421 −0.06 15 28.4
Original .half()fp1632.217.423 +0.04 15 46.0

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.02 px and p99 <= 0.25 px.

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 pxnot recorded
GPU default dtypes, mean |diff|≤ 0.02 px0.00104 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.00449 px

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

Details

CoEx (Bangunharcana et al. 2021): MobileNetV2 features, an attention-weighted correlation volume, 3-D aggregation with guided cost excitation, top-2 soft-argmax and superpixel upsampling (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 (8,660 MiB allocated)
Options
  • cuda_graphs=true
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)
  • stereo_opsstereo building blocks: cost volume, soft-argmax, upsampling
Apple (MPS)
fp32, fp16

Limitations

  • SceneFlow-only weights: zero-shot output on real images is poor, so this is mainly a latency reference.
  • The original code's KITTI weights (in its git repository) are not included.
Full reference, generated from the repository

A stereo network on a MobileNetV2 backbone with guided cost excitation (correlate and excite).

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
coex-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
94.9
60.0
49.9
23.5
29.4
20.6
2292 / 2384
2098 / 2160
1093 / 1174
368 / 514
351 / 452
438 / 452
Details
  • Original code: https://github.com/antabangun/coex at a98b37d33f37
  • Code licence: GPL-3.0-only (copyleft); files: LICENSE
  • Weights licence: GPL-3.0-only (assumed from code)
  • Licence evidence: https://github.com/antabangun/coex/blob/a98b37d33f37754582b1e71f38216af8c69f2347/LICENSE
  • Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
  • Licence note: The code is GPL-3.0 (copyleft) and ships in the separate fastforks-nc distribution (pip install 'fastforks-core[nc]'); the authors state no weights licence.
  • Options: cuda_graphs = True (speed only)
  • Kernel libraries: igev, cutlass_conv, cudnn_hacc, stereo_ops
  • Variants: coex-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): coex-sceneflow 3000x4000 (8.5 GiB peak allocated, 10.7 reserved)
  • coex-sceneflow 994x1482, first call: portable + torch.compile 22 s (cold Inductor cache), TensorRT fp16 57 s (ONNX + engine).
  • coex-sceneflow original 994x1482: torch.autocast(fp16) around the forward
  • coex-sceneflow load / first call: original – s / 0.629 s (375x1242), portable 0.27 s / 0.7 s (375x1242), kernels 0.57 s / 0.481 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
coex-sceneflowETH3D two-view train, bad > 1 px % / EPE33.43 / 16.02133.46 / 15.99533.46 / 15.98733.46 / 15.98933.43 / 16.01733.46 / 16.000
coex-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE32.25 / 7.41732.24 / 7.41832.21 / 7.42332.32 / 7.42832.31 / 7.41632.31 / 7.421

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.02 px and p99 <= 0.25 px.

variantkernels error vs original, mean / p99GPU, torchkernels used
coex-sceneflow0.00104 / 0.00449RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120, stereo_ops@899b54f4a755:sm_120

Limitations

  • SceneFlow-only weights: zero-shot output on real images is poor, so this is mainly a latency reference.
  • The original code's KITTI weights (in its git repository) are not included.

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