byte_tracker

A standalone Python implementation of the ByteTrack multi-object tracker based on the official implementation.

source

BYTETracker

 BYTETracker (track_thresh:float=0.25, track_buffer:int=30,
              match_thresh:float=0.8, frame_rate:int=30)

BYTETracker is a class for tracking objects in video streams using bounding box detections, with methods for processing and updating tracks based on detection results and IoU matching.

Type Default Details
track_thresh float 0.25 Threshold value for tracking.
track_buffer int 30 Size of buffer for tracking.
match_thresh float 0.8 Threshold value for matching tracks to detections.
frame_rate int 30 Frame rate of the input video stream.

source

BYTETracker.__init__

 BYTETracker.__init__ (track_thresh:float=0.25, track_buffer:int=30,
                       match_thresh:float=0.8, frame_rate:int=30)

Initializes the BYTETracker.

Type Default Details
track_thresh float 0.25 Threshold value for tracking.
track_buffer int 30 Size of buffer for tracking.
match_thresh float 0.8 Threshold value for matching tracks to detections.
frame_rate int 30 Frame rate of the input video stream.

source

BYTETracker._process_output

 BYTETracker._process_output (output_results)

Process the output results to separate scores and bounding boxes.

Type Details
output_results Detection results.
Returns tuple scores and bounding boxes.

source

BYTETracker._scale_bboxes

 BYTETracker._scale_bboxes (img_info:tuple, img_size:tuple, bboxes:list)

Scale bounding boxes based on image size.

Type Details
img_info tuple Original height and width of the image.
img_size tuple Target size.
bboxes list List of bounding boxes.
Returns list Scaled bounding boxes.

source

BYTETracker._get_detections

 BYTETracker._get_detections (dets:list, scores_keep:list)

Convert bounding boxes to STrack objects.

Type Details
dets list List of detections.
scores_keep list Scores for the detections.
Returns list List of STrack objects.

source

BYTETracker._update_tracked_stracks

 BYTETracker._update_tracked_stracks ()

Update the list of tracked and unconfirmed tracks.


source

BYTETracker._match_tracks_to_detections

 BYTETracker._match_tracks_to_detections (stracks:list, detections:list,
                                          thresh:float)

Match tracks to detections using IOU.

Type Details
stracks list List of tracks.
detections list List of detections.
thresh float IOU threshold for matching.
Returns tuple Matches and unmatched tracks and detections.

source

BYTETracker._update_tracks

 BYTETracker._update_tracks (stracks:list, detections:list, matches:list,
                             refind_stracks:list, activated_stracks:list)

Update tracks based on matches with detections.

Type Details
stracks list List of tracks.
detections list List of detections.
matches list Matched track-detection pairs.
refind_stracks list List to add refind tracks.
activated_stracks list List to add activated tracks.

source

BYTETracker.update

 BYTETracker.update (output_results, img_info:tuple, img_size:tuple)

Update the tracker based on new detections.

Type Details
output_results Detection results.
img_info tuple Original height and width of the image.
img_size tuple Target size.
Returns list List of activated tracks.

source

joint_stracks

 joint_stracks (track_list_a:list, track_list_b:list)

Combines two lists of tracks ensuring each track is unique based on its track_id.

Type Details
track_list_a list The first list of tracks.
track_list_b list The second list of tracks.
Returns list A combined list of unique tracks.

source

sub_stracks

 sub_stracks (track_list_a:list, track_list_b:list)

Subtracts the tracks in track_list_b from track_list_a based on track_id.

Type Details
track_list_a list The list of tracks to subtract from.
track_list_b list The list of tracks to subtract.
Returns list A list containing tracks from track_list_a that are not in track_list_b.

source

remove_duplicate_stracks

 remove_duplicate_stracks (s_tracks_a:list, s_tracks_b:list)

Removes duplicate tracks from two lists based on a defined distance metric and time criteria.

Type Details
s_tracks_a list The first list of tracks.
s_tracks_b list The second list of tracks.
Returns tuple Two lists of tracks with duplicates removed.