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

Fixed nan loss by filtering out-of-frame gt_bboxes in coco.py #2999

Merged
merged 5 commits into from Jun 15, 2020
Merged

Fixed nan loss by filtering out-of-frame gt_bboxes in coco.py #2999

merged 5 commits into from Jun 15, 2020

Conversation

Jokoe66
Copy link
Contributor

@Jokoe66 Jokoe66 commented Jun 13, 2020

There may exist out-of-frame annotations in custom datasets. These abnormal annotations will cause nan loss. For example, such cases exist in the object365 datasets, and I found both Libra RCNN and Cascade RCNN diverged due to nan loss. After filtering these abnormal cases, these detectors converged. Even though this should be avoided by dataset annotators, it can be more robust of mmdetection to filter out-of-frame annotations.

@CLAassistant
Copy link

CLAassistant commented Jun 13, 2020

CLA assistant check
All committers have signed the CLA.

or y1 >= img_info['height'])
and (x2 < 0 or x2 >= img_info['width'] or y2 < 0
or y2 >= img_info['height'])):
continue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some questions about the condition statement,

  1. The conditions seem are redundant. For example if x1 >= img_info['width'] then x2 must >= img_info['width'], so we only need to check x2 >= img_info['width'].
  2. Why you use and between the first condition and the second condition, in my opinion, if one of two conditions satisfy then the image is out-of-frame.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yeah, the conditions are redundant. But it is more readable. The first condition checks if the left-top point is out of image, and the second one checks the bottom-right point.
  2. I mean to filter boxes that are fully outside the image (frame), but preserve those partially outside the image. In another word, when the boxes do not intersect with the image, then they are filtered.

I think I should check the intersection instead. Current conditions are True (both corner points are out of frame) when the image is inside a box, and the box is filtered. But the box should be preserved since it intersects with the image.

@hellock hellock merged commit 1ae61f9 into open-mmlab:master Jun 15, 2020
mike112223 pushed a commit to mike112223/mmdetection that referenced this pull request Aug 25, 2020
…mlab#2999)

* Fixed nan loss by filtering out-of-frame gt_bboxes

* Discarded lambda expression of is_out_of_frame

* Cleaned trailing whitespace

* Reformatted code

* Checked the intersection between boxes and image
liuhuiCNN pushed a commit to liuhuiCNN/mmdetection that referenced this pull request May 21, 2021
@OpenMMLab-Assistant-004

Hi @Jokoe66 !First of all, we want to express our gratitude for your significant PR in the mmdetection project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR.

We would also like to invite you to join our Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/raweFPmdzG

If you are Chinese or have WeChat,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:)
Thank you again for your contribution❤

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 this pull request may close these issues.

None yet

5 participants