1pub const CRATE_ID: &str = "yscv-detect";
2pub const CLASS_ID_PERSON: usize = 0;
3pub const CLASS_ID_FACE: usize = 1;
4
5#[derive(Debug, Clone, Copy, PartialEq)]
7pub struct BoundingBox {
8 pub x1: f32,
9 pub y1: f32,
10 pub x2: f32,
11 pub y2: f32,
12}
13
14impl BoundingBox {
15 pub fn width(&self) -> f32 {
16 (self.x2 - self.x1).max(0.0)
17 }
18
19 pub fn height(&self) -> f32 {
20 (self.y2 - self.y1).max(0.0)
21 }
22
23 pub fn area(&self) -> f32 {
24 self.width() * self.height()
25 }
26}
27
28#[derive(Debug, Clone, Copy, PartialEq)]
30pub struct Detection {
31 pub bbox: BoundingBox,
32 pub score: f32,
33 pub class_id: usize,
34}