Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Make pet face NMS class-aware to match body NMS

Amrithesh Kakkoth Ente78f3cc1ed249
diff --git a/mobile/apps/photos/rust/src/ml/pet/detect.rs b/mobile/apps/photos/rust/src/ml/pet/detect.rs
index 29e42c7bdc..894ef7760a 100644
--- a/mobile/apps/photos/rust/src/ml/pet/detect.rs
+++ b/mobile/apps/photos/rust/src/ml/pet/detect.rs
@@ -303,7 +303,12 @@ fn naive_nms_pet_face(
if suppressed[j] {
continue;
}
- if calculate_iou_4(&detections[i].box_xyxy, &detections[j].box_xyxy) >= iou_threshold {
+ // Only suppress within the same class so a dog and cat
+ // occupying the same region are both retained.
+ if detections[i].class_id == detections[j].class_id
+ && calculate_iou_4(&detections[i].box_xyxy, &detections[j].box_xyxy)
+ >= iou_threshold
+ {
suppressed[j] = true;
}
}