Models · Stereo matching

AANet

A stereo network that aggregates matching costs with sparse deformable sampling across scales, trained on synthetic SceneFlow data.

stable Fork of haofeixu/aanet@8d0d747 · backends: portable, kernels

Checkpoint

Paper 2020 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 101 ms 994x1482, fp16
vs the faster original 1.8× original fp16: 178 ms
Peak memory 536 MiB original: 1,000 MiB
Accuracy vs original fp32 ±0.00 kernels bad px %, ETH3D two-view train (14.64 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("aanet-sceneflow")  # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench aanet-sceneflow

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 fp32deformable conv via torchvision.ops.deform_conv2d (original CUDA extension not built)fp32 2890.62×1,785 MiB/1,962 MiB––
Original fp16torch.autocast(fp16) around the forward; deformable conv via torchvision.ops.deform_conv2d (original CUDA extension not built)fp16 178–1,000 MiB/1,126 MiB––
Portable fp32fp32not measured ––––
Portablefp16 1401.3×845 MiB/986 MiB0.20.14
Kernelsfp16 1011.8×536 MiB/644 MiB0.30.10
Portable + torch.compile 91.81.9×754 MiB/928 MiB80 (build)–
TensorRT fp16fp16 91.22.0×482 MiBenginenot comparable211 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-01 to 2026-11-03. 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-14Originalfp32813 3,710 MiB processmatches994x1482
Portablefp161141 3,626 MiB processmatches994x1482
Portablefp32912 3,604 MiB processmatches994x1482
Kernelsfp16631 2,606 MiB processmatches994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16192 819 MiB/922 MiB–994x1482
Kernelsfp16140 502 MiB/620 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1662.7 819 MiB/922 MiB–994x1482
Kernelsfp1644.7 502 MiB/620 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp16148 819 MiB/922 MiB–994x1482
Kernelsfp16105 502 MiB/620 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1682.0 819 MiB/922 MiB–994x1482
Kernelsfp1649.6 502 MiB/620 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1636.8 843 MiB/982 MiB–994x1482
Kernelsfp1620.9 502 MiB/620 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

aanet_sceneflow.pth 16.3 MB· hosted on Google Drive

fastforks downloads and checks these files on first use (fastforks download aanet-sceneflow).

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 % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp3214.640.697 reference 27 66.1
Original fp16fp1614.630.697 +0.01 27 77.2
Portable fp32fp3214.640.698 ±0.00 27 87.8
Portablefp1614.630.697 +0.01 27 48.8
Kernelsfp1614.640.698 ±0.00 27 31.1
Original .half()fp1614.610.698 +0.03 27 54.4

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16, original .half(): RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Middlebury 2014 trainingH

bad > 2 px % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp3232.156.305 reference 15 257
Original fp16fp1632.156.301 ±0.00 15 169
Portable fp32fp3232.156.306 ±0.00 15 260
Portablefp1632.166.301 −0.01 15 126
Kernelsfp1632.166.303 −0.01 15 90.0
Original .half()fp1632.136.301 +0.02 15 136

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16, original .half(): RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; 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.00403 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.04845 px

Recorded for aanet-sceneflow on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: cudnn_hacccutlass_convdeform_convigev

Details

AANet (Xu and Zhang 2020): sparse deformable-sampling cost aggregation within and across scales on a 2-D correlation pyramid, without 3-D convolutions.

Input / output
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Input size
any H x W >= 48, padded to a multiple of 48; tested up to 3000x4000 (9,603 MiB allocated)
Outputs
disparity
Checkpoint
plus=false
CUDA kernels
  • deform_convdeformable convolution fused into one kernel
  • 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

  • Only the SceneFlow checkpoints of AANet and AANet+ are included; the original code's KITTI fine-tunes are not.
  • At 375x1242 AANet is launch-bound: portable is about as fast as the original code. At 994x1482 portable is faster but allocates more memory.
Full reference, generated from the repository

A stereo network that aggregates matching costs with sparse deformable sampling across scales, trained on synthetic SceneFlow data.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
aanet-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
289
178
140
101
91.8
91.2
1785 / 1962
1000 / 1126
845 / 986
536 / 644
754 / 928
602 / 620
aanet-plus-sceneflowMiddlebury 2014 half (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
263
194
159
88.9
143
202
3618 / 3896
3652 / 3784
1142 / 1278
813 / 920
3020 / 3716
1786 / 1834
Details
  • Original code: https://github.com/haofeixu/aanet at 8d0d747e69bb
  • Code licence: Apache-2.0 (permissive); files: LICENSE
  • Weights licence: Apache-2.0 (assumed from code)
  • Licence evidence: https://github.com/haofeixu/aanet/blob/8d0d747e69bbdba43e2578b60ad7df63ba7fdac2/LICENSE
  • Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa)
  • Kernel libraries: deform_conv, igev, cutlass_conv, cudnn_hacc
  • Variants: aanet-sceneflow, aanet-plus-sceneflow
  • Outputs: disparity
  • Input size:
    • aanet-sceneflow: any H x W >= 48, padded to a multiple of 48
    • aanet-plus-sceneflow: any H x W >= 96, padded to a multiple of 96
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): aanet-sceneflow 3000x4000 (9.4 GiB peak allocated, 12.5 reserved); aanet-plus-sceneflow 1024x2048 (7.1 GiB peak allocated, 8.1 reserved)
  • aanet-sceneflow 994x1482, first call: portable + torch.compile 80 s (cold Inductor cache), TensorRT fp16 211 s (ONNX + engine).
  • aanet-plus-sceneflow 994x1482, first call: portable + torch.compile 89 s (cold Inductor cache), TensorRT fp16 145 s (ONNX + engine).
  • aanet-sceneflow original (fp32) 994x1482: deformable conv via torchvision.ops.deform_conv2d (original CUDA extension not built)
  • aanet-sceneflow original 994x1482: torch.autocast(fp16) around the forward; deformable conv via torchvision.ops.deform_conv2d (original CUDA extension not built)
  • aanet-plus-sceneflow original (fp32) 994x1482: deformable conv via torchvision.ops.deform_conv2d (original CUDA extension not built)
  • aanet-plus-sceneflow original 994x1482: torch.autocast(fp16) around the forward; deformable conv via torchvision.ops.deform_conv2d (original CUDA extension not built)
  • aanet-sceneflow load / first call: original 0.12 s / 0.067 s (375x1242), portable 0.19 s / 0.143† s, kernels 0.27† s / 0.101† s
  • aanet-plus-sceneflow load / first call: original 0.15 s / 0.701 s (375x1242), portable 0.16 s / 0.166† s, kernels 0.2† s / 0.09† 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 fp16original halfportableportable fp32kernelsnote
aanet-sceneflowETH3D two-view train, bad > 1 px % / EPE14.64 / 0.69714.63 / 0.69714.61 / 0.69814.63 / 0.69714.64 / 0.69814.64 / 0.698
aanet-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE32.15 / 6.30532.15 / 6.30132.13 / 6.30132.16 / 6.30132.15 / 6.30632.16 / 6.303
aanet-plus-sceneflowETH3D two-view train, bad > 1 px % / EPE18.48 / 0.81118.50 / 0.81218.71 / 0.82018.50 / 0.81118.48 / 0.81118.50 / 0.812
aanet-plus-sceneflowMiddlebury 2014 trainingH, bad > 2 px % / EPE29.84 / 6.23729.85 / 6.23629.86 / 6.29729.86 / 6.23729.84 / 6.23729.86 / 6.232

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.

variantkernels error vs original, mean / p99GPU, torchkernels used
aanet-sceneflow0.00403 / 0.04845RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, deform_conv@a38662ea1bfc:sm_120, igev@f075827d68c6:sm_120
aanet-plus-sceneflow0.00295 / 0.02185RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, deform_conv@a38662ea1bfc:sm_120, igev@f075827d68c6:sm_120

Limitations

  • Only the SceneFlow checkpoints of AANet and AANet+ are included; the original code's KITTI fine-tunes are not.
  • At 375x1242 AANet is launch-bound: portable is about as fast as the original code. At 994x1482 portable is faster but allocates more memory.

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).