--- library_name: "fastforks" pipeline_tag: "depth-estimation" license: "other" license_name: "apache-2.0-code-weights-unstated" license_link: "https://github.com/megvii-research/CREStereo/blob/ad3a1613bdedd88b93247e5f002cb7c80799762d/README.md#L82" tags: - "stereo" - "stereo-matching" - "disparity" - "cuda" - "pytorch" - "fastforks" --- # CREStereo (fastforks) CREStereo (Li et al. 2022): cascaded recurrent stereo with adaptive group correlation (2-D / 1-D local search, learned offsets, cross attention at 1/16), a 1/16 -> 1/8 -> 1/4 GRU cascade and two passes (half, then full resolution) of 20 iterations each. 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: . Kernels for the `kernels` backend: . Original code: at `ad3a1613bded`. 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`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/stereo/models/crestereo/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `crestereo-eth3d@1` | [crestereo_eth3d.mge](https://drive.usercontent.google.com/download?id=1Wx_-zDQh7BUFBmN9im_26DFpnf3AkXj4&export=download&confirm=t) | `6a11b16a121d` | Apache-2.0 (assumed from code) | yes | ## Licence Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Files: `LICENSE`. Code licence: Apache-2.0; the authors do not state a separate weights licence. Training data: CREStereo synthetic stereo dataset (Megvii), Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa), MPI Sintel stereo, Middlebury stereo (2014), ETH3D two-view stereo, KITTI stereo 2012 / 2015, NVIDIA Falling Things (FAT), InStereo2K, HR-VS (high-resolution virtual stereo, Yang et al. CVPR 2019) (the datasets original README lists as used for training; which of them the released checkpoint saw is not stated). Licence evidence: ## Input size any H x W >= 33, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `crestereo-eth3d` 3000x4000 (6.4 GiB peak allocated, 8.8 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 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `crestereo-eth3d` | – | 1925.0 | 731.79 | 228.95 | 8.4x | 3.2x | – | 884 / 1030 | 644 / 732 | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `crestereo-eth3d` | – | 0.03 | 0.03† | – | 0.75† | 0.23† | ### 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) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `crestereo-eth3d` | 994x1482 | 731.79 | 397.7 | 120.3 | 297.8 | 224 | 228.95 | 884 / 1030 | 695 / 748 | 584 | ### Fixed-size speed and peak memory, all models | model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 | | --- | --- | --- | --- | --- | --- | | `crestereo-eth3d` | portable | 142.5 ms / 214 / 284 | 427.8 ms / 556 / 740 | 1022.9 ms / 1172 / 1568 | 6466.7 ms (n=3) / 6508 / 8990 | | `crestereo-eth3d` | kernels | 61.8 ms / 216 / 292 | 145.2 ms / 552 / 792 | 311.2 ms / 1162 / 1638 | 1767.7 ms / 6427 / 9362 | ### Apple silicon (MPS) | model | `portable` | `kernels` | speed-up | | --- | --- | --- | --- | | `crestereo-eth3d` | 1265 ms / 1597 MiB (float16) | 1104 ms / 1642 MiB | 1.15x | Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB). Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (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 | portable | kernels | note | |---|---|---|---|---|---| | `crestereo-eth3d` | ETH3D two-view train, bad > 1 px % / EPE | 1.40 / 0.185 | 1.39 / 0.184 | 1.38 / 0.184 | trained on this dataset's public images; not a zero-shot result | | `crestereo-eth3d` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 5.16 / 0.753 | 4.84 / 0.699 | 4.86 / 0.699 | trained on this dataset's public images; not a zero-shot result | Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-27. ### 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.02 px and p99 <= 0.25 px. ## Limitations - CUDA output (float16, kernels, float32 with PyTorch's default TF32 convolutions) differs from the CPU by ~0.1-0.2 px mean / 3 px p99 at 720x1280, 0.03 px with full float32: rounding amplified by 2 x 20 GRU iterations. Portable and kernels reach the same ETH3D / Middlebury accuracy. - Middlebury accuracy differs from the original code (about -0.3 bad-%; the original run padded differently). ## Usage ```python from fastforks import stereo model = stereo.load("crestereo-eth3d") # 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 ). Other variants: `crestereo-eth3d`. ## Kernels backend `stereo.load("crestereo-eth3d", mode="kernels")` runs our CUDA kernels (`crestereo`, `fastbb`, `igev`, `cutlass_conv`, `cudnn_hacc`). It needs a prebuilt kernel for your GPU architecture (downloaded from 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.