Flor commited on
Commit
da07ccb
·
0 Parent(s):

fastforks 0.1.0

Browse files
Files changed (2) hide show
  1. .gitattributes +35 -0
  2. README.md +131 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: "fastforks"
3
+ pipeline_tag: "depth-estimation"
4
+ license: "mit"
5
+ tags:
6
+ - "stereo"
7
+ - "stereo-matching"
8
+ - "disparity"
9
+ - "cuda"
10
+ - "pytorch"
11
+ - "fastforks"
12
+ ---
13
+ # LiteAnyStereo V2 (fastforks)
14
+
15
+ 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).
16
+
17
+ 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`.
18
+
19
+ Author weight repos: <https://huggingface.co/tomtomtommi/LiteAnyStereoV2>.
20
+
21
+ Task: stereo. Tier: experimental. Outputs: `disparity`. Backends: `portable`, `kernels`.
22
+
23
+ Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
24
+
25
+ ## Variants
26
+
27
+ 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).
28
+
29
+ | variant | weights (author link) | SHA-256 | weights licence | commercial use |
30
+ |---|---|---|---|---|
31
+ | `las2-h@1` | [LAS2_H.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/main/LAS2_H.pth) | `758585a25c3a` | MIT | yes |
32
+ | `las2-l@1` | [LAS2_L.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/main/LAS2_L.pth) | `12f86f758b0a` | MIT | yes |
33
+ | `las2-m@1` | [LAS2_M.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/main/LAS2_M.pth) | `c41b61efce9b` | MIT | yes |
34
+ | `las2-s@1` | [LAS2_S.pth](https://huggingface.co/tomtomtommi/LiteAnyStereoV2/resolve/main/LAS2_S.pth) | `dda5ad549571` | MIT | yes |
35
+
36
+ ## Licence
37
+
38
+ Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: `LICENSE`.
39
+
40
+ 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.
41
+
42
+ - 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.
43
+
44
+ Licence evidence: <https://huggingface.co/tomtomtommi/LiteAnyStereoV2/blob/17788d91618646fa781a14462e2926a034b9f49d/README.md#L2>
45
+
46
+ ## Input size
47
+
48
+ any H x W >= 32, padded to a multiple of 32
49
+ 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)
50
+
51
+ ## Speed and memory
52
+
53
+ ### Stereo, Middlebury 2014 half, 994x1482
54
+
55
+ | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
56
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
57
+ | `las2-h` | 204.8 | 134.9 | 122.8 | 53.27 | 2.5x | 2.3x | 1022 / 1084 | 1050 / 1110 | 1021 / 1388 |
58
+ | `las2-l` | 153.5 | 90.8 | 80.32 | 29.92 | 3.0x | 2.7x | 1010 / 1082 | 1036 / 1098 | 397 / 600 |
59
+ | `las2-m` | 79.1 | 52.4 | 54.13 | 18.29 | 2.9x | 3.0x | 948 / 1000 | 972 / 1026 | 329 / 572 |
60
+ | `las2-s` | 62.0 | 43.5 | 46.86 | 14.35 | 3.0x | 3.3x | 933 / 978 | 955 / 988 | 320 / 558 |
61
+
62
+ ### Startup and first call
63
+
64
+ | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
65
+ | --- | --- | --- | --- | --- | --- | --- |
66
+ | `las2-h` | 0.26 (375x1242) | 0.18 | 0.13† | 1.21 (375x1242) | 0.14† | 0.06† |
67
+ | `las2-l` | 0.39 (375x1242) | 0.23 | 0.18† | 0.04 (375x1242) | 0.08† | 0.03† |
68
+ | `las2-m` | 0.17 (375x1242) | 0.12 | 0.10† | 0.02 (375x1242) | 0.05† | 0.02† |
69
+ | `las2-s` | 0.11 (375x1242) | 0.09 | 0.07† | 0.02 (375x1242) | 0.05† | 0.01† |
70
+
71
+ ### Fixed-size speed and peak memory, all models
72
+
73
+ | model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
74
+ | --- | --- | --- | --- | --- | --- |
75
+ | `las2-h` | portable | 29.8 ms / 269 / 328 | 69.1 ms / 668 / 904 | 174.8 ms / 1386 / 2168 | 1408.7 ms / 8708 / 12018 |
76
+ | `las2-h` | kernels | 10.2 ms / 218 / 596 | 28.5 ms / 604 / 1636 | 73.6 ms / 1344 / 1648 | 512.5 ms / 9695 / 12606 |
77
+ | `las2-l` | portable | 25.5 ms / 286 / 328 | 51.1 ms / 653 / 700 | 110.1 ms / 1317 / 1404 | 824.0 ms / 7201 / 7598 |
78
+ | `las2-l` | kernels | 6.6 ms / 129 / 270 | 16.8 ms / 241 / 676 | 38.6 ms / 422 / 588 | 254.6 ms / 2174 / 2896 |
79
+ | `las2-m` | portable | 18.9 ms / 219 / 252 | 35.4 ms / 586 / 648 | 73.9 ms / 1249 / 1358 | 602.8 ms / 7135 / 7584 |
80
+ | `las2-m` | kernels | 4.0 ms / 96 / 258 | 9.2 ms / 187 / 618 | 21.5 ms / 346 / 516 | 146.5 ms / 1870 / 2684 |
81
+ | `las2-s` | portable | 16.1 ms / 202 / 234 | 31.0 ms / 569 / 632 | 64.4 ms / 1232 / 1342 | 532.1 ms / 7119 / 7566 |
82
+ | `las2-s` | kernels | 3.0 ms / 88 / 246 | 6.9 ms / 179 / 602 | 16.6 ms / 338 / 500 | 109.3 ms / 1859 / 2598 |
83
+
84
+ Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
85
+
86
+ Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code 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.
87
+
88
+ ## Accuracy
89
+
90
+ ### On public datasets
91
+
92
+ Original = the authors' code, same checkpoint and protocol.
93
+
94
+ | variant | dataset | original | portable | kernels | note |
95
+ |---|---|---|---|---|---|
96
+ | `las2-s` | ETH3D two-view train, bad > 1 px % / EPE | | 4.10 / 0.382 | 4.09 / 0.382 | possibly in the training data |
97
+ | `las2-s` | Middlebury 2014 trainingH, bad > 2 px % / EPE | | 16.18 / 3.460 | 16.18 / 3.462 | possibly in the training data |
98
+ | `las2-m` | ETH3D two-view train, bad > 1 px % / EPE | 2.97 / 0.310 | 2.97 / 0.310 | 2.98 / 0.310 | possibly in the training data |
99
+ | `las2-m` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 11.24 / 2.324 | 11.23 / 2.324 | 11.22 / 2.323 | possibly in the training data |
100
+ | `las2-l` | ETH3D two-view train, bad > 1 px % / EPE | | 2.24 / 0.268 | 2.25 / 0.269 | possibly in the training data |
101
+ | `las2-l` | Middlebury 2014 trainingH, bad > 2 px % / EPE | | 11.85 / 2.614 | 11.85 / 2.614 | possibly in the training data |
102
+ | `las2-h` | ETH3D two-view train, bad > 1 px % / EPE | 2.14 / 0.258 | 2.13 / 0.258 | 2.14 / 0.258 | possibly in the training data |
103
+ | `las2-h` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 9.27 / 2.141 | 9.27 / 2.141 | 9.28 / 2.141 | possibly in the training data |
104
+
105
+ Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-27.
106
+
107
+ ### Parity with the original code
108
+
109
+ Every variant is checked against golden 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.
110
+
111
+ ## Limitations
112
+
113
+ - The original code's LAS1 (LiteAnyStereo.pth, another architecture) is not included.
114
+ - Portable LAS2-H is faster than the original code but allocates more memory.
115
+
116
+ ## Usage
117
+
118
+ ```python
119
+ from fastforks import stereo
120
+
121
+ model = stereo.load("las2-h") # portable PyTorch on the GPU if there is one, else the CPU
122
+ result = model("left.png", "right.png")
123
+ result.disparity # [H, W] float32 tensor, input resolution
124
+ result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
125
+ ```
126
+
127
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `las2-h`, `las2-l`, `las2-m`, `las2-s`.
128
+
129
+ ## Kernels backend
130
+
131
+ `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.