--- library_name: "fastforks" pipeline_tag: "image-to-image" license: "other" license_name: "see-model-card" license_link: "https://github.com/drinkingcoder/FlowFormer-Official/blob/6ba7ea82b45394d3a7a25808399695427c9febd8/README.md#license" tags: - "flow" - "optical-flow" - "motion-estimation" - "cuda" - "pytorch" - "fastforks" - "fastforks-card" --- # FlowFormer Small (fastforks) FlowFormer Small (ECCV 2022): convolutional features, a latent cost-memory transformer and recurrent flow decoding. The authors' Small checkpoints, with plain float32 inference. 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: . Kernels for the `kernels` backend: . Original code: at `6ba7ea82b453`. Task: flow. Tier: experimental. Outputs: `flow`. Backends: `portable`. Input: two RGB images (consecutive frames). Output: per-pixel motion from the first to the second (dx, dy in pixels). ## 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/flow/models/flowformer/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `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 | | `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 | | `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 | ## Licence 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`. Code licence: Apache-2.0 AND BSD-3-Clause AND WTFPL; the authors do not state a separate weights licence. 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.). Licence evidence: ## Input size any H x W >= 64, padded to a multiple of 8 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) ## Speed and memory ### Flow, synthetic | model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `flowformer-small-chairs` | 375x1242 | 352 | 303 | 351 | – | – | – | 2382 / 2970 | 3165 / 3638 | – | | `flowformer-small-sintel` | 375x1242 | 352 | 303 | 351 | – | – | – | 2382 / 2990 | 3165 / 3638 | – | | `flowformer-small-things` | 375x1242 | 352 | 303 | 351 | – | – | – | 2382 / 3010 | 3165 / 3638 | – | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `flowformer-small-chairs` | 0.16 (375x1242) | 1.31 (375x1242) | – | 0.37 (375x1242) | 0.57 (375x1242) | – | | `flowformer-small-sintel` | 0.15 (375x1242) | 1.30 (375x1242) | – | 0.30 (375x1242) | 0.57 (375x1242) | – | | `flowformer-small-things` | 0.15 (375x1242) | 1.31 (375x1242) | – | 0.30 (375x1242) | 0.57 (375x1242) | – | ### 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) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `flowformer-small-chairs` | 375x1242 | 351 ms | 250 ms | 202 ms | – | 98.7 s | 118 s | 3165 / 3638 | 2438 / 3196 | – | 2087 / 2138 | | `flowformer-small-sintel` | 375x1242 | 351 ms | 250 ms | 202 ms | – | 98.9 s | 117 s | 3165 / 3638 | 2438 / 3196 | – | 2087 / 2138 | | `flowformer-small-things` | 375x1242 | 351 ms | 250 ms | 202 ms | – | 99.3 s | 118 s | 3165 / 3638 | 2438 / 3196 | – | 2087 / 2138 | 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 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. | variant | dataset | original fp32 | original fp16 | portable | note | |---|---|---|---|---|---| | `flowformer-small-chairs` | KITTI 2015 train, EPE / Fl-all % | 10.952 / 36.72 | 11.102 / 36.80 | 10.952 / 36.72 | | | `flowformer-small-things` | KITTI 2015 train, EPE / Fl-all % | 6.884 / 17.92 | 7.034 / 17.91 | 6.884 / 17.92 | | | `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 | Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks a6ea0725+dirty, 2026-11-11. ### 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.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`). ## Limitations - Only the Small architecture is included. - No custom kernels backend: the time is in cuDNN TF32 convolutions and the float32 aggregation matmul, and lowering precision changes EPE. - 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. - 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. ## Usage ```python from fastforks import flow model = flow.load("flowformer-small-chairs") # mode="auto": the preferred backend from recorded measurements result = model("frame1.png", "frame2.png") result.flow # [2, H, W] float32 tensor: dx, dy in input pixels result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16') ``` Install with `pip install fastforks` (see ). Other variants: `flowformer-small-chairs`, `flowformer-small-sintel`, `flowformer-small-things`. ## Kernels backend 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..