Skip to content

Fixed negative intersection calculation #24

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shaharzuler
Copy link

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.

Replaced np.clip() with separate minimum-maximum check, since np.clip() doesnt verify a_min<a_max. np.clip() sometimes caused negative IoU intersection values.
Updated intersect_area() calculation - fixed negative IoU values
@MathGaron
Copy link
Owner

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
Copy link
Author

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. ]]

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

Successfully merging this pull request may close these issues.

2 participants