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.
Metadata
Release files for unitrack 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unitrack-2.0.1.tar.gz | 409.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unitrack-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 859.3 kB
Release files / unitrack-2.0.1.tar.gz
| Download URL | unitrack-2.0.1.tar.gz |
|---|---|
| Size | 409.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc88aee5b9dfe54e09031d7e4554dfc82b95d6d0f718ca9f6d092728987a86ad
|
|
BLAKE2b-256 checksum How to use checksums |
568536338cf55db44669e8a2613d96e92e6e69f24f8da9bfcb3e84a7d96c8aed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency logRelease files / unitrack-2.0.1-py3-none-any.whl
| Download URL | unitrack-2.0.1-py3-none-any.whl |
|---|---|
| Size | 450.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
926f660005580513471630c91c4aceccf9d019e4f7a74421563249b2598f7fd4
|
|
BLAKE2b-256 checksum How to use checksums |
87a31104c6e24bc35a2a0ffa28b8b7e753a5298c8e9139e7a27920deb6d78656
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.
Transparency log