Unified Tracking in PyTorch
unitrack is a PyTorch-native multi-object tracking library for researchers
and ML engineers who want to assemble, not reimplement, a tracker. The library
decomposes the SORT-family pipeline into typed primitives (stages, costs, gates,
lifecycle policies, state recipes). Classical IoU+Kalman trackers, differentiable
soft-assignment variants, and cascaded or parallel fusions all share the same
scaffolding and run on a single Tracker core. Detections, tracklets, and frame
context flow through the pipeline as structured TensorDict records, enabling
multi-stream batching, clip-based inference, and torch.func.vmap compatibility
without separate code paths.
Installation
python >= 3.13, < 3.14torch >= 2.7
pip install unitrack
See docs/installation.md for the in-tree LAP solver
extras and the development workflow.
Composable primitives
Each top-level subpackage covers one axis of the tracker:
unitrack.assignment— solvers for the linear assignment problem (Hungarian, Greedy, Auction, Jonker–Volgenant variants) plus soft companions for differentiable matching.unitrack.costs— pairwise cost producers (cosine, L2, IoU family, Mahalanobis) and combinators (Reduce,Weighted,Sinkhorn).unitrack.data— the typed records that flow through the pipeline:Detections,Tracklets,FrameContext,CostExpression,MatchOutcome, plus clip-shaped counterparts and theGatealgebra.unitrack.gates— class, score, spatial, and motion gates that mask candidate pairs before cost computation.unitrack.lifecycle— tracklet status policies (StandardLifecycle,ConfirmedOnly,NoLifecycle) and visibility filters.unitrack.pipeline— the stage tree:Pipe,Sequential,Parallel,Gated,Filter,Iterate.unitrack.states— per-feature state recipes (Identity,Replace,EMA) and the Kalman family (KalmanBBox,KalmanCentroid,KalmanUpdate).unitrack.tracker— the top-levelTrackermodule and its wrappers:MultiStream,BatchTracker,ClipTracker,TrackletMemory.
Usage
This example tracks objects across a three-frame sequence using a distance cost and the Jonker–Volgenant solver.
import torch
import unitrack
from unitrack.assignment import Associate, Jonker
from unitrack.costs import CDist
from unitrack.data import Detections, FrameContext, TensorSpec
from unitrack.lifecycle import IncludeAll, NoLifecycle
from unitrack.pipeline import Pipe
from unitrack.states import FromDetectionField, Identity, Replace, State
tracker = unitrack.Tracker(
root=Pipe(cost=CDist("position"), assoc=Associate(Jonker(threshold=10))),
states={
"position": State(
schema=TensorSpec(shape=(1,), dtype=torch.float32),
process=Identity("position"),
observation=Replace("position"),
init=FromDetectionField("position"),
),
},
lifecycle=NoLifecycle(),
visibility=IncludeAll(),
)
ms = unitrack.MultiStream(tracker)
for frame in range(3):
n = 1 + frame * 2
pos = (torch.arange(n, dtype=torch.float32) + 1.0).unsqueeze(1)
ds = Detections(
index=torch.arange(n, dtype=torch.int64), position=pos, batch_size=[n]
)
res = ms.step(0, ds, FrameContext.make(frame, fps=15.0, stream_key=0))
print(f"frame {frame}: ids={res.ids.tolist()}")
Recipes and tutorials
Ready-to-run tracker recipes in docs/2.recipes/ include a SORT
port (IoU + Kalman bounding-box state) and a class-and-score-gated overlap
tracker. The seven-notebook tour under
docs/5.notebooks/tutorials/ covers the data model,
cost and gate zoos, pipeline tree, state and lifecycle, and cascaded
versus parallel fusion on synthetic data with known ground truth.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unitrack-2.0.1.tar.gz.
File metadata
- Download URL: unitrack-2.0.1.tar.gz
- Upload date:
- Size: 409.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc88aee5b9dfe54e09031d7e4554dfc82b95d6d0f718ca9f6d092728987a86ad
|
|
| MD5 |
212e1dffb719eec03f3388080a061bb6
|
|
| BLAKE2b-256 |
568536338cf55db44669e8a2613d96e92e6e69f24f8da9bfcb3e84a7d96c8aed
|
Provenance
The following attestation bundles were made for unitrack-2.0.1.tar.gz:
Publisher:
release.yml on tue-p8n/unitrack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unitrack-2.0.1.tar.gz -
Subject digest:
cc88aee5b9dfe54e09031d7e4554dfc82b95d6d0f718ca9f6d092728987a86ad - Sigstore transparency entry: 2257113267
- Sigstore integration time:
-
Permalink:
tue-p8n/unitrack@0708d39eecac85ed4406339a4409ac141e5094f8 -
Branch / Tag:
refs/tags/2.0.1 - Owner: https://github.com/tue-p8n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0708d39eecac85ed4406339a4409ac141e5094f8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unitrack-2.0.1-py3-none-any.whl.
File metadata
- Download URL: unitrack-2.0.1-py3-none-any.whl
- Upload date:
- Size: 450.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
926f660005580513471630c91c4aceccf9d019e4f7a74421563249b2598f7fd4
|
|
| MD5 |
2875ba7198fdaaffeaef266aede85f46
|
|
| BLAKE2b-256 |
87a31104c6e24bc35a2a0ffa28b8b7e753a5298c8e9139e7a27920deb6d78656
|
Provenance
The following attestation bundles were made for unitrack-2.0.1-py3-none-any.whl:
Publisher:
release.yml on tue-p8n/unitrack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unitrack-2.0.1-py3-none-any.whl -
Subject digest:
926f660005580513471630c91c4aceccf9d019e4f7a74421563249b2598f7fd4 - Sigstore transparency entry: 2257113278
- Sigstore integration time:
-
Permalink:
tue-p8n/unitrack@0708d39eecac85ed4406339a4409ac141e5094f8 -
Branch / Tag:
refs/tags/2.0.1 - Owner: https://github.com/tue-p8n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0708d39eecac85ed4406339a4409ac141e5094f8 -
Trigger Event:
push
-
Statement type: