pub trait DetectionBox: Debug + Clone {
// Required methods
fn bbox(&self) -> [f32; 4];
fn score(&self) -> f32;
fn label(&self) -> usize;
}Expand description
A bounding box produced by a detection model, suitable for use with a Tracker.
Implement this trait on your model’s output type to feed it directly into
ByteTrack without copying. The tracker crate has
no dependency on edgefirst-decoder; any type that can report an XYXY box,
a confidence score, and a class label satisfies this contract.
§Coordinates
bbox() must return [xmin, ymin, xmax, ymax] in normalised [0, 1]
coordinates or in pixel coordinates — the tracker does not prescribe units,
but all detections passed to a single Tracker::update call must use the
same coordinate space.
§Example
use edgefirst_tracker::DetectionBox;
#[derive(Debug, Clone)]
struct MyDetection { bbox: [f32; 4], score: f32, label: usize }
impl DetectionBox for MyDetection {
fn bbox(&self) -> [f32; 4] { self.bbox }
fn score(&self) -> f32 { self.score }
fn label(&self) -> usize { self.label }
}Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".