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: 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.
Task: flow. Tier: experimental. Outputs: flow. Backends: portable, kernels.
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.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
flowformer-small-chairs@1 |
flowformer-small-chairs.pth | 353914dcbf90 |
Apache-2.0 AND BSD-3-Clause AND WTFPL (assumed from code) | yes |
flowformer-small-sintel@1 |
flowformer-small-sintel.pth | 0ed780e00504 |
Apache-2.0 AND BSD-3-Clause AND WTFPL (assumed from code) | yes |
flowformer-small-things@1 |
flowformer-small-things.pth | 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: https://github.com/drinkingcoder/FlowFormer-Official/blob/6ba7ea82b45394d3a7a25808399695427c9febd8/README.md#license
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, 1080x1920
| model | 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 |
OOM | OOM | 4006 | 3951 | β | 1.0x | β | 8780 / 8960 | 8696 / 8822 |
flowformer-small-sintel |
OOM | OOM | 4003 | 3958 | β | 1.0x | β | 8780 / 8960 | 8696 / 8822 |
flowformer-small-things |
OOM | OOM | 4003 | 3950 | β | 1.0x | β | 8780 / 8960 | 8696 / 8822 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
flowformer-small-chairs |
0.16 (375x1242) | 1.59 (375x1242) | 1.19 (375x1242) | 0.37 (375x1242) | 0.56 (375x1242) | 0.55 (375x1242) |
flowformer-small-sintel |
0.15 (375x1242) | 1.56 (375x1242) | 1.29 (375x1242) | 0.30 (375x1242) | 0.58 (375x1242) | 0.55 (375x1242) |
flowformer-small-things |
0.15 (375x1242) | 1.42 (375x1242) | 1.18 (375x1242) | 0.30 (375x1242) | 0.56 (375x1242) | 0.55 (375x1242) |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT (fp16 unless shown) | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
flowformer-small-chairs |
1080x1920 | 4006 ms | 3498 ms | fails: unsupported: TensorRT 11 build at 1080x1920 needs a 20 GB My | 3951 ms | 104 s | β | 8780 / 8960 | 10137 / 10216 | 8696 / 8822 | β |
flowformer-small-chairs |
375x1242 | 338 ms | 250 ms | 202 ms | 326 ms | 98.7 s | 118 s | 744 / 838 | 2438 / 3196 | 740 / 838 | 2087 / 2138 |
flowformer-small-sintel |
1080x1920 | 4003 ms | 3500 ms | fails: unsupported: TensorRT 11 build at 1080x1920 needs a 20 GB My | 3958 ms | 103 s | β | 8780 / 8960 | 10137 / 10216 | 8696 / 8822 | β |
flowformer-small-sintel |
375x1242 | 336 ms | 250 ms | 202 ms | 322 ms | 98.9 s | 117 s | 1404 / 1698 | 2438 / 3196 | 1401 / 1698 | 2087 / 2138 |
flowformer-small-things |
1080x1920 | 4003 ms | 3501 ms | fails: unsupported: TensorRT 11 build at 1080x1920 needs a 20 GB My | 3950 ms | 104 s | β | 8780 / 8960 | 10137 / 10216 | 8696 / 8822 | β |
flowformer-small-things |
375x1242 | 337 ms | 250 ms | 202 ms | 322 ms | 99.3 s | 118 s | 1404 / 1698 | 2438 / 3196 | 1401 / 1698 | 2087 / 2138 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (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 | kernels | note |
|---|---|---|---|---|---|---|
flowformer-small-chairs |
KITTI 2015 train, EPE / Fl-all % | 10.952 / 36.72 | 11.102 / 36.80 | 10.952 / 36.72 | 11.031 / 36.75 | |
flowformer-small-things |
KITTI 2015 train, EPE / Fl-all % | 6.884 / 17.92 | 7.034 / 17.91 | 6.884 / 17.92 | 7.005 / 17.91 | |
flowformer-small-sintel |
KITTI 2015 train, EPE / Fl-all % | 4.657 / 6.35 | 4.206 / 6.30 | 4.657 / 6.35 | 3.978 / 6.22 | trained on this dataset's public images; not a zero-shot result |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks a6ea0725+dirty, 2026-11-11; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 0fba22666, 2026-11-20.
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, float32 (the default), portable and kernels: mean |diff| <= 0.0021 and p99 <= 0.013 (absolute error of the output flow).
Limitations
- Only the Small architecture is included.
- Default CUDA inference uses the validated float32 precision. The optional float16 portable path requires separate accuracy validation.
- Full-frame cost memory grows quadratically with input area. The measured Small Chairs checkpoint uses less than 9 GiB of reserved CUDA memory at 1080p float32 in both native modes on the RTX 5060 Ti.
Usage
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 https://github.com/kleinicke/fastforks). Other variants: flowformer-small-chairs, flowformer-small-sintel, flowformer-small-things.
Kernels backend
flow.load("flowformer-small-chairs", mode="kernels") runs our CUDA kernels (flow_upsample, raft_flow, 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.