card: update from fastforks 1cbf1671
Browse files
README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: "fastforks"
|
| 3 |
+
pipeline_tag: "keypoint-detection"
|
| 4 |
+
license: "apache-2.0"
|
| 5 |
+
tags:
|
| 6 |
+
- "tracking"
|
| 7 |
+
- "point-tracking"
|
| 8 |
+
- "tracking-any-point"
|
| 9 |
+
- "video"
|
| 10 |
+
- "cuda"
|
| 11 |
+
- "pytorch"
|
| 12 |
+
- "fastforks"
|
| 13 |
+
- "fastforks-card"
|
| 14 |
+
---
|
| 15 |
+
# TAPIR (fastforks)
|
| 16 |
+
|
| 17 |
+
TAPIR (Doersch, Yang, Vecerik et al., Google DeepMind 2023) and BootsTAPIR (Doersch et al. 2024, the same network trained further with BootsTAP self-training on unlabelled real videos): tracking any point offline over a whole video. A ResNet encodes every 256 x 256 frame; per frame, a cost volume against the query's features gives the initial position, visibility and uncertainty, then four PIPs-style refinements (local correlations, a depthwise-conv MLP mixer over the frames of each track) correct the whole track at once.
|
| 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/google-deepmind/tapnet> at `ceedd60bb9f6`.
|
| 20 |
+
|
| 21 |
+
Task: tracking. Tier: experimental. Outputs: `tracks`, `visibility`. Backends: `portable`, `kernels`.
|
| 22 |
+
|
| 23 |
+
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.
|
| 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/tracking/models/tapir/card.toml).
|
| 28 |
+
|
| 29 |
+
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|
| 30 |
+
|---|---|---|---|---|
|
| 31 |
+
| `bootstapir@1` | [bootstapir_checkpoint_v2.pt](https://storage.googleapis.com/dm-tapnet/bootstap/bootstapir_checkpoint_v2.pt) | `8493c7a69e02` | Apache-2.0 | yes |
|
| 32 |
+
| `tapir@1` | [tapir_checkpoint_panning.pt](https://storage.googleapis.com/dm-tapnet/tapir_checkpoint_panning.pt) | `628611c656b3` | Apache-2.0 | yes |
|
| 33 |
+
|
| 34 |
+
## Licence
|
| 35 |
+
|
| 36 |
+
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: `LICENSE`.
|
| 37 |
+
|
| 38 |
+
Training data: Upstream: TAPIR is trained on synthetic Kubric MOVi-E sequences (the panning variant); BootsTAPIR is further trained with BootsTAP self-training on about 15 million unlabelled real video clips (not released). None has a dataset entry here yet..
|
| 39 |
+
|
| 40 |
+
Licence evidence: <https://github.com/google-deepmind/tapnet/blob/ceedd60bb9f6c9f7c74796e4445aff6c6ddf7c9b/README.md#license-and-disclaimer>
|
| 41 |
+
|
| 42 |
+
## Input size
|
| 43 |
+
|
| 44 |
+
any H x W >= 32, padded to a multiple of 32
|
| 45 |
+
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `bootstapir` 3000x4000 (5.6 GiB peak allocated, 6.1 reserved); `tapir` 3000x4000 (5.5 GiB peak allocated, 6.0 reserved)
|
| 46 |
+
|
| 47 |
+
## Speed and memory
|
| 48 |
+
|
| 49 |
+
### Tracking, synthetic, 480x854
|
| 50 |
+
|
| 51 |
+
| model | time (ms): original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|
| 52 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 53 |
+
| `bootstapir` | 243 | 234 | 192 | 1.3x | 1.2x | 639 / 774 | 508 / 628 | 508 / 628 |
|
| 54 |
+
| `tapir` | 187 | 182 | 141 | 1.3x | 1.3x | 498 / 574 | 463 / 548 | 463 / 548 |
|
| 55 |
+
|
| 56 |
+
### Startup and first call
|
| 57 |
+
|
| 58 |
+
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|
| 59 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 60 |
+
| `bootstapir` | 0.60 | 0.32 | 1.14 | 0.90 | 0.80 | 0.66 |
|
| 61 |
+
| `tapir` | 0.35 | 0.19 | 1.13 | 0.83 | 0.84 | 0.69 |
|
| 62 |
+
|
| 63 |
+
### torch.compile and TensorRT
|
| 64 |
+
|
| 65 |
+
| 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) |
|
| 66 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 67 |
+
| `bootstapir` | 480x854 | 234 ms | 183 ms | 13.2 ms | 192 ms | 207 s | 65.0 s | 508 / 628 | 758 / 832 | 508 / 628 | 492 / 532 |
|
| 68 |
+
| `tapir` | 480x854 | 182 ms | 131 ms | 6.47 ms | 141 ms | 169 s | 55.2 s | 463 / 548 | 630 / 752 | 463 / 548 | 361 / 406 |
|
| 69 |
+
|
| 70 |
+
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
|
| 71 |
+
|
| 72 |
+
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.
|
| 73 |
+
|
| 74 |
+
## Accuracy
|
| 75 |
+
|
| 76 |
+
### On public datasets
|
| 77 |
+
|
| 78 |
+
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.
|
| 79 |
+
|
| 80 |
+
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|
| 81 |
+
|---|---|---|---|---|---|---|
|
| 82 |
+
| `bootstapir` | TAP-Vid DAVIS (query first), every 3rd video, AJ / delta_avg / OA % | 65.49 / 76.75 / 92.56 | 65.53 / 76.72 / 92.55 | 65.56 / 76.78 / 92.44 | 65.51 / 76.72 / 92.51 | |
|
| 83 |
+
| `bootstapir` | TAP-Vid DAVIS (query first), AJ / delta_avg / OA % | 62.27 / 74.62 / 89.67 | | 62.29 / 74.61 / 89.66 | 62.27 / 74.61 / 89.64 | |
|
| 84 |
+
| `tapir` | TAP-Vid DAVIS (query first), every 3rd video, AJ / delta_avg / OA % | 62.63 / 74.54 / 90.14 | 62.62 / 74.60 / 90.18 | 62.74 / 74.59 / 90.11 | 62.73 / 74.55 / 90.21 | |
|
| 85 |
+
|
| 86 |
+
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 8d5bccf, 2026-11-12 to 2026-11-13.
|
| 87 |
+
|
| 88 |
+
### Parity with the original code
|
| 89 |
+
|
| 90 |
+
Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 3.5e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0079 and p99 <= 0.028 (absolute error of the output `tracks`).
|
| 91 |
+
|
| 92 |
+
## Limitations
|
| 93 |
+
|
| 94 |
+
- Offline: the whole video is encoded before tracking (features of every frame in memory, about 3 MB per frame); for live video use an online tracker (TAPNext).
|
| 95 |
+
- Frames are resized to 256 x 256 (the training size and that of upstream's TAP-Vid numbers), whatever their size and aspect ratio. Upstream's higher-resolution refinement (best at 512 x 512 for BootsTAPIR) is not ported.
|
| 96 |
+
- One video per call; all queries of a call share the video.
|
| 97 |
+
|
| 98 |
+
## Usage
|
| 99 |
+
|
| 100 |
+
```python
|
| 101 |
+
from fastforks import tracking
|
| 102 |
+
|
| 103 |
+
model = tracking.load("bootstapir") # mode="auto": the preferred backend from recorded measurements
|
| 104 |
+
result = model(frames, [[0, x, y]]) # frames: the video's images in order; queries (t, x, y)
|
| 105 |
+
result.tracks # [T, Q, 2] float32: x, y in input pixels; result.visible [T, Q] bool
|
| 106 |
+
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `bootstapir`, `tapir`.
|
| 110 |
+
|
| 111 |
+
## Kernels backend
|
| 112 |
+
|
| 113 |
+
`tracking.load("bootstapir", mode="kernels")` runs our CUDA kernels (`fvm_conv`). 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.
|
| 114 |
+
|
| 115 |
+
<!-- staged from fastforks 1cbf1671 (2026-11-15) -->
|