Skip to content
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

wrong result of differentiable 3D IoU, occurring larger than 1 #1922

Open
Angericky opened this issue Apr 28, 2022 · 7 comments · May be fixed by #2067
Open

wrong result of differentiable 3D IoU, occurring larger than 1 #1922

Angericky opened this issue Apr 28, 2022 · 7 comments · May be fixed by #2067
Assignees

Comments

@Angericky
Copy link

Angericky commented Apr 28, 2022

Hello,

I apply function diff_iou_rotated_3d from mmcv.ops to implement 3D IoU loss.
However, the computed IoU can be larger than 1 in some circumstances, which is wrong by definition.
But if I compute the specified predicition and target where IoU > 1 occurred, the result might be right.

This bug could be related to parallelization in cuda file, but I couldn't locate the problem code.

@Angericky
Copy link
Author

Angericky commented Apr 28, 2022

For easy reproduction, I upload arrays causing the bug.
The zip file contains 2 .npy files separately including prediction and label numpy array.
Use diff_iou_rotated_3d function can reproduce the bug.

boxes.zip

@HAOCHENYE HAOCHENYE assigned HAOCHENYE and unassigned HAOCHENYE Apr 28, 2022
@HAOCHENYE
Copy link
Collaborator

Thanks for your feedback~ maybe @zytx121 could have a look.

@zytx121
Copy link
Contributor

zytx121 commented Apr 29, 2022

It's a little strange. When I run this code, all results are smaller than 1. So, I can't reproduce the bug.

label = torch.from_numpy(np.load("label.npy")).cuda()
pred = torch.from_numpy(np.load("pred_diff.npy")).cuda()
ious = diff_iou_rotated_3d(label, pred).cpu()

for i in range(ious.shape[0]):
    for j in range(ious.shape[1]):
        print(ious[i][j])

results.txt

@Angericky
Copy link
Author

That's weird... I use the same code and get 3.5672 with index of [15, 51].
My pytorch version is 1.10.1 and cuda version 10.2. What's your environment?

@zytx121
Copy link
Contributor

zytx121 commented Apr 29, 2022

My pytorch version is 1.7 and cuda version is the same as you.

@Angericky
Copy link
Author

I downgrade pytorch to 1.7 and the bug still exists.
Oh I found the wrong value 3.5672 in your result.txt at line 1972

@filaPro
Copy link
Contributor

filaPro commented Apr 30, 2022

Hi @Angericky ,

According to the author of the original rotated iou implementation the result may be inaccurate in some corner cases 1, 2. Actually it is a bug. However even in current implementation the rotated iou loss is extremely useful for object detection 3, 4.

@filaPro filaPro linked a pull request Jun 21, 2022 that will close this issue
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 a pull request may close this issue.

4 participants