kmeans-anchor-boxes
kmeans-anchor-boxes copied to clipboard
Incorrect interaction area calculation
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.
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.
Now it is clear for me. Thanks for your answer.