Cas-GwcNet (fastforks)
Cas-GwcNet (cascade stereo, Gu et al. 2020): two-stage cascade cost volume (48 then 24 disparity hypotheses, the second narrowed around the first result) on GwcNet-style 3-D hourglasses; group-wise correlation + concatenation (gc) or concatenation (c) volumes.
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/alibaba/cascade-stereo at 2ae7da65515c.
Task: stereo. Tier: experimental. Outputs: disparity. Backends: portable, kernels.
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
cas-gwcnet-c-sceneflow@1 |
casgwcnet-c-2.ckpt | 9d30ee767111 |
MIT (assumed from code) | yes |
cas-gwcnet-gc-sceneflow@1 |
casgwcnet.ckpt | 8a3638501cd5 |
MIT (assumed from code) | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: LICENSE.
Code licence: MIT; the authors do not state a separate weights licence.
Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa).
Licence evidence: https://github.com/alibaba/cascade-stereo/blob/2ae7da65515c82025383a0fbee8d6fe063dc7101/CasStereoNet/README.md#L17-L19
Input size
cas-gwcnet-c-sceneflow: any H x W >= 225, padded to a multiple of 32cas-gwcnet-gc-sceneflow: any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB):cas-gwcnet-c-sceneflow1988x2880 (8.2 GiB peak allocated, 9.2 reserved);cas-gwcnet-gc-sceneflow1988x2880 (9.4 GiB peak allocated, 14.1 reserved)
Speed and memory
Stereo, Middlebury 2014 half, 994x1482
| model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|
cas-gwcnet-c-sceneflow |
656 | 389 | 327 | 225 | 1.7x | 1.5x | 2791 / 2970 | 2006 / 2474 | 1725 / 1930 |
cas-gwcnet-gc-sceneflow |
863 | β | 472 | 358 | β | 1.3x | β | 2338 / 2794 | 2272 / 2514 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
cas-gwcnet-c-sceneflow |
0.48 (375x1242) | 1.29 | 0.18β | 0.41 (375x1242) | 0.33β | 0.23β |
cas-gwcnet-gc-sceneflow |
0.25 (375x1242) | 0.97 | 0.17β | 0.25 (375x1242) | 0.47β | 0.36β |
torch.compile and TensorRT
| model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) |
|---|---|---|---|---|---|---|---|---|---|---|
cas-gwcnet-c-sceneflow |
994x1482 | 327 | 294.6 | 61.7 | 220.3 | 131 | 225 | 2006 / 2474 | 2098 / 2448 | 1440 |
Fixed-size speed and peak memory, all models
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|---|---|---|---|---|---|
cas-gwcnet-c-sceneflow |
portable | 61.3 ms / 465 / 738 | 195.5 ms / 1386 / 2160 | 452.8 ms / 3046 / 4720 | OOM |
cas-gwcnet-c-sceneflow |
kernels | 44.8 ms / 442 / 568 | 135.5 ms / 1242 / 1586 | 316.1 ms / 2692 / 3408 | OOM |
cas-gwcnet-gc-sceneflow |
portable | 86.7 ms / 533 / 1166 | 281.6 ms / 1588 / 3308 | 647.4 ms / 3494 / 7262 | OOM |
cas-gwcnet-gc-sceneflow |
kernels | 66.9 ms / 510 / 956 | 213.7 ms / 1449 / 2606 | 493.8 ms / 3147 / 5634 | OOM |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
Original = the authors' code, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
cas-gwcnet-gc-sceneflow |
ETH3D two-view train, bad > 1 px % / EPE | 8.08 / 0.821 | 99.90 / 13.127 (NaN / inf output) | 8.08 / 0.823 | 8.09 / 0.823 | |
cas-gwcnet-gc-sceneflow |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 23.83 / 6.541 | 99.80 / 70.838 (NaN / inf output) | 23.84 / 6.547 | 23.83 / 6.541 | |
cas-gwcnet-c-sceneflow |
ETH3D two-view train, bad > 1 px % / EPE | 7.85 / 0.512 | 7.83 / 0.513 | 7.84 / 0.512 | 7.85 / 0.513 | |
cas-gwcnet-c-sceneflow |
Middlebury 2014 trainingH, bad > 2 px % / EPE | 30.07 / 8.568 | 29.90 / 8.490 | 30.07 / 8.569 | 30.07 / 8.574 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. 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.
Usage
from fastforks import stereo
model = stereo.load("cas-gwcnet-c-sceneflow") # mode="auto": the preferred backend from recorded measurements
result = model("left.png", "right.png")
result.disparity # [H, W] float32 tensor, input resolution
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: cas-gwcnet-c-sceneflow, cas-gwcnet-gc-sceneflow.
Kernels backend
stereo.load("cas-gwcnet-c-sceneflow", mode="kernels") runs our CUDA kernels (igev, cutlass_conv, cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.