Add a Tracker
To integrate a new tracker cleanly:
- Add
boxmot/trackers/<name>/tracker.pyand keep each__init__.pyfree of tracker-class re-exports. DeclareTrackerFamilyfrom the tracker's primary state:boxfor AABB/OBB,maskfor mask state, ormultimodalwhen several representations or model memory are fundamental. This family is capability metadata; all algorithm packages live directly underboxmot/trackers/. - Box-state implementations subclass
BoxTrackerfromboxmot.trackers.common.box.base; other trackers subclassBaseTrackerfromboxmot.trackers.common.base. Declare immutable capabilities and the configuration-dependentuse_embeddings,_requires_frame, and_requires_maskssettings, then implement_track_detections(). The inheritedTrackerRequirementsproperty exposes those requirements to pipelines. Keep the inherited public overloadedupdate()entry point:Detectionsinput returnsTracks, and packed NumPy input returns packed NumPy track rows.BaseTrackerowns validation and conversion of both representations; concrete trackers continue to implement only their private NumPy kernel. A ReID-enabled high-level tracker adapter must expose and forwardreid: ReIDConfig | AppearanceEncoder | None. Keepuse_embeddingsand appearance association parameters in the algorithm config. The shared tracker-domain appearance helper owns lazy extraction for missing embeddings, the precomputed bypass, and empty-batch behavior for Python and native adapters. - Add the tracker key, canonical implementation path, and
config_class_pathto_TRACKER_MANIFESTinboxmot/trackers/common/manifest.py, then add its static capability declaration toboxmot/trackers/common/registry.py. Public exports and exact class identities derive from the manifest; tests require registry and implementation capabilities to agree. Regenerate the Python autocomplete catalog after changing the manifest. - Import the class in application examples with
from boxmot import <TrackerClass>; implementation packages do not provide parallel class aliases. - Add a frozen
<TrackerClass>Configinboxmot/trackers/<name>/config.pyfor algorithm fields, defaults, and validation. Accept it throughconfig=and export it lazily fromboxmot. Addboxmot/configs/trackers/<name>.yamlfor tuning metadata and component profiles; the loader supplies algorithm defaults from the config class. Keep model components and geometry/class selection separate. - Add a tracker doc page and wire it into
mkdocs.yml. - Extend registry/package tests under
tests/unit/trackers/, add focused algorithm tests undertests/unit/trackers/<family>/when useful, and update the tracker lists intests/test_config.pywhere applicable. - Update the tracker, ReID, mask/OBB, and benchmark lists in
.github/workflows/when the new tracker should run in those jobs.
Reuse shared motion adapters from boxmot.trackers.common.motion.models
and filters from boxmot.trackers.common.motion.kalman_filters. Construct
camera-motion estimators through boxmot.trackers.common.motion.cmc.registry
and apply or reset them through cmc.integration. Keep shared motion tests
under tests/unit/trackers/common/motion/.
Optional native C++ backend
If the tracker also gets a native backend:
The backend does not change the tracker's representation family. Keep C++
implementation and ABI code under boxmot/native/cpp; only the canonical
Python adapter lives beside the algorithm's tracker implementation.
- Add native sources under
boxmot/native/cpp/trackers/<name>/. - Add the tracker subdirectory and wheel-install entries to
boxmot/native/cpp/CMakeLists.txt. - Add the low-level ctypes binding under
boxmot/native/trackers/<name>.py. It must accept and return typed, contiguous NumPy buffers and must not import structures or tracker code. - Add the public adapter under
boxmot/trackers/<name>/native.py. The shared adapter convertsDetectionsor packed detection rows plus an optionalFrame, returnsTracksor packed rows to match the input, resolves tracker configuration, and declares requirements. - Set
native_class_pathon the algorithm's_TRACKER_MANIFESTentry. Native validation and construction are owned byboxmot/trackers/common/factory.py. - Document
--tracker-backend cppsupport on the tracker page. - Add low-level ABI and domain-adapter tests under
tests/unit/native/trackers/test_native_<name>.py.
Native tracker sources should follow the existing CMake layout: a
<name>_capi shared library exposing typed ABI v2 buffers and a <name>_core
target for reusable C++ code. A state-mutating update is called exactly once;
the library allocates its result and the caller releases it with the matching
free function. Do not add positional-cache or replay executables. Evaluation
and tuning stream keyed records through the same live ABI.
Do not place model inference code under native/cpp/trackers or link it into a
tracker target. The optional native appearance runtime is independently owned
by native/cpp/reid; trackers receive embeddings through their typed input
buffers. A high-level native adapter may implement the shared tracker-owned
live-extraction fallback, but model settings remain separate from
TrackerSpec and the low-level tracker ABI.
Minimum checklist
- tracker implementation
- tracker registration
- tracker YAML
- docs page
- tests
- workflow matrices if benchmarked in CI
- native C++ registration and tests if a native backend is added