π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Apply NMS per species for pet body detections
Amrithesh Kakkoth Enteebd703c35b12
diff --git a/mobile/apps/photos/rust/src/ml/pet/detect.rs b/mobile/apps/photos/rust/src/ml/pet/detect.rsindex cd57dd98c5..428650ee7e 100644--- a/mobile/apps/photos/rust/src/ml/pet/detect.rs+++ b/mobile/apps/photos/rust/src/ml/pet/detect.rs@@ -321,12 +321,16 @@ fn naive_nms_pet_body(while i + 1 < detections.len() {let mut j = i + 1;while j < detections.len() {- let iou = calculate_iou_4(&detections[i].box_xyxy, &detections[j].box_xyxy);- if iou >= iou_threshold {- detections.remove(j);- } else {- j += 1;+ // Only suppress within the same COCO class so a dog and cat+ // occupying the same region are both retained.+ if detections[i].coco_class == detections[j].coco_class {+ let iou = calculate_iou_4(&detections[i].box_xyxy, &detections[j].box_xyxy);+ if iou >= iou_threshold {+ detections.remove(j);+ continue;+ }}+ j += 1;}i += 1;}