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

作业答案有bug #10

Open
langziwuqing opened this issue Aug 16, 2019 · 0 comments
Open

作业答案有bug #10

langziwuqing opened this issue Aug 16, 2019 · 0 comments

Comments

@langziwuqing
Copy link

4 卷积神经网络/Week3 目标检测/4.3 目标检测/Car detection for Autonomous Driving/Autonomous driving application-Car detection-v1-answer.ipynb,计算iou的函数,此段代码有bug:
xi1 = max(box1[0], box2[0])
yi1 = max(box1[1], box2[1])
xi2 = min(box1[2], box2[2])
yi2 = min(box1[3], box2[3])
inter_area = (yi2 - yi1) * (xi2 - xi1)
当两个框没有重叠时,yi2 - yi1和xi2 - xi1的值都是负数,inter_area应该是0,所以应该这么写:
xi1 = max(box1[0], box2[0])
yi1 = max(box1[1], box2[1])
xi2 = min(box1[2], box2[2])
yi2 = min(box1[3], box2[3])
if (yi2 - yi1 < 0) or (xi2 - xi1 < 0):
inter_area = 0
else:
inter_area = (yi2 - yi1) * (xi2 - xi1)

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