Flor commited on
Commit
d45061d
Β·
verified Β·
1 Parent(s): 4c6c3fe

card: update from fastforks 1cbf1671

Browse files
Files changed (1) hide show
  1. README.md +123 -0
README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: "fastforks"
3
+ pipeline_tag: "image-to-image"
4
+ license: "other"
5
+ license_name: "see-model-card"
6
+ license_link: "https://github.com/drinkingcoder/FlowFormer-Official/blob/6ba7ea82b45394d3a7a25808399695427c9febd8/README.md#license"
7
+ tags:
8
+ - "flow"
9
+ - "optical-flow"
10
+ - "motion-estimation"
11
+ - "cuda"
12
+ - "pytorch"
13
+ - "fastforks"
14
+ - "fastforks-card"
15
+ ---
16
+ # FlowFormer Small (fastforks)
17
+
18
+ FlowFormer Small (ECCV 2022): convolutional features, a latent cost-memory transformer and recurrent flow decoding. The authors' Small checkpoints, with plain float32 inference.
19
+
20
+ 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/drinkingcoder/FlowFormer-Official> at `6ba7ea82b453`.
21
+
22
+ Task: flow. Tier: experimental. Outputs: `flow`. Backends: `portable`.
23
+
24
+ Input: two RGB images (consecutive frames). Output: per-pixel motion from the first to the second (dx, dy in pixels).
25
+
26
+ ## Variants
27
+
28
+ 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/flow/models/flowformer/card.toml).
29
+
30
+ | variant | weights (author link) | SHA-256 | weights licence | commercial use |
31
+ |---|---|---|---|---|
32
+ | `flowformer-small-chairs@1` | [flowformer-small-chairs.pth](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1EpmZu6fOZBE0az-UaEmSMVi0pGHVEuQE) | `353914dcbf90` | Apache-2.0 AND BSD-3-Clause AND WTFPL (assumed from code) | yes |
33
+ | `flowformer-small-sintel@1` | [flowformer-small-sintel.pth](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1EpmZu6fOZBE0az-UaEmSMVi0pGHVEuQE) | `0ed780e00504` | Apache-2.0 AND BSD-3-Clause AND WTFPL (assumed from code) | yes |
34
+ | `flowformer-small-things@1` | [flowformer-small-things.pth](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1EpmZu6fOZBE0az-UaEmSMVi0pGHVEuQE) | `6bd2b44f3170` | Apache-2.0 AND BSD-3-Clause AND WTFPL (assumed from code) | yes |
35
+
36
+ ## Licence
37
+
38
+ Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0 AND BSD-3-Clause AND WTFPL. Licence files: `LICENSE`, `LICENSE-RAFT`, `LICENSE-GMA`.
39
+
40
+ Code licence: Apache-2.0 AND BSD-3-Clause AND WTFPL; the authors do not state a separate weights licence.
41
+
42
+ Training data: FlyingChairs (Freiburg), Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa) (The authors' Small checkpoints follow the chairs, things and sintel training stages; per-variant training data follows configs/small_*.py.).
43
+
44
+ Licence evidence: <https://github.com/drinkingcoder/FlowFormer-Official/blob/6ba7ea82b45394d3a7a25808399695427c9febd8/README.md#license>
45
+
46
+ ## Input size
47
+
48
+ any H x W >= 64, padded to a multiple of 8
49
+ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `flowformer-small-chairs` 1024x1024 (11.2 GiB peak allocated, 12.3 reserved); `flowformer-small-sintel` 1024x1024 (11.2 GiB peak allocated, 12.3 reserved); `flowformer-small-things` 1024x1024 (11.2 GiB peak allocated, 12.3 reserved)
50
+
51
+ ## Speed and memory
52
+
53
+ ### Flow, synthetic
54
+
55
+ | model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
56
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
57
+ | `flowformer-small-chairs` | 375x1242 | 352 | 303 | 351 | – | – | – | 2382 / 2970 | 3165 / 3638 | – |
58
+ | `flowformer-small-sintel` | 375x1242 | 352 | 303 | 351 | – | – | – | 2382 / 2990 | 3165 / 3638 | – |
59
+ | `flowformer-small-things` | 375x1242 | 352 | 303 | 351 | – | – | – | 2382 / 3010 | 3165 / 3638 | – |
60
+
61
+ ### Startup and first call
62
+
63
+ | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
64
+ | --- | --- | --- | --- | --- | --- | --- |
65
+ | `flowformer-small-chairs` | 0.16 (375x1242) | 1.31 (375x1242) | – | 0.37 (375x1242) | 0.57 (375x1242) | – |
66
+ | `flowformer-small-sintel` | 0.15 (375x1242) | 1.30 (375x1242) | – | 0.30 (375x1242) | 0.57 (375x1242) | – |
67
+ | `flowformer-small-things` | 0.15 (375x1242) | 1.31 (375x1242) | – | 0.30 (375x1242) | 0.57 (375x1242) | – |
68
+
69
+ ### torch.compile and TensorRT
70
+
71
+ | 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) |
72
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
73
+ | `flowformer-small-chairs` | 375x1242 | 351 ms | 250 ms | 202 ms | – | 98.7 s | 118 s | 3165 / 3638 | 2438 / 3196 | – | 2087 / 2138 |
74
+ | `flowformer-small-sintel` | 375x1242 | 351 ms | 250 ms | 202 ms | – | 98.9 s | 117 s | 3165 / 3638 | 2438 / 3196 | – | 2087 / 2138 |
75
+ | `flowformer-small-things` | 375x1242 | 351 ms | 250 ms | 202 ms | – | 99.3 s | 118 s | 3165 / 3638 | 2438 / 3196 | – | 2087 / 2138 |
76
+
77
+ Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
78
+
79
+ 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.
80
+
81
+ ## Accuracy
82
+
83
+ ### On public datasets
84
+
85
+ Frames _10 -> _11 at full size against the flow_occ ground truth; EPE = mean of the per-pair mean end-point error, Fl-all = share of all valid pixels with an error > 3 px and > 5 % of the GT magnitude. Original = the original code named under Details, same checkpoint and protocol.
86
+
87
+ | variant | dataset | original fp32 | original fp16 | portable | note |
88
+ |---|---|---|---|---|---|
89
+ | `flowformer-small-chairs` | KITTI 2015 train, EPE / Fl-all % | 10.952 / 36.72 | 11.102 / 36.80 | 10.952 / 36.72 | |
90
+ | `flowformer-small-things` | KITTI 2015 train, EPE / Fl-all % | 6.884 / 17.92 | 7.034 / 17.91 | 6.884 / 17.92 | |
91
+ | `flowformer-small-sintel` | KITTI 2015 train, EPE / Fl-all % | 4.657 / 6.35 | 4.206 / 6.30 | 4.657 / 6.35 | trained on this dataset's public images; not a zero-shot result |
92
+
93
+ Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks a6ea0725+dirty, 2026-11-11.
94
+
95
+ ### Parity with the original code
96
+
97
+ Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.0001 vs the original. GPU, portable float32 and kernels float16 (the defaults): mean |diff| <= 0.0021 and p99 <= 0.013 (absolute error of the output `flow`).
98
+
99
+ ## Limitations
100
+
101
+ - Only the Small architecture is included.
102
+ - No custom kernels backend: the time is in cuDNN TF32 convolutions and the float32 aggregation matmul, and lowering precision changes EPE.
103
+ - Portable runs float32 (the validated dtype): 338 ms and 1410 MB at 375x1242 against 303 ms and 2382 MB for the fp16-autocast original (EPE identical to the float32 original); switching the default to fp16 needs a full accuracy re-validation.
104
+ - Full-frame cost memory grows quadratically with input area; upstream tiled evaluation is not included. Full-frame 1080p exceeded the RTX 5060 Ti 16GB memory in portable and original fp32/fp16 runs.
105
+
106
+ ## Usage
107
+
108
+ ```python
109
+ from fastforks import flow
110
+
111
+ model = flow.load("flowformer-small-chairs") # mode="auto": the preferred backend from recorded measurements
112
+ result = model("frame1.png", "frame2.png")
113
+ result.flow # [2, H, W] float32 tensor: dx, dy in input pixels
114
+ result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
115
+ ```
116
+
117
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `flowformer-small-chairs`, `flowformer-small-sintel`, `flowformer-small-things`.
118
+
119
+ ## Kernels backend
120
+
121
+ No kernels backend: Measured 2026-11-15: time is cuDNN TF32 convolutions plus the float32 aggregation matmul; fp16 aggregation (NaN at scale 1024, worse EPE) and SDPA (slower, EPE changed) were tried and dropped..
122
+
123
+ <!-- staged from fastforks 1cbf1671 (2026-11-15) -->