feat(gui): Added iced gui
This commit is contained in:
@@ -170,12 +170,14 @@ impl FaceDetectionModelOutput {
|
||||
let boxes = self.bbox.slice(s![0, .., ..]);
|
||||
let landmarks_raw = self.landmark.slice(s![0, .., ..]);
|
||||
|
||||
let mut decoded_boxes = Vec::new();
|
||||
let mut decoded_landmarks = Vec::new();
|
||||
let mut confidences = Vec::new();
|
||||
// let mut decoded_boxes = Vec::new();
|
||||
// let mut decoded_landmarks = Vec::new();
|
||||
// let mut confidences = Vec::new();
|
||||
|
||||
for i in 0..priors.shape()[0] {
|
||||
if scores[i] > config.threshold {
|
||||
dbg!(priors.shape());
|
||||
let (decoded_boxes, decoded_landmarks, confidences) = (0..priors.shape()[0])
|
||||
.filter(|&i| scores[i] > config.threshold)
|
||||
.map(|i| {
|
||||
let prior = priors.row(i);
|
||||
let loc = boxes.row(i);
|
||||
let landm = landmarks_raw.row(i);
|
||||
@@ -200,16 +202,21 @@ impl FaceDetectionModelOutput {
|
||||
let mut bbox =
|
||||
Aabb2::from_min_max_vertices(Point2::new(xmin, ymin), Point2::new(xmax, ymax));
|
||||
if config.clamp {
|
||||
bbox.component_clamp(0.0, 1.0);
|
||||
bbox = bbox.component_clamp(0.0, 1.0);
|
||||
}
|
||||
decoded_boxes.push(bbox);
|
||||
|
||||
// Decode landmarks
|
||||
let mut points = [Point2::new(0.0, 0.0); 5];
|
||||
for j in 0..5 {
|
||||
points[j].x = prior_cx + landm[j * 2] * var[0] * prior_w;
|
||||
points[j].y = prior_cy + landm[j * 2 + 1] * var[0] * prior_h;
|
||||
}
|
||||
let points: [Point2<f32>; 5] = (0..5)
|
||||
.map(|j| {
|
||||
Point2::new(
|
||||
prior_cx + landm[j * 2] * var[0] * prior_w,
|
||||
prior_cy + landm[j * 2 + 1] * var[0] * prior_h,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
||||
let landmarks = FaceLandmarks {
|
||||
left_eye: points[0],
|
||||
right_eye: points[1],
|
||||
@@ -217,11 +224,18 @@ impl FaceDetectionModelOutput {
|
||||
left_mouth: points[3],
|
||||
right_mouth: points[4],
|
||||
};
|
||||
decoded_landmarks.push(landmarks);
|
||||
confidences.push(scores[i]);
|
||||
}
|
||||
}
|
||||
|
||||
(bbox, landmarks, scores[i])
|
||||
})
|
||||
.fold(
|
||||
(Vec::new(), Vec::new(), Vec::new()),
|
||||
|(mut boxes, mut landmarks, mut confs), (bbox, landmark, conf)| {
|
||||
boxes.push(bbox);
|
||||
landmarks.push(landmark);
|
||||
confs.push(conf);
|
||||
(boxes, landmarks, confs)
|
||||
},
|
||||
);
|
||||
Ok(FaceDetectionProcessedOutput {
|
||||
bbox: decoded_boxes,
|
||||
confidence: confidences,
|
||||
|
||||
Reference in New Issue
Block a user