pub struct ByteTrack<T: DetectionBox> {
pub track_extra_lifespan: u64,
pub track_high_conf: f32,
pub track_iou: f32,
pub track_update: f32,
pub tracklets: Vec<Tracklet<T>>,
pub frame_count: i32,
}Expand description
ByteTrack multi-object tracker — the concrete Tracker implementation.
Prefer constructing via ByteTrackBuilder rather than directly, since the
public fields default to zero-values that are not usable defaults.
§Algorithm overview
Each call to Tracker::update runs a two-pass IoU matching loop:
- Predict. Every active tracklet’s Kalman filter advances one step, predicting where the object should appear this frame.
- High-confidence pass. Detections scoring ≥
track_high_confare assigned to existing tracklets via LAPJV linear assignment on an IoU cost matrix (cells belowtrack_iouare set toINVALID_MATCH). - Low-confidence pass. Remaining unmatched tracklets are tried against all remaining detections (any score) — this recovers briefly occluded objects without admitting low-quality detections into the high-confidence pool.
- Expire. Tracklets whose
last_updatedis more thantrack_extra_lifespannanoseconds behindtimestampare removed. - Spawn. Unmatched high-confidence detections spawn new tracklets.
§Thread safety
ByteTrack<T> is Send + Sync (provided T: Send + Sync). Mutable
methods take &mut self; callers that share a tracker across threads must
serialize with an external mutex.
Fields§
§track_extra_lifespan: u64How long (in nanoseconds) a tracklet may go unmatched before it is deleted. Default: 500 ms (500_000_000 ns).
track_high_conf: f32Minimum detection score to enter the high-confidence matching pass and to spawn new tracklets. Default: 0.7.
track_iou: f32Minimum IoU required for a detection–tracklet assignment to be accepted.
Pairs below this threshold are set to INVALID_MATCH in the cost matrix.
Default: 0.25.
track_update: f32Kalman filter measurement gain (0–1). Lower values trust the Kalman prediction more; higher values follow the raw detection more closely. Default: 0.25.
tracklets: Vec<Tracklet<T>>All currently active tracklets (matched or unmatched-but-not-expired).
frame_count: i32Running count of frames processed since the tracker was created.
Incremented on every Tracker::update call, including empty frames.
Trait Implementations§
Source§impl<T> Tracker<T> for ByteTrack<T>where
T: DetectionBox,
impl<T> Tracker<T> for ByteTrack<T>where
T: DetectionBox,
Source§fn update(&mut self, boxes: &[T], timestamp: u64) -> Vec<Option<TrackInfo>>
fn update(&mut self, boxes: &[T], timestamp: u64) -> Vec<Option<TrackInfo>>
Source§fn get_active_tracks(&self) -> Vec<ActiveTrackInfo<T>>
fn get_active_tracks(&self) -> Vec<ActiveTrackInfo<T>>
Auto Trait Implementations§
impl<T> Freeze for ByteTrack<T>
impl<T> RefUnwindSafe for ByteTrack<T>where
T: RefUnwindSafe,
impl<T> Send for ByteTrack<T>where
T: Send,
impl<T> Sync for ByteTrack<T>where
T: Sync,
impl<T> Unpin for ByteTrack<T>where
T: Unpin,
impl<T> UnsafeUnpin for ByteTrack<T>
impl<T> UnwindSafe for ByteTrack<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.