Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Incorrect interaction area calculation #6

Open
kangskii opened this issue Jan 26, 2019 · 2 comments
Open

Incorrect interaction area calculation #6

kangskii opened this issue Jan 26, 2019 · 2 comments

Comments

@kangskii
Copy link

Hi,
In yout iou() function, you cannot calculate the interaction AREA by the following equation:
(Line16) intersection = x * y

In my opinion, we cannot calculate the overlap if we only know the width and heights of the two boxes.
Please help to double check and iou() function.

@lars76
Copy link
Owner

lars76 commented Jan 26, 2019

Hi, let's look at the original IoU formula in the numerator (intersection): (min(x_A2, x_B2) - max(x_A1, x_B1))(min(y_A2, y_B2) - max(y_A1, y_B1)). Now we shift all boxes to the origin. Then (min(x_A2', x_B2') - max(0, 0))(min(y_A2', y_B2') - max(0, 0)) = min(x_A2', x_B2') * min(y_A2', y_B2'), which is line 16.

So we are actually considering both coordinates, but the lower point of each box is (0, 0) and the upper point is (x2, y2). I hope this makes sense.

@kangskii
Copy link
Author

Now it is clear for me. Thanks for your answer.

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

No branches or pull requests

2 participants