Models · Stereo matching

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

Checkpoint crestereo-eth3d

Paper 2022 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 229 ms 994x1482, fp16
vs the faster original 7.0× original fp16: 1597 ms
Peak memory 644 MiB original: 1,541 MiB
Accuracy vs original fp32 +0.01 kernels bad px %, ETH3D two-view train (1.40 original)

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.

BackenddtypeTime per call (ms)vs original fp16Peak 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 19800.81×1,605 MiB/1,870 MiB1.31.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=Truefp16 1597–1,541 MiB/1,752 MiB0.11.50
Portable fp32fp32not measured ––––
Portablefp16 7322.2×884 MiB/1,030 MiB0.00.75
Kernelsfp16 2297.0×644 MiB/732 MiB0.00.23
Portable + torch.compile 3984.0×695 MiB/748 MiB120 (build)–
TensorRT fp16fp16 2985.4×584 MiBenginenot comparable224 (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

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-13Originalfp3215862 4,683 MiB processmatches994x1482
Portablefp163746 2,745 MiB processmatches994x1482
Portablefp324771 3,776 MiB processmatches994x1482
Kernelsfp163342 2,804 MiB processmatches994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16934 786 MiB/946 MiB–994x1482
Kernelsfp16318 617 MiB/648 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16275 786 MiB/946 MiB–994x1482
Kernelsfp16102 617 MiB/648 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16661 786 MiB/946 MiB–994x1482
Kernelsfp16255 617 MiB/648 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16283 786 MiB/946 MiB–994x1482
Kernelsfp16108 617 MiB/648 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp16128 810 MiB/966 MiB–994x1482
Kernelsfp1660.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
  • 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 Drive

fastforks 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

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp321.400.185 reference 27 544
Original fp16fp161.390.185 +0.01 27 439
Portable fp32fp321.400.185 ±0.00 27 317
Portablefp161.390.184 +0.01 27 184
Kernelsfp161.390.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

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp324.890.693 reference 15 1686
Original fp16fp164.860.693 +0.03 15 1262
Portable fp32fp325.050.717 −0.16 15 1159
Portablefp164.840.699 +0.05 15 625
Kernelsfp164.860.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.

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 pxnot recorded
GPU default dtypes, mean |diff|≤ 0.02 px0.00231 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.03308 px
real_gpu_mean≤ 0.25 pxnot recorded
real_gpu_p99≤ 5 pxnot 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 correlation
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • igevIGEV stereo: convolution epilogues, correlation lookups, GRU gates
  • cutlass_convCUTLASS convolutions with the recurrent update (GRU) fused in
  • cudnn_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.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
crestereo-eth3dMiddlebury 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-eth3d 3000x4000 (6.4 GiB peak allocated, 8.8 reserved)
  • crestereo-eth3d 994x1482, first call: portable + torch.compile 120 s (cold Inductor cache), TensorRT fp16 224 s (ONNX + engine).
  • crestereo-eth3d original (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-eth3d original 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=True
  • crestereo-eth3d load / 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.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
crestereo-eth3dETH3D two-view train, bad > 1 px % / EPE1.40 / 0.1851.39 / 0.1851.39 / 0.1841.40 / 0.1851.39 / 0.184trained 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-eth3dMiddlebury 2014 trainingH, bad > 2 px % / EPE4.89 / 0.6934.86 / 0.6934.84 / 0.6995.05 / 0.7174.86 / 0.693trained 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).

variantkernels error vs original, mean / p99GPU, torchkernels used
crestereo-eth3d0.00231 / 0.03308RTX 5060 Ti, torch 2.14.1+cu130crestereo@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).

Left view
Right view
Output
Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), left view
Left view · 100%

Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).