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

iou函数有一点bug #17

Open
mike08700000 opened this issue Feb 27, 2024 · 1 comment
Open

iou函数有一点bug #17

mike08700000 opened this issue Feb 27, 2024 · 1 comment

Comments

@mike08700000
Copy link

"""
iou函数未检测当两个框没有intersection的时候,如
box1 = (1,2,3,4)
box2 = (5,6,7,8)
"""
def iou(box1, box2):
xi1 = np.maximum(box1_x1, box2_x1)
yi1 = np.maximum(box1_y1, box2_y1)
xi2 = np.minimum(box1_x2, box2_x2)
yi2 = np.minimum(box1_y2, box2_y2)
inter_width = xi1-xi2
inter_height =yi1-yi2
inter_area = inter_width * inter_height
#suggest add the code below
if inter_width>0 and inter_height>0:
inter_area = 0

box1_area = (box1_x1 - box1_x2)*(box1_y1-box1_y2)
box2_area = (box2_x1 - box2_x2)*(box2_y1-box2_y2)
union_area = box1_area +  box2_area - inter_area

# compute the IoU 
iou = inter_area/ union_area
@mike08700000
Copy link
Author

""" iou函数未检测当两个框没有intersection的时候,如 box1 = (1,2,3,4) box2 = (5,6,7,8) """ def iou(box1, box2): xi1 = np.maximum(box1_x1, box2_x1) yi1 = np.maximum(box1_y1, box2_y1) xi2 = np.minimum(box1_x2, box2_x2) yi2 = np.minimum(box1_y2, box2_y2) inter_width = xi1-xi2 inter_height =yi1-yi2 inter_area = inter_width * inter_height #suggest add the code below if inter_width>0 and inter_height>0: inter_area = 0

box1_area = (box1_x1 - box1_x2)*(box1_y1-box1_y2)
box2_area = (box2_x1 - box2_x2)*(box2_y1-box2_y2)
union_area = box1_area +  box2_area - inter_area

# compute the IoU 
iou = inter_area/ union_area

在吴恩达深度学习car detection的代码iou函数中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant