forked from jamjamjon/usls
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathy.rs
More file actions
72 lines (66 loc) · 2.02 KB
/
Copy pathy.rs
File metadata and controls
72 lines (66 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use aksr::Builder;
use crate::{Hbb, Image, Keypoint, Mask, Obb, Polygon, Prob, Text};
/// Container for inference results for each image.
///
/// This struct holds various possible outputs from an image inference process,
/// including probabilities, bounding boxes, keypoints, minimum bounding rectangles,
/// polygons, masks, text annotations, and embeddings.
///
#[derive(Builder, Clone, Default)]
pub struct Y {
pub texts: Vec<Text>,
pub probs: Vec<Prob>,
pub keypoints: Vec<Keypoint>,
pub keypointss: Vec<Vec<Keypoint>>,
pub hbbs: Vec<Hbb>,
pub obbs: Vec<Obb>,
pub polygons: Vec<Polygon>,
pub masks: Vec<Mask>,
pub images: Vec<Image>,
}
impl std::fmt::Debug for Y {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut s = f.debug_struct("Y");
if !self.texts.is_empty() {
s.field("Texts", &self.texts);
}
if !self.probs.is_empty() {
s.field("Probs", &self.probs);
}
if !self.hbbs.is_empty() {
s.field("Hbbs", &self.hbbs);
}
if !self.obbs.is_empty() {
s.field("Obbs", &self.obbs);
}
if !self.keypoints.is_empty() {
s.field("Kpts", &self.keypoints);
}
if !self.keypointss.is_empty() {
s.field("Kptss", &self.keypointss);
}
if !self.polygons.is_empty() {
s.field("Polys", &self.polygons);
}
if !self.masks.is_empty() {
s.field("Masks", &self.masks);
}
if !self.images.is_empty() {
s.field("Images", &self.images);
}
s.finish()
}
}
impl Y {
pub fn is_empty(&self) -> bool {
self.texts.is_empty()
&& self.probs.is_empty()
&& self.hbbs.is_empty()
&& self.obbs.is_empty()
&& self.keypoints.is_empty()
&& self.keypointss.is_empty()
&& self.polygons.is_empty()
&& self.masks.is_empty()
&& self.images.is_empty()
}
}