DIoU-pytorch-detectron icon indicating copy to clipboard operation
DIoU-pytorch-detectron copied to clipboard

Got Nan

Open Sebastian-X opened this issue 5 years ago • 2 comments

Hello, thanks for your code. Refering to your code, I reimplemented CIoU loss in my faster-rcnn framework, but got Nan gradients in the first iteration of training. Tracking the Nan values, I found this problem will occur when the RPN module predicts inappropriate rois, e.g. [200, 599, 300, 599] which has the same y1, y2 values. In this case, the gradients of corresponding prediction boxes will be Nan. Have you ever encountered this kind of problem before?

Sebastian-X avatar Oct 07 '20 09:10 Sebastian-X

I understand that you use a mask to avoid computing IoUs for these inappropriate rois while computing CIoU, but it couldn't prevent the Pytorch autograde function from backpropagating through these rois.

Sebastian-X avatar Oct 07 '20 09:10 Sebastian-X

In fact, it seems that this problem will occur when the IoU of certain bounding box is 0.

Sebastian-X avatar Oct 07 '20 12:10 Sebastian-X