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 function in Object detection Notebook #5

Open
nishant-sethi opened this issue Sep 23, 2018 · 1 comment
Open

IOU function in Object detection Notebook #5

nishant-sethi opened this issue Sep 23, 2018 · 1 comment

Comments

@nishant-sethi
Copy link

Not correct for the cases where there is no intersection between two anchor boxes. Ideally, it should return 0

@pradumna-gautam
Copy link

The correct code:

START CODE HERE ### (≈ 7 lines)

yi1 = max(box1[1], box2[1])
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 = (xi2 - xi1)*(yi2 - yi1)
inter_area = max((xi2 - xi1), 0)*max((yi2 - yi1), 0)

END CODE HERE

It will give you following results :

iou for intersecting boxes = 0.14285714285714285
iou for non-intersecting boxes = 0.0
iou for boxes that only touch at vertices = 0.0
iou for boxes that only touch at edges = 0.0

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

2 participants