--- library_name: "fastforks" pipeline_tag: "keypoint-detection" license: "apache-2.0" tags: - "tracking" - "point-tracking" - "tracking-any-point" - "video" - "cuda" - "pytorch" - "fastforks" - "fastforks-card" --- # TAPNext (fastforks) TAPNext (Zholus, Doersch, Yang, Koppula et al., Google DeepMind 2025): tracking any point as next-token prediction. A TRecViT-B (12 blocks, each a gated linear recurrence over time per token and a ViT layer over the tokens of a frame) reads 8 x 8 patches of 256 x 256 frames plus one token per query point and predicts, frame by frame, the point's position (512-bin classification, windowed soft-argmax) and whether it is visible. Online: each frame only sees the past. 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 `ceedd60bb9f6`. Task: tracking. Tier: experimental. Outputs: `tracks`, `visibility`. Backends: `portable`, `kernels`. Input: a video (its frames in order) and query points `(t, x, y)`. Output: the position of every query in every frame and the probability that it is visible there. ## 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/tracking/models/tapnext/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `tapnext@1` | [bootstapnext_ckpt.npz](https://storage.googleapis.com/dm-tapnet/tapnext/bootstapnext_ckpt.npz) | `19de6b149555` | Apache-2.0 | yes | | `tapnext-pp@1` | [tapnextpp_ckpt.pt](https://storage.googleapis.com/dm-tapnet/tapnextpp/tapnextpp_ckpt.pt) | `cb96a43444cc` | Apache-2.0 | yes | ## Licence Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: `LICENSE`. Training data: Upstream: TAPNext is trained on synthetic Kubric MOVi-F sequences and fine-tuned with BootsTAP self-training on unlabelled real videos (not released); TAPNext++ is further fine-tuned on PointOdyssey and Kubric-1024 (1024-frame synthetic sequences). None has a dataset entry here yet.. Licence evidence: ## Input size any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `tapnext` 3000x4000 (4.3 GiB peak allocated, 4.5 reserved); `tapnext-pp` 3000x4000 (4.3 GiB peak allocated, 4.5 reserved) ## Speed and memory ### Tracking, synthetic, 480x854 | model | time (ms): original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `tapnext` | 909 | 529 | 382 | 2.4x | 1.4x | 1721 / 1902 | 1220 / 1294 | 1313 / 1374 | | `tapnext-pp` | 1493 | 529 | – | – | – | 1527 / 1718 | 1220 / 1294 | – | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `tapnext` | 16.92 | 2.72 | 2.63 | 2.17 | 0.69 | 0.56 | | `tapnext-pp` | 4.83 | 1.34 | – | 1.80 | 0.77 | – | ### 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) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `tapnext` | 480x854 | 529 ms | 398 ms | deferred (build >5 min) | 382 ms | 40.5 s | – | 1220 / 1294 | 1164 / 1272 | 1313 / 1374 | – | | `tapnext-pp` | 480x854 | 529 ms | planned for 0.2.1 | – | – | – | – | 1220 / 1294 | – | – | – | 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 TAP-Vid protocol: frames resized to 256 x 256 (PIL Lanczos) before the model (AllTracker: the original frames, resized by the model), one query per track at its first visible point, tracked online (TAPNext, Track-On) or over the whole clip (TAPIR, AllTracker, LocoTrack); AJ, delta_avg (< 1, 2, 4, 8, 16 px at 256 x 256) and occlusion accuracy averaged over the videos. Original = the original code named under Details, same checkpoint and protocol. | variant | dataset | original fp32 | original fp16 | portable | kernels | note | |---|---|---|---|---|---|---| | `tapnext` | TAP-Vid DAVIS (query first), every 3rd video, AJ / delta_avg / OA % | 71.01 / 82.01 / 95.18 | 71.02 / 82.02 / 95.19 | 71.02 / 82.02 / 95.19 | 71.02 / 82.03 / 95.23 | | | `tapnext` | TAP-Vid DAVIS (query first), AJ / delta_avg / OA % | 66.55 / 79.48 / 92.16 | 66.55 / 79.49 / 92.17 | 66.55 / 79.49 / 92.17 | 66.56 / 79.50 / 92.18 | | | `tapnext-pp` | TAP-Vid DAVIS (query first), every 3rd video, AJ / delta_avg / OA % | 71.48 / 82.43 / 94.96 | 71.50 / 82.43 / 94.96 | 71.50 / 82.43 / 94.96 | 71.47 / 82.41 / 94.98 | | Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12. ### Parity with the original code Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 4.6e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0063 and p99 <= 0.036 (absolute error of the output `tracks`). ## Limitations - Online, causal: a point is tracked from its query frame on; in frames before it the model has no information (the tracks there are its guess, with a low visibility). Query on the first frame, or run the reversed video for the backward part. - Frames are resized to 256 x 256 (the training size), whatever their size and aspect ratio. - One video per call; all queries of a call share the video. ## Usage ```python from fastforks import tracking model = tracking.load("tapnext") # mode="auto": the preferred backend from recorded measurements result = model(frames, [[0, x, y]]) # frames: the video's images in order; queries (t, x, y) result.tracks # [T, Q, 2] float32: x, y in input pixels; result.visible [T, Q] bool result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16') ``` Install with `pip install fastforks` (see ). Other variants: `tapnext`, `tapnext-pp`. ## Kernels backend `tracking.load("tapnext", mode="kernels")` runs our CUDA kernels (`fvm_conv`). It needs a prebuilt kernel for your GPU architecture (downloaded from 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.