Models · Stereo matching

HITNet

Google Research's tile-based stereo model; the authors' ETH3D and Middlebury versions, ported to PyTorch.

stable Fork of google-research/google-research@f200f2b · backends: portable, kernels

Checkpoint

Paper 2020 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 23.2 ms 994x1482, fp16
vs the faster original 7.9× original fp16: 182 ms
Peak memory 623 MiB original: 2,433 MiB
Accuracy vs original fp32 +0.01 kernels bad px %, ETH3D two-view train (0.94 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("hitnet-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 hitnet-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 fp32TensorFlow 2.21.0 frozen graph eth3d.pb, float32fp32 2340.78×2,961 MiB2.62.44
Original fp16TensorFlow 2.21.0 frozen graph eth3d.pb, auto_mixed_precision graph rewrite (float16)fp16 182–2,433 MiB0.32.06
Portable fp32fp32not measured ––––
Portablefp16 67.62.7×848 MiB/1,068 MiB0.20.07
Kernelsfp16 23.27.9×623 MiB/770 MiB0.30.03
Portable + torch.compile 27.76.6×719 MiB/728 MiB39 (build)–
TensorRT fp16fp16 31.15.9×836 MiBenginenot comparable136 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-06 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. 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-13Originalfp32cannot run here–994x1482
Portablefp16501 5,510 MiB processmatches994x1482
Portablefp32484 5,503 MiB processmatches994x1482
Kernelsfp16136 2,486 MiB processmatches994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1694.1 857 MiB/1,088 MiB–994x1482
Kernelsfp1631.4 632 MiB/770 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1631.2 857 MiB/1,088 MiB–994x1482
Kernelsfp1611.0 632 MiB/770 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1665.4 857 MiB/1,088 MiB–994x1482
Kernelsfp1628.3 632 MiB/770 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1632.2 857 MiB/1,088 MiB–994x1482
Kernelsfp1616.9 632 MiB/770 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp1614.4 857 MiB/1,068 MiB–994x1482
Kernelsfp166.22 632 MiB/770 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
  • The authors state no weights licence; the checkpoints are fetched from the PINTO model-zoo mirror (a third-party host), not from Google, and the code licence is assumed to cover them.

Our reading of the licences, not legal advice.

Weights

eth3d.pb 3.4 MB· inside a 440 MB archive· hosted on s3.ap-northeast-2.wasabisys.com

fastforks downloads and checks these files on first use (fastforks download hitnet-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 fp32fp320.940.164 reference 27 101
Original fp16fp160.930.165 +0.01 27 88.5
Portable fp32fp320.930.164 +0.01 27 27.4
Portablefp160.930.164 +0.01 27 21.2
Kernelsfp160.930.164 +0.01 27 9.55

Original = the authors’ code, 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 % / EPE

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp3217.268.332 reference 15 1078
Original fp16fp1617.308.356 −0.04 15 946
Portable fp32fp3217.288.348 −0.02 15 98.8
Portablefp1617.258.340 +0.01 15 65.0
Kernelsfp1617.278.297 −0.01 15 21.9

Original = the authors’ code, 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.02 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.15 px and p99 <= 1.0 px.

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.02 pxnot recorded
GPU default dtypes, mean |diff|≤ 0.15 px0.00343 px
GPU default dtypes, p99 |diff|≤ 1 px0.02548 px
real_gpu_mean≤ 0.3 pxnot recorded
real_gpu_p99≤ 6 pxnot recorded

Recorded for hitnet-eth3d on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: hitnethitnet_conv

Details

HITNet (Tankovich et al. 2021): slanted tile hypotheses propagated and refined from coarse to fine; the authors' ETH3D (gray, max disparity 128) and Middlebury (half resolution, max disparity 400) graphs.

Input / output
Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
Input size
any H x W >= 8, resized or padded inside the model; tested up to 3000x4000 (6,558 MiB allocated)
Options
  • cuda_graphs=true
Outputs
disparity
Checkpoint
in_ch=1, channels=[16,16,24,24,32], disparities=[8,16,32,64,128], refine_channels=[32,32,16], refine_dilations=[[1,3,1,1],[1,3,1,1],[1,1]], refine_sad_scale=[0,0,0], pad_multiple=64, pad_value=0, pad_value_right=0
CUDA kernels
  • hitnetHITNet: cost initialisation, tile and warp matching
  • hitnet_convHITNet: fused convolutions
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.2 px mean / 4 px p99 at 720x1280: the argmin flips on near-equal tile costs. Full float32 (`torch.backends.cudnn.allow_tf32 = False`) matches the CPU to 0.00002 px.
  • The weights are the authors' frozen TensorFlow graphs read without TensorFlow; the FlyingThings and Middlebury d160 / d288 graphs are not included.
  • The original code is TensorFlow (frozen graph run with TensorFlow 2.21 on the GPU); its time is the upstream row, its memory is the TensorFlow peak (TensorFlow has no reserved-memory counter).
Full reference, generated from the repository

Google Research's tile-based stereo model; the authors' ETH3D and Middlebury versions, ported to PyTorch.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
hitnet-eth3dsynthetic (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
234
182
67.6
23.2
27.7
31.1
2961 / –
2433 / –
848 / 1068
623 / 770
719 / 728
912 / 920
hitnet-middlebury-d400synthetic (994x1482)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
637
483
176
53.1
71.5
74.9
7157 / –
6831 / –
1701 / 2154
1207 / 1514
1296 / 1332
1985 / 2014
Details
  • Original code: https://github.com/google-research/google-research at f200f2b89d29
  • Code licence: Apache-2.0 (permissive); files: LICENSE
  • Weights licence: Apache-2.0 (assumed from code)
  • Licence evidence: https://github.com/google-research/google-research/blob/f200f2b89d29484bf0dd0fef0c3979ac8bed9af4/LICENSE
  • Training data: not stated by the authors
    • hitnet-eth3d: ETH3D two-view stereo (fine-tuned on the ETH3D training pairs (paper); any pre-training data is not stated by the authors)
    • hitnet-middlebury-d400: Middlebury stereo (2014) (trained for half-resolution Middlebury images (README); any pre-training data is not stated by the authors)
  • Licence note: The authors state no weights licence; the checkpoints are fetched from the PINTO model-zoo mirror (a third-party host), not from Google, and the code licence is assumed to cover them.
  • Options: cuda_graphs = True (speed only)
  • Kernel libraries: hitnet, hitnet_conv
  • Variants: hitnet-eth3d, hitnet-middlebury-d400
  • Outputs: disparity
  • Input size: any H x W >= 8, resized or padded inside the model
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): hitnet-eth3d 3000x4000 (6.4 GiB peak allocated, 10.8 reserved); hitnet-middlebury-d400 1988x2880 (6.4 GiB peak allocated, 10.1 reserved)
  • hitnet-eth3d 994x1482, first call: portable + torch.compile 39 s (cold Inductor cache), TensorRT fp16 136 s (ONNX + engine).
  • hitnet-middlebury-d400 994x1482, first call: portable + torch.compile 55 s (cold Inductor cache), TensorRT fp16 166 s (ONNX + engine).
  • hitnet-eth3d original (fp32) 994x1482: TensorFlow 2.21.0 frozen graph eth3d.pb, float32
  • hitnet-eth3d original 994x1482: TensorFlow 2.21.0 frozen graph eth3d.pb, auto_mixed_precision graph rewrite (float16)
  • hitnet-middlebury-d400 original (fp32) 994x1482: TensorFlow 2.21.0 frozen graph middlebury_d400.pb, float32
  • hitnet-middlebury-d400 original 994x1482: TensorFlow 2.21.0 frozen graph middlebury_d400.pb, auto_mixed_precision graph rewrite (float16)
  • hitnet-eth3d load / first call: original 0.31 s / 2.061 s, portable 0.18 s / 0.45 s (375x1242), kernels 0.27 s / 0.283 s (375x1242)
  • hitnet-middlebury-d400 load / first call: original 0.57 s / 3.512 s, portable 0.18 s / 0.484 s (375x1242), kernels 0.36 s / 0.227 s (375x1242)
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
hitnet-eth3dETH3D two-view train, bad > 1 px % / EPE0.94 / 0.1640.93 / 0.1650.93 / 0.1640.93 / 0.1640.93 / 0.164trained on this dataset's public images; not a zero-shot result
hitnet-eth3dMiddlebury 2014 trainingH, bad > 2 px % / EPE17.26 / 8.33217.30 / 8.35617.25 / 8.34017.28 / 8.34817.27 / 8.297
hitnet-middlebury-d400ETH3D two-view train, bad > 1 px % / EPE7.02 / 0.8857.00 / 0.8807.01 / 0.8997.03 / 0.8827.07 / 0.875
hitnet-middlebury-d400Middlebury 2014 trainingH, bad > 2 px % / EPE7.50 / 1.1807.51 / 1.1857.54 / 1.1877.50 / 1.1867.51 / 1.168trained on this dataset's public images; not a zero-shot result

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.

Parity

CPU, float32: max |diff| <= 0.02 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.15 px and p99 <= 1.0 px. On real pairs up to 720x1280 the limits are mean 0.3 / p99 6.0 (precision-sensitive there, see Limitations).

variantkernels error vs original, mean / p99GPU, torchkernels used
hitnet-eth3d0.00343 / 0.02548RTX 5060 Ti, torch 2.14.1+cu130hitnet@45145b49dcb1:sm_120, hitnet_conv@e5637e8a93cf:sm_120
hitnet-middlebury-d4000.1139 / 0.74705RTX 5060 Ti, torch 2.14.1+cu130hitnet@45145b49dcb1:sm_120, hitnet_conv@e5637e8a93cf:sm_120

Limitations

  • CUDA output (float16, kernels, float32 with PyTorch's default TF32 convolutions) differs from the CPU by ~0.2 px mean / 4 px p99 at 720x1280: the argmin flips on near-equal tile costs. Full float32 (torch.backends.cudnn.allow_tf32 = False) matches the CPU to 0.00002 px.
  • The weights are the authors' frozen TensorFlow graphs read without TensorFlow; the FlyingThings and Middlebury d160 / d288 graphs are not included.
  • The original code is TensorFlow (frozen graph run with TensorFlow 2.21 on the GPU); its time is the upstream row, its memory is the TensorFlow peak (TensorFlow has no reserved-memory counter).

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