Skip to content

trackforge / traits


Module traits

Quick Reference

Item Kind Description
Tracker trait Common interface for the detection-only trackers.
Detection type A detection passed to a tracker: (tlwh, score, class_id).

Types

Detection

type Detection = ([f32; 4], f32, i64);

A detection passed to a tracker: (tlwh, score, class_id).

The box is in TLWH (top-left x, top-left y, width, height) format.


Traits

Tracker

trait Tracker { ... }

Common interface for the detection-only trackers.

SORT, ByteTrack, and OC-SORT all consume a frame's detections and return the active tracks, so generic code can drive any of them through this trait. DeepSORT needs the source frame to extract appearance features and therefore keeps its own update(&image, detections) method instead of this trait.

use trackforge::traits::{Detection, Tracker};
use trackforge::trackers::sort::Sort;

fn run_one<T: Tracker>(tracker: &mut T, dets: Vec<Detection>) -> Vec<T::Track> {
    tracker.update(dets)
}

let mut tracker = Sort::new(1, 1, 0.3);
let tracks = run_one(&mut tracker, vec![([0.0, 0.0, 10.0, 10.0], 0.9, 0)]);
assert_eq!(tracks.len(), 1);

Associated Types

  • type Track

Required Methods

  • fn update(&mut self, detections: Vec<Detection>) -> Vec<<Self as >::Track>

Update the tracker with the current frame's detections and return the

Implementors