MathGaron / mean_average_precision

Small and simple python/numpy utility to compute mean average precision (mAP) on detection task.
MIT License
117 stars 45 forks source link

Fixed negative intersection calculation #24

Open shaharzuler opened 3 years ago

shaharzuler commented 3 years ago

Hey, using np.clip() doesnt verify a_min<a_max. That caused negative intersection calculations when max_diff was negative. I noticed it when I got IoU values above 1. I replaced np.clip() with separate minimum and maximum calculations.

MathGaron commented 3 years ago

Thanks for the pull request, I will check this out when I can find the time. Meanwhile, could you provide the edge case here please?

shaharzuler commented 3 years ago

sure. box_a = [[278.5549 353.25702 323.6288 459.951 ] [129.14798 10.8454895 370.7251 330.6273 ] [185.53943 154.68863 467.73505 480. ]] box_b = [[232. 353. 326. 457.]]

causes: inter = [[[ 45.073914 103.74298 ]] [[ 94. -22.372711]] [[ 94. 104. ]]]

which returns: [[ 4676.102] [-2103.035] [ 9776. ]]