mmcv
mmcv copied to clipboard
wrong result of differentiable 3D IoU, occurring larger than 1
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.
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.
Thanks for your feedback~ maybe @zytx121 could have a look.
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])
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?
My pytorch version is 1.7 and cuda version is the same as you.
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
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.