Skip to content

Trackers API

SORT

trackers.core.sort.tracker.SORTTracker

Bases: BaseTracker

Track objects using SORT algorithm with Kalman filter and IoU matching. Provides simple and fast online tracking using only bounding box geometry without appearance features.

Parameters:

Name Type Description Default
lost_track_buffer int

int specifying number of frames to buffer when a track is lost. Increasing this value enhances occlusion handling but may increase ID switching for similar objects.

30
frame_rate float

float specifying video frame rate in frames per second. Used to scale the lost track buffer for consistent tracking across different frame rates.

30.0
track_activation_threshold float

float specifying minimum detection confidence to create new tracks. Higher values reduce false positives but may miss low-confidence objects.

0.25
minimum_consecutive_frames int

int specifying number of consecutive frames before a track is considered valid. Before reaching this threshold, tracks are assigned tracker_id of -1.

3
minimum_iou_threshold float

float specifying IoU threshold for associating detections to existing tracks. Higher values require more overlap.

0.3

update(detections)

Update tracker state with new detections and return tracked objects. Performs Kalman filter prediction, IoU-based association, and initializes new tracks for unmatched high-confidence detections.

Parameters:

Name Type Description Default
detections Detections

sv.Detections containing bounding boxes with shape (N, 4) in (x_min, y_min, x_max, y_max) format and optional confidence scores.

required

Returns:

Type Description
Detections

sv.Detections with tracker_id assigned for each detection. Unmatched or immature tracks have tracker_id of -1.

reset()

Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.

ByteTrack

trackers.core.bytetrack.tracker.ByteTrackTracker

Bases: BaseTracker

Track objects using ByteTrack algorithm with two-stage association. Associates both high and low confidence detections to reduce fragmentation and improve tracking through occlusions.

Parameters:

Name Type Description Default
lost_track_buffer int

int specifying number of frames to buffer when a track is lost. Increasing this value enhances occlusion handling but may increase ID switching for disappearing objects.

30
frame_rate float

float specifying video frame rate in frames per second. Used to scale the lost track buffer for consistent tracking across different frame rates.

30.0
track_activation_threshold float

float specifying minimum detection confidence to create new tracks. Higher values reduce false positives but may miss low-confidence objects.

0.7
minimum_consecutive_frames int

int specifying number of consecutive frames before a track is considered valid. Before reaching this threshold, tracks are assigned tracker_id of -1.

2
minimum_iou_threshold float

float specifying IoU threshold for associating detections to existing tracks. Higher values require more overlap.

0.1
high_conf_det_threshold float

float specifying threshold for separating high and low confidence detections in the two-stage association.

0.6

update(detections)

Update tracker state with new detections and return tracked objects. Performs Kalman filter prediction, two-stage association (high then low confidence), and initializes new tracks for unmatched detections.

Parameters:

Name Type Description Default
detections Detections

sv.Detections containing bounding boxes with shape (N, 4) in (x_min, y_min, x_max, y_max) format and optional confidence scores.

required

Returns:

Type Description
Detections

sv.Detections with tracker_id assigned for each detection. Unmatched detections have tracker_id of -1. Detection order may differ from input.

reset()

Reset tracker state by clearing all tracks and resetting ID counter. Call this method when switching to a new video or scene.