Commit ·
f46ad50
0
Parent(s):
fastforks 0.1.0
Browse files- .gitattributes +35 -0
- README.md +120 -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,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: "fastforks"
|
| 3 |
+
pipeline_tag: "depth-estimation"
|
| 4 |
+
license: "other"
|
| 5 |
+
license_name: "mit-code-weights-unstated"
|
| 6 |
+
license_link: "https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network/blob/c10475fe30ff198781ecc7c712c24c781ff05096/README.md#L84"
|
| 7 |
+
tags:
|
| 8 |
+
- "stereo"
|
| 9 |
+
- "stereo-matching"
|
| 10 |
+
- "disparity"
|
| 11 |
+
- "cuda"
|
| 12 |
+
- "pytorch"
|
| 13 |
+
- "fastforks"
|
| 14 |
+
---
|
| 15 |
+
# DLNR (fastforks)
|
| 16 |
+
|
| 17 |
+
DLNR (Zhao et al. 2023): Restormer channel-attention feature extractor, a RAFT-Stereo style 1-D correlation pyramid and 3-level LSTM updates with normalization refinement, 10 iterations.
|
| 18 |
+
|
| 19 |
+
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/David-Zhao-1997/High-frequency-Stereo-Matching-Network> at `c10475fe30ff`.
|
| 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/dlnr/card.toml).
|
| 28 |
+
|
| 29 |
+
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|
| 30 |
+
|---|---|---|---|---|
|
| 31 |
+
| `dlnr-middlebury@1` | [DLNR_Middlebury.pth](https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network/releases/download/v1.0.0/DLNR_Middlebury.pth) | `57e46b8fed66` | MIT (assumed from code) | yes |
|
| 32 |
+
| `dlnr-sceneflow@1` | [DLNR_SceneFlow.pth](https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network/releases/download/v1.0.0/DLNR_SceneFlow.pth) | `76e5e6669491` | MIT (assumed from code) | yes |
|
| 33 |
+
|
| 34 |
+
## Licence
|
| 35 |
+
|
| 36 |
+
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: `LICENSE`.
|
| 37 |
+
|
| 38 |
+
Code licence: MIT; the authors do not state a separate weights licence.
|
| 39 |
+
|
| 40 |
+
Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa).
|
| 41 |
+
|
| 42 |
+
Licence evidence: <https://github.com/David-Zhao-1997/High-frequency-Stereo-Matching-Network/blob/c10475fe30ff198781ecc7c712c24c781ff05096/README.md#L84>
|
| 43 |
+
|
| 44 |
+
## Input size
|
| 45 |
+
|
| 46 |
+
any H x W >= 32, padded to a multiple of 32
|
| 47 |
+
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `dlnr-middlebury` 1988x2880 (10.1 GiB peak allocated, 12.7 reserved); `dlnr-sceneflow` 1988x2880 (10.1 GiB peak allocated, 12.7 reserved)
|
| 48 |
+
|
| 49 |
+
## Speed and memory
|
| 50 |
+
|
| 51 |
+
### Stereo, Middlebury 2014 half, 994x1482
|
| 52 |
+
|
| 53 |
+
| model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|
| 54 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 55 |
+
| `dlnr-middlebury` | 978 | 598 | 398 | 214 | 2.8x | 1.9x | 3004 / 3552 | 2635 / 3142 | 1236 / 1606 |
|
| 56 |
+
|
| 57 |
+
### Startup and first call
|
| 58 |
+
|
| 59 |
+
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|
| 60 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 61 |
+
| `dlnr-middlebury` | 0.83 (375x1242) | 0.63 | 0.26† | 1.71 (375x1242) | 0.40† | 0.21† |
|
| 62 |
+
|
| 63 |
+
### torch.compile and TensorRT
|
| 64 |
+
|
| 65 |
+
| model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) |
|
| 66 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 67 |
+
| `dlnr-sceneflow` | 994x1482 | 398 | 301.3 | 69.0 | 240.5 | 161 | 214 | 2635 / 3142 | 1343 / 1672 | 1492 |
|
| 68 |
+
|
| 69 |
+
### Fixed-size speed and peak memory, all models
|
| 70 |
+
|
| 71 |
+
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|
| 72 |
+
| --- | --- | --- | --- | --- | --- |
|
| 73 |
+
| `dlnr-middlebury` | portable | 81.8 ms / 623 / 774 | 235.4 ms / 1651 / 2134 | 548.9 ms / 3617 / 4726 | OOM |
|
| 74 |
+
| `dlnr-middlebury` | kernels | 52.8 ms / 372 / 470 | 126.7 ms / 815 / 1070 | 297.2 ms / 1617 / 1958 | 1775.1 ms / 8572 / 12080 |
|
| 75 |
+
| `dlnr-sceneflow` | portable | 81.8 ms / 623 / 774 | 235.2 ms / 1651 / 2134 | 549.1 ms / 3617 / 4726 | OOM |
|
| 76 |
+
| `dlnr-sceneflow` | kernels | 52.9 ms / 372 / 470 | 126.8 ms / 815 / 1070 | 297.4 ms / 1617 / 1958 | 1775.1 ms / 8572 / 12080 |
|
| 77 |
+
|
| 78 |
+
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
|
| 79 |
+
|
| 80 |
+
- `dlnr-sceneflow`: same network and settings as `dlnr-middlebury`, measured once (rows not repeated).
|
| 81 |
+
|
| 82 |
+
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.
|
| 83 |
+
|
| 84 |
+
## Accuracy
|
| 85 |
+
|
| 86 |
+
### On public datasets
|
| 87 |
+
|
| 88 |
+
Original = the authors' code, same checkpoint and protocol.
|
| 89 |
+
|
| 90 |
+
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|
| 91 |
+
|---|---|---|---|---|---|---|
|
| 92 |
+
| `dlnr-sceneflow` | ETH3D two-view train, bad > 1 px % / EPE | 30.26 / 5.931 | 30.27 / 5.924 | 30.26 / 5.935 | 30.27 / 5.944 | |
|
| 93 |
+
| `dlnr-sceneflow` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 11.42 / 1.650 | 11.43 / 1.650 | 11.42 / 1.651 | 11.42 / 1.650 | |
|
| 94 |
+
| `dlnr-middlebury` | ETH3D two-view train, bad > 1 px % / EPE | 34.41 / 5.845 | 34.41 / 5.853 | 34.40 / 5.848 | 34.38 / 5.868 | |
|
| 95 |
+
| `dlnr-middlebury` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 7.17 / 0.989 | 7.18 / 0.988 | 7.18 / 0.988 | 7.18 / 0.992 | trained on this dataset's public images; not a zero-shot result |
|
| 96 |
+
|
| 97 |
+
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05.
|
| 98 |
+
|
| 99 |
+
### Parity with the original code
|
| 100 |
+
|
| 101 |
+
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.02 px and p99 <= 0.25 px.
|
| 102 |
+
|
| 103 |
+
## Usage
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
from fastforks import stereo
|
| 107 |
+
|
| 108 |
+
model = stereo.load("dlnr-middlebury") # mode="auto": the preferred backend from recorded measurements
|
| 109 |
+
result = model("left.png", "right.png")
|
| 110 |
+
result.disparity # [H, W] float32 tensor, input resolution
|
| 111 |
+
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `dlnr-middlebury`, `dlnr-sceneflow`.
|
| 115 |
+
|
| 116 |
+
## Kernels backend
|
| 117 |
+
|
| 118 |
+
`stereo.load("dlnr-middlebury", mode="kernels")` runs our CUDA kernels (`raft`, `igev`, `cutlass_conv`, `cudnn_hacc`, `fastbb`). 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.
|
| 119 |
+
|
| 120 |
+
<!-- staged from fastforks feccac41 (2026-11-06) -->
|