CREStereo
Megvii's cascaded recurrent stereo network, trained on a wide mix of real and synthetic stereo data.
stable Fork of megvii-research/CREStereo@ad3a161 · backends: portable, kernels
- Paper Practical Stereo Matching via Cascaded Recurrent Network with Adaptive Correlation CVPR 2022 · first released 22 Mar 2022
- Authors’ code megvii-research/CREStereo (MegEngine), not the code forked here: MegEngine has no build for current GPUs (sm_120); the benchmarked original is a community PyTorch translation that loads the authors' weights.
Checkpoint crestereo-eth3d
Paper 2022 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
from fastforks import stereo
model = stereo.load("crestereo-eth3d") # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend # what ran: mode, device, dtype, kernels fastforks bench crestereo-eth3d 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 fp32PyTorch 2.14.1+cu130, community port ibaiGorordo/CREStereo-Pytorch @ b6c7a9f, test_model.py inference (2 x 20 iters), BGR, pad 32 (edge) | fp32 | 1980 | 0.81× | 1,605 MiB/1,870 MiB | 1.3 | 1.98 |
| Original fp16PyTorch 2.14.1+cu130, community port ibaiGorordo/CREStereo-Pytorch @ b6c7a9f, test_model.py inference (2 x 20 iters), BGR, pad 32 (edge), the port's mixed_precision=True | fp16 | 1597 | – | 1,541 MiB/1,752 MiB | 0.1 | 1.50 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 732 | 2.2× | 884 MiB/1,030 MiB | 0.0 | 0.75 |
| Kernels | fp16 | 229 | 7.0× | 644 MiB/732 MiB | 0.0 | 0.23 |
| Portable + torch.compile | 398 | 4.0× | 695 MiB/748 MiB | 120 (build) | – | |
| TensorRT fp16 | fp16 | 298 | 5.4× | 584 MiBenginenot comparable | 224 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-03 to 2026-11-06. Median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls. 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-13 | Original | fp32 | 15862 | 4,683 MiB process | matches | 994x1482 |
| Portable | fp16 | 3746 | 2,745 MiB process | matches | 994x1482 | |
| Portable | fp32 | 4771 | 3,776 MiB process | matches | 994x1482 | |
| Kernels | fp16 | 3342 | 2,804 MiB process | matches | 994x1482 | |
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 934 | 786 MiB/946 MiB | – | 994x1482 |
| Kernels | fp16 | 318 | 617 MiB/648 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 275 | 786 MiB/946 MiB | – | 994x1482 |
| Kernels | fp16 | 102 | 617 MiB/648 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 661 | 786 MiB/946 MiB | – | 994x1482 |
| Kernels | fp16 | 255 | 617 MiB/648 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 283 | 786 MiB/946 MiB | – | 994x1482 |
| Kernels | fp16 | 108 | 617 MiB/648 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 128 | 810 MiB/966 MiB | – | 994x1482 |
| Kernels | fp16 | 60.9 | 640 MiB/708 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
- Apache-2.0 LICENSE
- Weights
- Apache-2.0 (assumed from code)(not stated by the authors; assumed to follow the code) source
- Training data
-
- CREStereo synthetic stereo dataset (Megvii) not stated
- Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa) research-only, non-commercial
- MPI Sintel stereo not stated
- Middlebury stereo (2014) not stated
- ETH3D two-view stereo CC-BY-NC-SA-4.0, non-commercial
- KITTI stereo / optical flow 2012 / 2015 CC-BY-NC-SA-3.0, non-commercial
- NVIDIA Falling Things (FAT) CC-BY-NC-SA-4.0, non-commercial
- InStereo2K noncommercial, non-commercial
- HR-VS (high-resolution virtual stereo, Yang et al. CVPR 2019) not stated
- weights licence not stated by the original authors; assumed to be the code licence
Our reading of the licences, not legal advice.
Weights
crestereo_eth3d.mge 21.7 MB· hosted on Google Drivefastforks downloads and checks these files on first use (fastforks download crestereo-eth3d).
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 % / EPEtrained on this dataset’s public images: not zero-shot
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 1.40 | 0.185 | reference | 27 | 544 |
| Original fp16 | fp16 | 1.39 | 0.185 | +0.01 | 27 | 439 |
| Portable fp32 | fp32 | 1.40 | 0.185 | ±0.00 | 27 | 317 |
| Portable | fp16 | 1.39 | 0.184 | +0.01 | 27 | 184 |
| Kernels | fp16 | 1.39 | 0.184 | +0.01 | 27 | 73.3 |
Original = the authors’ code (original = the community PyTorch port (MegEngine 1.13 has no sm_120 build)), same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch null, 2026-11-06; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.
Middlebury 2014 trainingH
bad > 2 px % / EPEtrained on this dataset’s public images: not zero-shot
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 4.89 | 0.693 | reference | 15 | 1686 |
| Original fp16 | fp16 | 4.86 | 0.693 | +0.03 | 15 | 1262 |
| Portable fp32 | fp32 | 5.05 | 0.717 | −0.16 | 15 | 1159 |
| Portable | fp16 | 4.84 | 0.699 | +0.05 | 15 | 625 |
| Kernels | fp16 | 4.86 | 0.693 | +0.03 | 15 | 196 |
Original = the authors’ code (original = the community PyTorch port (MegEngine 1.13 has no sm_120 build)), same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch null, 2026-11-06; 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.00231 px |
| GPU default dtypes, p99 |diff| | ≤ 0.25 px | 0.03308 px |
| real_gpu_mean | ≤ 0.25 px | not recorded |
| real_gpu_p99 | ≤ 5 px | not recorded |
Recorded for crestereo-eth3d on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-02, with these kernels: crestereocudnn_hacccutlass_convfastbbigev
Details
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.
- Input / output
- Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
- Input size
- any H x W >= 33, padded to a multiple of 32; tested up to 3000x4000 (6,508 MiB allocated)
- Options
iters=20>= 1· changes the output
- Outputs
disparity- CUDA kernels
crestereoCREStereo: fused adaptive group correlationfastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbonesigevIGEV stereo: convolution epilogues, correlation lookups, GRU gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
stereo_metalMetal: stereo kernels. fp32, fp16
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.
Full reference, generated from the repository
Megvii's cascaded recurrent stereo network, trained on a wide mix of real and synthetic stereo data.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
crestereo-eth3d | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 1980 1597 732 229 398 298 | 1605 / 1870 1541 / 1752 884 / 1030 644 / 732 695 / 748 703 / 740 |
Details
- Original code: https://github.com/megvii-research/CREStereo at
ad3a1613bded - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0 (assumed from code)
- Licence evidence: https://github.com/megvii-research/CREStereo/blob/ad3a1613bdedd88b93247e5f002cb7c80799762d/README.md#L82
- Training data: CREStereo synthetic stereo dataset (Megvii), Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa), MPI Sintel stereo, Middlebury stereo (2014), ETH3D two-view stereo, KITTI stereo / optical flow 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)
- Options:
iters= 20 (>= 1) - Kernel libraries:
crestereo,fastbb,igev,cutlass_conv,cudnn_hacc - Variants:
crestereo-eth3d - Outputs: disparity
- Input size: any H x W >= 33, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
crestereo-eth3d3000x4000 (6.4 GiB peak allocated, 8.8 reserved) crestereo-eth3d994x1482, first call: portable + torch.compile 120 s (cold Inductor cache), TensorRT fp16 224 s (ONNX + engine).crestereo-eth3doriginal (fp32) 994x1482: PyTorch 2.14.1+cu130, community port ibaiGorordo/CREStereo-Pytorch @ b6c7a9f, test_model.py inference (2 x 20 iters), BGR, pad 32 (edge)crestereo-eth3doriginal 994x1482: PyTorch 2.14.1+cu130, community port ibaiGorordo/CREStereo-Pytorch @ b6c7a9f, test_model.py inference (2 x 20 iters), BGR, pad 32 (edge), the port's mixed_precision=Truecrestereo-eth3dload / first call: original 0.05 s / 1.499 s, portable 0.03 s / 0.75† s, kernels 0.03† s / 0.229† s- † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
- Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls
Measured
Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
crestereo-eth3d | ETH3D two-view train, bad > 1 px % / EPE | 1.40 / 0.185 | 1.39 / 0.185 | 1.39 / 0.184 | 1.40 / 0.185 | 1.39 / 0.184 | trained on this dataset's public images; not a zero-shot result; original = the community PyTorch port (MegEngine 1.13 has no sm_120 build) |
crestereo-eth3d | Middlebury 2014 trainingH, bad > 2 px % / EPE | 4.89 / 0.693 | 4.86 / 0.693 | 4.84 / 0.699 | 5.05 / 0.717 | 4.86 / 0.693 | trained on this dataset's public images; not a zero-shot result; original = the community PyTorch port (MegEngine 1.13 has no sm_120 build) |
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. On real pairs up to 720x1280 the limits are mean 0.25 / p99 5.0 (precision-sensitive there, see Limitations).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
crestereo-eth3d | 0.00231 / 0.03308 | RTX 5060 Ti, torch 2.14.1+cu130 | crestereo@4e3c00b2d395:sm_120, cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, igev@f075827d68c6:sm_120 |
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.
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).