-
Notifications
You must be signed in to change notification settings - Fork 64
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
incorrect iou? #8
Comments
@filaPro It's definitely a bug. It happens when two edges "perfectly" overlap. I've changed the
It's probably not a big issue in practice because It's quite unlikely that the predicted bounding box and the ground truth would overlap in such a way. But I'll still check my code again and let you know when I figure it out. |
Probably this t = den_t / (num + EPSILON)
mask_t = (t >= 0) * (t < 1)
...
u = - den_u / (num + EPSILON)
mask_u = (u >= 0) * (u < 1) with t = den_t / num
t[num == .0] = -1.
mask_t = (t >= 0) * (t <= 1)
...
u = -den_u / num
u[num == .0] = -1.
mask_u = (u >= 0) * (u <= 1) everything looks fine. |
Looks like this case: box_0 = torch.tensor([.0, .0, 2., 2., .0], device=device)
box_1 = torch.tensor([.0, 1., 2., 2., .0], device=device) is also incorrect for now. However the solution above helps. |
@filaPro |
@filaPro |
Thanks a lot! |
For this case:
the answer is |
@filaPro I spent some time on this issue. The problem is how I formulate the problem. I split the problem to 4 sub-problems.
The trouble is, how to define "corner in box" and "intersection points", when two edges are collinear. For example, with following two boxes, how many "corners in box" should be counted? 0 or 2 ? Where is the intersection points? Or do they exist?
My previous code didn't cover these edge cases well so it delivered wrong value. I tried to fix it and the result seems good now. But to be honest, I'm not sure if it's the best solution and if all corner cases are covered... Also, I am not very clear why current version works... |
Looks like 1st question can be answered easily. However to answer properly on the 2nd question we need more code to manually intersect 2 edges, in case they are collinear. Current version still doesn't cover the case of 2 equal boxes :( |
I committed several times. I think the most recent commit (a63b0fb) covers the case of 2 equal boxes. Did you try it? |
Sorry, now it's fine. Everything works on some kind of magic :) |
IOU still not working properly. I get .333, instead of 1... |
@kevinghst I hope the bug is now properly fixed in commit 6267cef . This time I've modified the CUDA part and removed the magic. BTW, please remember to re-compile the CUDA extension. |
Hi @lilanxiao ,
Maybe I'm missing something but:
returns
[[0.33333334]]
.However, these 2 boxes are not intersecting.
The text was updated successfully, but these errors were encountered: