Flor commited on
Commit
2e0709d
·
0 Parent(s):

fastforks 0.1.0

Browse files
Files changed (2) hide show
  1. .gitattributes +35 -0
  2. README.md +119 -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,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/aeolusguan/NMRF/blob/a50bd8f407ae481c38f95cf141e1b5256e962cb7/README.md#L103"
7
+ tags:
8
+ - "stereo"
9
+ - "stereo-matching"
10
+ - "disparity"
11
+ - "cuda"
12
+ - "pytorch"
13
+ - "fastforks"
14
+ ---
15
+ # NMRF (fastforks)
16
+
17
+ NMRF (Guan et al. 2024): neural Markov random field with disparity proposals from a group-wise cost volume, CSWin label-seed propagation and window-attention inference at 1/8 resolution plus a 1/4 refinement.
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/aeolusguan/NMRF> at `a50bd8f407ae`.
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/nmrf/card.toml).
28
+
29
+ | variant | weights (author link) | SHA-256 | weights licence | commercial use |
30
+ |---|---|---|---|---|
31
+ | `nmrf-sceneflow@1` | [sceneflow.pth](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1VI-vyMIeNs_jMD6TVTNqFl70nQVgMSIR) | `e7c4a0a4bfe5` | MIT (assumed from code) | yes |
32
+
33
+ ## Licence
34
+
35
+ Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: `LICENSE`.
36
+
37
+ Code licence: MIT; the authors do not state a separate weights licence.
38
+
39
+ Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa).
40
+
41
+ Licence evidence: <https://github.com/aeolusguan/NMRF/blob/a50bd8f407ae481c38f95cf141e1b5256e962cb7/README.md#L103>
42
+
43
+ ## Input size
44
+
45
+ any H x W >= 9, padded to a multiple of 8
46
+ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `nmrf-sceneflow` 3000x4000 (11.0 GiB peak allocated, 13.3 reserved)
47
+
48
+ ## Speed and memory
49
+
50
+ ### Stereo, Middlebury 2014 half, 994x1482
51
+
52
+ | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
53
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
54
+ | `nmrf-sceneflow` | 445 | 313 | 216 | 196 | 1.6x | 1.1x | 1656 / 2054 | 1510 / 1552 | 1022 / 1112 |
55
+
56
+ ### Startup and first call
57
+
58
+ | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
59
+ | --- | --- | --- | --- | --- | --- | --- |
60
+ | `nmrf-sceneflow` | 0.21 (375x1242) | 0.10 | 0.07† | 0.77 (375x1242) | 0.22† | 0.20† |
61
+
62
+ ### torch.compile and TensorRT
63
+
64
+ | 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) |
65
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
66
+ | `nmrf-sceneflow` | 994x1482 | 216 | 160.8 | 84.8 | 183.7 | 142 | 196 | 1510 / 1552 | 854 / 1104 | 826 |
67
+
68
+ ### Fixed-size speed and peak memory, all models
69
+
70
+ | model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
71
+ | --- | --- | --- | --- | --- | --- |
72
+ | `nmrf-sceneflow` | portable | 35.9 ms / 390 / 454 | 124.3 ms / 953 / 1094 | 315.1 ms / 2040 / 2402 | 2021.2 ms (n=3) / 11263 / 13666 |
73
+ | `nmrf-sceneflow` | kernels | 31.7 ms / 247 / 298 | 112.1 ms / 626 / 800 | 286.8 ms / 1356 / 1814 | 1834.3 ms / 7543 / 10866 |
74
+
75
+ ### Apple silicon (MPS)
76
+
77
+ | model | `portable` | `kernels` | speed-up |
78
+ | --- | --- | --- | --- |
79
+ | `nmrf-sceneflow` | 455 ms / 2408 MiB (float32) | 365 ms / 1425 MiB | 1.24x |
80
+
81
+ Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
82
+
83
+ 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.
84
+
85
+ ## Accuracy
86
+
87
+ ### On public datasets
88
+
89
+ Original = the authors' code, same checkpoint and protocol.
90
+
91
+ | variant | dataset | original fp32 | original fp16 | portable | kernels | note |
92
+ |---|---|---|---|---|---|---|
93
+ | `nmrf-sceneflow` | ETH3D two-view train, bad > 1 px % / EPE | 3.78 / 0.311 | 3.81 / 0.312 | 3.81 / 0.311 | 3.81 / 0.311 | |
94
+ | `nmrf-sceneflow` | Middlebury 2014 trainingH, bad > 2 px % / EPE | 13.36 / 2.920 | 13.35 / 2.914 | 13.35 / 2.915 | 13.35 / 2.915 | |
95
+
96
+ Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05.
97
+
98
+ ### Parity with the original code
99
+
100
+ Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 px and p99 <= 0.5 px.
101
+
102
+ ## Usage
103
+
104
+ ```python
105
+ from fastforks import stereo
106
+
107
+ model = stereo.load("nmrf-sceneflow") # mode="auto": the preferred backend from recorded measurements
108
+ result = model("left.png", "right.png")
109
+ result.disparity # [H, W] float32 tensor, input resolution
110
+ result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
111
+ ```
112
+
113
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `nmrf-sceneflow`.
114
+
115
+ ## Kernels backend
116
+
117
+ `stereo.load("nmrf-sceneflow", mode="kernels")` runs our CUDA kernels (`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.
118
+
119
+ <!-- staged from fastforks feccac41 (2026-11-06) -->