CoEx
A stereo network on a MobileNetV2 backbone with guided cost excitation (correlate and excite).
stable Fork of antabangun/coex@a98b37d · backends: portable, kernels
- Paper Correlate-and-Excite: Real-Time Stereo Matching via Guided Cost Volume Excitation IROS 2021 · first released 12 Aug 2021
Checkpoint coex-sceneflow
Paper 2021 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[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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 94.9 | 0.63× | 2,292 MiB/2,384 MiB | – | – |
| Original fp16torch.autocast(fp16) around the forward | fp16 | 60.0 | – | 2,098 MiB/2,160 MiB | – | – |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 49.9 | 1.2× | 1,093 MiB/1,174 MiB | 0.3 | 0.05 |
| Kernels | fp16 | 23.5 | 2.6× | 368 MiB/514 MiB | 0.6 | 0.02 |
| Portable + torch.compile | 29.4 | 2.0× | 351 MiB/452 MiB | 22 (build) | – | |
| TensorRT fp16 | fp16 | 20.6 | 2.9× | 360 MiBenginenot comparable | 57 (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-12 | Original | fp32 | 1024 | 5,473 MiB process | matches | 994x1482 |
| Portable | fp16 | 411 | 3,576 MiB process | matches | 994x1482 | |
| Portable | fp32 | 784 | 5,183 MiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 66.5 | 1,102 MiB/1,214 MiB | – | 994x1482 |
| Kernels | fp16 | 32.4 | 444 MiB/654 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 21.9 | 1,102 MiB/1,214 MiB | – | 994x1482 |
| Kernels | fp16 | 11.9 | 444 MiB/654 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 62.2 | 1,102 MiB/1,214 MiB | – | 994x1482 |
| Kernels | fp16 | 27.3 | 420 MiB/554 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 32.6 | 1,102 MiB/1,214 MiB | – | 994x1482 |
| Kernels | fp16 | 16.3 | 447 MiB/634 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 14.9 | 1,102 MiB/1,194 MiB | – | 994x1482 |
| Kernels | fp16 | 6.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
-
- Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa) research-only, non-commercial
- 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 Dropboxfastforks 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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 33.43 | 16.021 | reference | 27 | 22.3 |
| Original fp16 | fp16 | 33.46 | 15.995 | −0.03 | 27 | 18.6 |
| Portable fp32 | fp32 | 33.43 | 16.017 | ±0.00 | 27 | 22.8 |
| Portable | fp16 | 33.46 | 15.989 | −0.03 | 27 | 17.5 |
| Kernels | fp16 | 33.46 | 16.000 | −0.03 | 27 | 12.3 |
| Original .half() | fp16 | 33.46 | 15.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
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 32.25 | 7.417 | reference | 15 | 82.2 |
| Original fp16 | fp16 | 32.24 | 7.418 | +0.01 | 15 | 67.1 |
| Portable fp32 | fp32 | 32.31 | 7.416 | −0.06 | 15 | 84.0 |
| Portable | fp16 | 32.32 | 7.428 | −0.07 | 15 | 59.2 |
| Kernels | fp16 | 32.31 | 7.421 | −0.06 | 15 | 28.4 |
| Original .half() | fp16 | 32.21 | 7.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.
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 px | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 px | 0.00104 px |
| GPU default dtypes, p99 |diff| | ≤ 0.25 px | 0.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 gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_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.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
coex-sceneflow | Middlebury 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-sceneflow3000x4000 (8.5 GiB peak allocated, 10.7 reserved) coex-sceneflow994x1482, first call: portable + torch.compile 22 s (cold Inductor cache), TensorRT fp16 57 s (ONNX + engine).coex-scenefloworiginal 994x1482: torch.autocast(fp16) around the forwardcoex-sceneflowload / 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.
| variant | dataset | original fp32 | original fp16 | original half | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|---|
coex-sceneflow | ETH3D two-view train, bad > 1 px % / EPE | 33.43 / 16.021 | 33.46 / 15.995 | 33.46 / 15.987 | 33.46 / 15.989 | 33.43 / 16.017 | 33.46 / 16.000 | |
coex-sceneflow | Middlebury 2014 trainingH, bad > 2 px % / EPE | 32.25 / 7.417 | 32.24 / 7.418 | 32.21 / 7.423 | 32.32 / 7.428 | 32.31 / 7.416 | 32.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.
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
coex-sceneflow | 0.00104 / 0.00449 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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).
Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).