`GeneralizedRCNN` raises an exception when encountering a bad bounding box during `forward`

Open
#6,787 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start by reading torchvision/models/detection/generalized_rcnn.py around line 95, where degenerate bounding boxes are checked during forward. Review the existing comments and issue discussion to determine whether handling should raise a catchable exception, filter boxes, or retain the current assertion. Done means an agreed behavior is implemented and covered for bad boxes during training.

Written by the indexing model from the issue text.

Description

https://github.com/pytorch/vision/blob/0610b13ac4af3717f538454a9c6b1f441cb386f3/torchvision/models/detection/generalized_rcnn.py#L95

The current implementation of GeneralizedRCNN checks for degenerate bounding boxes during its forward pass. While -- in principle -- that is great, it can make training brittle, especially when randomized data augmentation is involved, because an exception is raised (via assert by torch). I see that the current implementation is experimental (it says # TODO: Move this to a function a couple of lines up) but I am wondering what could be more helpful ways of dealing with those bad bounding boxes:

  1. Raise an explicit exception that can be handled during training to, for example, skip the current batch?
  2. Filter out degenerate bounding boxes?
  3. Keep the current implementation because torch's _assert is great and I just don't understand it properly? 🙄
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pytorch/vision

All issues in pytorch/vision

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.