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 |
655.9 | 389.1 | 326.99 | 225.4 | 1.7x | 1.5x | 2791 / 2970 | 2006 / 2474 | 1725 / 1930 |
cas-gwcnet-gc-sceneflow |
862.8 | β | 471.55 | 357.52 | β | 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β |
Fixed-size speed and peak memory, all models
| model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
|---|---|---|---|---|---|
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
Parity with the original code
Every variant is checked against golden 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") # portable PyTorch on the GPU if there is one, else the CPU
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.