Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 工地防护检测BUG修复,见 issue #21 #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions codes/17.YOLOv5 jetson nano 工地防护检测/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down