lilanxiao / Rotated_IoU

Differentiable IoU of rotated bounding boxes using Pytorch
MIT License
415 stars 64 forks source link

Bug in cal_dious_3d function #27

Open ShuojieMo opened 3 years ago

ShuojieMo commented 3 years ago

.Bug was found when I use the cal_iou_3d() . IoU result of two bbox3d will get wrong when the angle = np.pi/4 , but get correct when the angle = np.pi/4 + 1e-6. Following is my test case:

import torch
from oriented_iou_loss import cal_diou_3d

x = torch.tensor([0., 0., 0., 2., 2., 2., np.pi/4]
                 ).view(1, 1, 7).cuda()
y = torch.tensor([0., 0., 0., 2., 2., 2., -np.pi/4]).view(1, 1, 7).cuda()

_, iou3d = cal_diou_3d(x, y)
## iou3d = 0 , wrong

x = torch.tensor([0., 0., 0., 2., 2., 2., np.pi/4+1e-6]
                 ).view(1, 1, 7).cuda()
y = torch.tensor([0., 0., 0., 2., 2., 2., -np.pi/4+1e-6]).view(1, 1, 7).cuda()

_, iou3d = cal_diou_3d(x, y)
## iou3d =1, Right
lilanxiao commented 3 years ago

Hi, I cannot reproduce this bug. I got iou3d=1 in both cases.

Did you use the latest version of my code? I fixed some bugs several months ago. Please consider pulling this repo again and re-compiling the CUDA extension. Also, you might need to delete the generated files under cuda_op before the re-compilation.