pub const CRATE_ID: &str = "yscv-detect";
pub const CLASS_ID_PERSON: usize = 0;
pub const CLASS_ID_FACE: usize = 1;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct BoundingBox {
pub x1: f32,
pub y1: f32,
pub x2: f32,
pub y2: f32,
}
impl BoundingBox {
pub fn width(&self) -> f32 {
(self.x2 - self.x1).max(0.0)
}
pub fn height(&self) -> f32 {
(self.y2 - self.y1).max(0.0)
}
pub fn area(&self) -> f32 {
self.width() * self.height()
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Detection {
pub bbox: BoundingBox,
pub score: f32,
pub class_id: usize,
}