File size: 10,291 Bytes
870cb32 1e0e038 870cb32 eec6f92 870cb32 1e0e038 870cb32 eec6f92 870cb32 eec6f92 870cb32 eec6f92 870cb32 eec6f92 870cb32 eec6f92 870cb32 eec6f92 870cb32 eec6f92 870cb32 eec6f92 870cb32 1e0e038 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | ---
library_name: "fastforks"
pipeline_tag: "depth-estimation"
license: "mit"
tags:
- "stereo"
- "stereo-matching"
- "disparity"
- "cuda"
- "pytorch"
- "fastforks"
- "fastforks-card"
---
# LiteAnyStereo V2 (fastforks)
LiteAnyStereo V2: efficient zero-shot stereo with FasterNet-T0 features, a correlation volume and FasterNet 2-D cost aggregation (sizes S / M / L), or a group-wise volume with a selective-GRU update (H).
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: <https://github.com/kleinicke/fastforks>. Kernels for the `kernels` backend: <https://huggingface.co/fastforks/kernels>. Original code: <https://github.com/TomTomTommi/LiteAnyStereo> at `8c97bd4c4da3`.
Author weight repos: <https://huggingface.co/tomtomtommi/LiteAnyStereoV2>.
Task: stereo. Tier: stable. 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/las2/card.toml).
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
| `las2-h@1` | [LAS2_H.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/17788d91618646fa781a14462e2926a034b9f49d/LAS2_H.pth) | `758585a25c3a` | MIT | yes |
| `las2-l@1` | [LAS2_L.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/17788d91618646fa781a14462e2926a034b9f49d/LAS2_L.pth) | `12f86f758b0a` | MIT | yes |
| `las2-m@1` | [LAS2_M.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/17788d91618646fa781a14462e2926a034b9f49d/LAS2_M.pth) | `c41b61efce9b` | MIT | yes |
| `las2-s@1` | [LAS2_S.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/17788d91618646fa781a14462e2926a034b9f49d/LAS2_S.pth) | `dda5ad549571` | MIT | yes |
## Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Licence files: `LICENSE`.
Training data: Zero-shot model trained on a mixture of synthetic stereo datasets that includes FSD and Dynamic Replica (non-commercial data terms); the repository does not list the data or its terms.
- Licence note: Trained on a mixture that includes NVIDIA's FSD dataset and Dynamic Replica, whose terms for commercial use of trained models are unclear (the repository lists no data terms); the status does not depend on the training data.
Licence evidence: <https://huggingface.co/tomtomtommi/LiteAnyStereoV2/blob/17788d91618646fa781a14462e2926a034b9f49d/README.md#L2>
## Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `las2-h` 3000x4000 (8.5 GiB peak allocated, 11.7 reserved); `las2-l` 3000x4000 (7.0 GiB peak allocated, 7.4 reserved); `las2-m` 3000x4000 (7.0 GiB peak allocated, 7.4 reserved); `las2-s` 3000x4000 (7.0 GiB peak allocated, 7.4 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 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `las2-h` | 205 | 135 | β | β | β | β | 1022 / 1084 | β | β |
| `las2-l` | 154 | 90.8 | 80.3 | 29.9 | 3.0x | 2.7x | 1010 / 1082 | 1036 / 1098 | 397 / 600 |
| `las2-m` | 79.1 | 52.4 | 54.1 | 18.3 | 2.9x | 3.0x | 948 / 1000 | 972 / 1026 | 329 / 572 |
| `las2-s` | 62.0 | 43.5 | 46.9 | 14.3 | 3.0x | 3.3x | 933 / 978 | 955 / 988 | 320 / 558 |
### Stereo, synthetic, 994x1482
| model | time (ms): original fp32 | portable | kernels | kernels speed-up: vs portable | peak memory (MiB, allocated / reserved): portable | kernels |
| --- | --- | --- | --- | --- | --- | --- |
| `las2-h` | β | 113 | 53.8 | 2.1x | 1002 / 1046 | 917 / 1248 |
| `las2-l` | β | 75.7 | β | β | 648 / 716 | β |
| `las2-m` | β | 37.1 | β | β | 584 / 664 | β |
| `las2-s` | β | 27.8 | β | β | 568 / 648 | β |
### Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
| --- | --- | --- | --- | --- | --- | --- |
| `las2-h` | 0.26 (375x1242) | 0.27 (375x1242) | 0.78 (375x1242) | 1.21 (375x1242) | 0.39 (375x1242) | 0.26 (375x1242) |
| `las2-l` | 0.39 (375x1242) | 0.53 (375x1242) | 0.18β | 0.04 (375x1242) | 0.33 (375x1242) | 0.03β |
| `las2-m` | 0.17 (375x1242) | 0.25 (375x1242) | 0.10β | 0.02 (375x1242) | 0.40 (375x1242) | 0.02β |
| `las2-s` | 0.11 (375x1242) | 0.27 (375x1242) | 0.07β | 0.02 (375x1242) | 0.47 (375x1242) | 0.01β |
### torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `las2-h` | 994x1482 | 113 ms | 75.0 ms | planned for 0.2.1 | 53.8 ms | 37.5 s | β | 1002 / 1046 | 579 / 724 | 917 / 1248 | β |
| `las2-l` | 994x1482 | 75.7 ms | 46.6 ms | 23.4 ms | 29.9 ms | 30.5 s | 97.5 s | 648 / 716 | 385 / 432 | 397 / 600 | 393 / 424 |
| `las2-m` | 994x1482 | 37.1 ms | 28.6 ms | 13.2 ms | 18.3 ms | 24.0 s | 98.3 s | 584 / 664 | 252 / 300 | 329 / 572 | 343 / 386 |
| `las2-s` | 994x1482 | 27.8 ms | 23.7 ms | 10.3 ms | 14.3 ms | 22.4 s | 86.9 s | 568 / 648 | 238 / 264 | 320 / 558 | 258 / 304 |
### Fixed-size speed and peak memory, all models
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
| --- | --- | --- | --- | --- | --- |
| `las2-h` | portable | 29.8 ms / 269 / 328 | 69.1 ms / 668 / 904 | 174.8 ms / 1386 / 2168 | 1408.7 ms / 8708 / 12018 |
| `las2-h` | kernels | 10.2 ms / 218 / 596 | 28.5 ms / 604 / 1636 | 73.6 ms / 1344 / 1648 | 512.5 ms / 9695 / 12606 |
| `las2-l` | portable | 25.5 ms / 286 / 328 | 51.1 ms / 653 / 700 | 110.1 ms / 1317 / 1404 | 824.0 ms / 7201 / 7598 |
| `las2-l` | kernels | 6.6 ms / 129 / 270 | 16.8 ms / 241 / 676 | 38.6 ms / 422 / 588 | 254.6 ms / 2174 / 2896 |
| `las2-m` | portable | 18.9 ms / 219 / 252 | 35.4 ms / 586 / 648 | 73.9 ms / 1249 / 1358 | 602.8 ms / 7135 / 7584 |
| `las2-m` | kernels | 4.0 ms / 96 / 258 | 9.2 ms / 187 / 618 | 21.5 ms / 346 / 516 | 146.5 ms / 1870 / 2684 |
| `las2-s` | portable | 16.1 ms / 202 / 234 | 31.0 ms / 569 / 632 | 64.4 ms / 1232 / 1342 | 532.1 ms / 7119 / 7566 |
| `las2-s` | kernels | 3.0 ms / 88 / 246 | 6.9 ms / 179 / 602 | 16.6 ms / 338 / 500 | 109.3 ms / 1859 / 2598 |
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 original code named above 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 original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
| `las2-s` | ETH3D two-view train, bad > 1 px % / EPE | 4.10 / 0.382 | 4.10 / 0.382 | 4.10 / 0.382 | 4.10 / 0.383 | possibly in the training data |
| `las2-s` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 16.19 / 3.464 | 16.18 / 3.460 | 16.18 / 3.460 | 16.18 / 3.461 | possibly in the training data |
| `las2-m` | ETH3D two-view train, bad > 1 px % / EPE | 2.97 / 0.310 | 2.97 / 0.310 | 2.97 / 0.310 | 2.98 / 0.310 | possibly in the training data |
| `las2-m` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 11.24 / 2.324 | 11.23 / 2.324 | 11.23 / 2.324 | 11.24 / 2.324 | possibly in the training data |
| `las2-l` | ETH3D two-view train, bad > 1 px % / EPE | 2.24 / 0.268 | 2.24 / 0.268 | 2.24 / 0.268 | 2.24 / 0.268 | possibly in the training data |
| `las2-l` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 11.87 / 2.615 | 11.85 / 2.614 | 11.85 / 2.614 | 11.85 / 2.614 | possibly in the training data |
| `las2-h` | ETH3D two-view train, bad > 1 px % / EPE | 2.14 / 0.258 | 2.14 / 0.258 | 2.13 / 0.258 | 2.14 / 0.258 | possibly in the training data |
| `las2-h` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 9.27 / 2.141 | 9.28 / 2.141 | 9.27 / 2.141 | 9.27 / 2.141 | possibly in the training data |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.
### Parity with the original code
Every variant is checked against reference 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.05 px and p99 <= 0.5 px.
## Limitations
- The original code's LAS1 (LiteAnyStereo.pth, another architecture) is not included.
- Portable LAS2-H at 375 x 1242 is faster than the original code (35.6 vs 36.4 ms) but peaks 13 MB (3.7 %) higher (365 vs 352 MB).
## Usage
```python
from fastforks import stereo
model = stereo.load("las2-h") # 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 <https://github.com/kleinicke/fastforks>). Other variants: `las2-h`, `las2-l`, `las2-m`, `las2-s`.
## Kernels backend
`stereo.load("las2-h", mode="kernels")` runs our CUDA kernels (`igev`, `cutlass_conv`, `cudnn_hacc`, `stereo_ops`). It needs a prebuilt kernel for your GPU architecture (downloaded from <https://huggingface.co/fastforks/kernels> 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.
<!-- staged from fastforks 1cbf1671 (2026-11-15) -->
|