kataglyphis_rustprojecttemplate/
detection.rs1#[derive(Clone, Copy, Debug, Default, PartialEq)]
7#[cfg_attr(not(onnx), allow(dead_code))]
8pub struct Detection {
9 pub x1: f32,
10 pub y1: f32,
11 pub x2: f32,
12 pub y2: f32,
13 pub score: f32,
14 pub class_id: i64,
15}
16
17impl std::fmt::Display for Detection {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 write!(
20 f,
21 "class {} ({:.0}%) [{:.1}, {:.1}, {:.1}, {:.1}]",
22 self.class_id,
23 self.score * 100.0,
24 self.x1,
25 self.y1,
26 self.x2,
27 self.y2,
28 )
29 }
30}