From 993b0e09da7a31eaa4ab9aa5f56dc6b5789aa08a Mon Sep 17 00:00:00 2001 From: zhiskey <1274803758@qq.com> Date: Mon, 9 May 2022 00:00:27 +0800 Subject: [PATCH] fix: construction site protection detection bug --- .../demo.py" | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git "a/codes/17.YOLOv5 jetson nano \345\267\245\345\234\260\351\230\262\346\212\244\346\243\200\346\265\213/demo.py" "b/codes/17.YOLOv5 jetson nano \345\267\245\345\234\260\351\230\262\346\212\244\346\243\200\346\265\213/demo.py" index 6f89bc76..91f0a7d8 100755 --- "a/codes/17.YOLOv5 jetson nano \345\267\245\345\234\260\351\230\262\346\212\244\346\243\200\346\265\213/demo.py" +++ "b/codes/17.YOLOv5 jetson nano \345\267\245\345\234\260\351\230\262\346\212\244\346\243\200\346\265\213/demo.py" @@ -102,23 +102,25 @@ def get_person_info_list(self,person_list,hat_list,vest_list): person_info_item[0]= person_box # 依次与帽子计算IOU + max_hat_iou = 0 for hat in hat_list: hat_box = hat[:6] hat_iou = self.get_iou(person_box, hat_box) - if hat_iou > hat_iou_thresh: + if hat_iou > hat_iou_thresh and hat_iou > max_hat_iou: person_info_item[1] = hat_box - break + max_hat_iou = hat_iou # 依次与防护服计算IOU + max_vest_iou = 0 for vest in vest_list: vest_box = vest[:5] vest_iou = self.get_iou(person_box, vest_box) - if vest_iou > vest_iou_thresh: + if vest_iou > vest_iou_thresh and vest_iou > max_vest_iou: person_info_item[2] = vest_box - break + max_vest_iou = vest_iou person_info_list.append(person_info_item)