Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

The output of 'rbbox_overlaps' is abnormal when bbox is too small #26

Closed
liuyanyi opened this issue Feb 22, 2022 · 2 comments · Fixed by #61
Closed

The output of 'rbbox_overlaps' is abnormal when bbox is too small #26

liuyanyi opened this issue Feb 22, 2022 · 2 comments · Fixed by #61
Labels
bug Something isn't working

Comments

@liuyanyi
Copy link
Collaborator

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version.

Describe the bug

I use mmrotate.core.bbox.rbbox_overlaps in my own model. In the early stages of training, the network output is not stable, so many very small detection boxes are generated. When calcuate iou between small predict bboxes and gt bboxes, the output of 'rbbox_overlap' is abnormal.

Reproduction

I write a piece of code to reproduce the problem

import torch

from mmrotate.core.bbox import rbbox_overlaps

predict = [[903.34, 1034.4, 1.81e-7, 1e-7, -0.312]]
gt = [[2.1525e+02, 7.5750e+01, 3.3204e+01, 1.2649e+01, 3.2175e-01],
      [3.0013e+02, 7.7144e+02, 4.9222e+02, 3.1368e+02, -1.3978e+00],
      [8.4887e+02, 6.9989e+02, 4.6854e+02, 3.0743e+02, -1.4008e+00],
      [8.5250e+02, 7.0250e+02, 7.6181e+02, 3.8200e+02, -1.3984e+00]]

predict_tensor = torch.tensor(predict, device='cuda')
gt_tensor = torch.tensor(gt, device='cuda')

iou = rbbox_overlaps(predict_tensor, gt_tensor)
print(iou)

the output of the code is:

tensor([[  371957.7500,  9881571.0000,           inf, -9312366.0000]],
       device='cuda:0')

Environment

  1. Please run python mmrotate/utils/collect_env.py to collect necessary environment information and paste it here.
  2. You may add addition that may be helpful for locating the problem, such as
    • How you installed PyTorch [e.g., pip, conda, source]
    • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback
If applicable, paste the error trackback here.

A placeholder for trackback.

Bug fix
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

@yangxue0827 yangxue0827 added the bug Something isn't working label Feb 22, 2022
@yangxue0827
Copy link
Collaborator

Thank you for your feedback, we will fix it as soon as possible.

@zytx121
Copy link
Collaborator

zytx121 commented Feb 23, 2022

Hi @liuyanyi, thank you very much!
We believe that this is caused by the box_iou_rotated operator in mmcv. When the predicted box is too small, IoU cannot be calculated correctly. We consider fixing this bug by adding restrictions on the size of the prediction box and the value range of IOU in rbbox_overlaps.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants