Trackers

raw JSON →
2.4.0 verified Sat May 09 auth: no python

A unified library for object tracking featuring clean room re-implementations of leading multi-object tracking algorithms. Current version: 2.4.0. Release cadence: irregular, with occasional major updates.

pip install trackers
error AttributeError: module 'trackers' has no attribute 'BotSort'
cause Installed version is <2.0 or import path used was incorrect.
fix
Upgrade to trackers>=2.0 with 'pip install --upgrade trackers' and use 'from trackers import BotSort'.
error ImportError: cannot import name 'BotSort' from 'trackers.botsort'
cause Using old import path from version <2.0.
fix
Change import to 'from trackers import BotSort'.
error KeyError: 'detections'
cause Passing a dictionary instead of a list of lists to update().
fix
Ensure detections is a list of lists: [[x1, y1, x2, y2, score, class_id], ...].
error ValueError: The number of classes must be specified
cause Tracker requires n_classes parameter or class IDs in detections.
fix
If your detections include class IDs, ensure they are present. Otherwise, set n_classes in the tracker constructor.
breaking In version 2.0, the import paths changed: all trackers are now importable directly from the trackers package. Submodule imports like 'from trackers.botsort import BotSort' no longer work.
fix Use 'from trackers import BotSort' instead of 'from trackers.botsort import BotSort'.
gotcha The update() method expects detections as a list of lists in the format [x1, y1, x2, y2, score, class_id]. It does not accept numpy arrays directly as input.
fix Convert your detections to a list of lists before calling update().
deprecated The 'verbose' parameter in tracker initialization is deprecated and will be removed in a future version. Use logging configuration instead.
fix Remove the 'verbose' parameter and configure Python logging separately.

Initialize a tracker and update with detections (list of lists).

from trackers import BotSort
import numpy as np

tracker = BotSort()
# Example: update with random detections (x1, y1, x2, y2, score, class_id)
detections = np.random.rand(5, 6).tolist()
tracks = tracker.update(detections, img_size=(640, 480))
print(tracks)