Skip to content

trackforge / trackers / byte_track


Module byte_track

ByteTrack

ByteTrack: Multi-Object Tracking by Associating Every Detection Box

Yifu Zhang, Peize Sun, Yi Jiang, Dongdong Yu, Fucheng Weng, Zehuan Yuan, Ping Luo, Wenyu Liu, Xinggang Wang

arXiv 2110.06864

ByteTrack is a simple, fast and strong multi-object tracker.

Abstract

Multi-object tracking (MOT) aims at estimating bounding boxes and identities of objects in videos. Most methods obtain identities by associating detection boxes whose scores are higher than a threshold. The objects with low detection scores, e.g. occluded objects, are simply thrown away, which brings non-negligible true object missing and fragmented trajectories. To solve this problem, ByteTrack presents a simple, effective and generic association method, tracking by associating every detection box instead of only the high score ones. For the low score detection boxes, it utilizes their similarities with tracklets to recover true objects and filter out the background detections.

Original Repository

This is a clean-room Rust implementation of the ByteTrack algorithm as described in the original paper. The official reference implementation can be found at ifzhang/ByteTrack.

Citation

@article{zhang2022bytetrack,
  title={ByteTrack: Multi-Object Tracking by Associating Every Detection Box},
  author={Zhang, Yifu and Sun, Peize and Jiang, Yi and Yu, Dongdong and Weng, Fucheng and Yuan, Zehuan and Luo, Ping and Liu, Wenyu and Wang, Xinggang},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  year={2022}
}

Quick Reference

Item Kind Description
ByteTrack struct ByteTrack tracker implementation.
STrack struct A Single Track (STrack) representing a tracked object.
TrackState enum

Types

ByteTrack

struct ByteTrack {
    // [REDACTED: Private Fields]
}

ByteTrack tracker implementation.

ByteTrack is a simple, fast and strong multi-object tracker.

Example

use trackforge::trackers::byte_track::ByteTrack;

// Initialize tracker
let mut tracker = ByteTrack::new(0.5, 30, 0.8, 0.6);

// Simulated detections: (tlwh_box, score, class_id)
let detections = vec![
    ([100.0, 100.0, 50.0, 100.0], 0.9, 0),
    ([200.0, 200.0, 60.0, 120.0], 0.85, 0),
];

// Update tracker
let tracks = tracker.update(detections);

for track in tracks {
    println!("Track ID: {}, Box: {:?}", track.track_id, track.tlwh);
}

Abstract

Implementations

fn new(track_thresh: f32, track_buffer: usize, match_thresh: f32, det_thresh: f32) -> Self

Create a new ByteTrack instance.

# Arguments

Argument Description
track_thresh Threshold for high confidence detections (e.g., 0.5 or 0.6).
track_buffer Number of frames to keep a lost track alive (e.g., 30).
match_thresh IoU threshold for matching (e.g., 0.8).
det_thresh Threshold for initializing a new track (usually same as or slightly lower than track_thresh).

fn update(&mut self, output_results: Vec<([f32; 4], f32, i64)>) -> Vec<STrack>

Update the tracker with detections from the current frame.

# Arguments

Argument Description
output_results A vector of detections, where each detection is (TLWH_Box, Score, ClassID).

Returns

  • Vec<STrack> - A list of active tracks in the current frame.

Trait Implementations

fn to_subset(&self) -> Option<SS>

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP

STrack

struct STrack {
    pub tlwh: [f32; 4],
    pub score: f32,
    pub class_id: i64,
    pub track_id: u64,
    pub state: TrackState,
    pub is_activated: bool,
    pub frame_id: usize,
    pub start_frame: usize,
    pub tracklet_len: usize,
    pub mean: crate::utils::kalman::StateVector,
    pub covariance: crate::utils::kalman::CovarianceMatrix,
}

A Single Track (STrack) representing a tracked object.

Fields

Name Type Description
tlwh [f32; 4] Bounding box in TLWH (Top-Left-Width-Height) format.
score f32 Detection confidence score.
class_id i64 Class ID of the object.
track_id u64 Unique track ID.
state TrackState Current tracking state (New, Tracked, Lost, Removed).
is_activated bool Whether the track is currently activated (confirmed).
frame_id usize Current frame ID.
start_frame usize Frame ID where the track started.
tracklet_len usize Length of the tracklet (number of frames tracked).
mean crate::utils::kalman::StateVector Kalman Filter state mean.
covariance crate::utils::kalman::CovarianceMatrix Kalman Filter state covariance.

Implementations

fn new(tlwh: [f32; 4], score: f32, class_id: i64) -> Self

fn activate(&mut self, kf: &KalmanFilter, frame_id: usize)

fn re_activate(&mut self, new_track: STrack, frame_id: usize, new_id: bool)

fn update(&mut self, new_track: STrack, frame_id: usize)

fn predict(&mut self, kf: &KalmanFilter)

Trait Implementations

impl Clone for STrack

fn clone(&self) -> STrack

impl Debug for STrack

fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result

fn to_subset(&self) -> Option<SS>

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP

TrackState

enum TrackState {
    New,
    Tracked,
    Lost,
    Removed,
}

Trait Implementations

impl Clone for TrackState

fn clone(&self) -> TrackState

impl Copy for TrackState
impl Debug for TrackState

fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result

impl Eq for TrackState
impl PartialEq for TrackState

fn eq(&self, other: &TrackState) -> bool

fn to_subset(&self) -> Option<SS>

fn is_in_subset(&self) -> bool

fn to_subset_unchecked(&self) -> SS

fn from_subset(element: &SS) -> SP