NMS discards box when IoU == iou_threshold
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
🐛 Describe the bug
According to the doc of NMS [1], it discards all overlapping boxes with IoU > iou_threshold, so the box with IoU == iou_threshold should be kept. However, according to the following code snippet, it's not the case.
input_boxes = torch.tensor([[1., 1., 2., 3.], [0., 0., 2. , 2.]])
input_scores = torch.tensor([3., 2.])
# Two boxes should both be kept, but only one get kept.
torchvision.ops.nms(input_boxes, input_scores, iou_threshold=0.2)
# Verify the IoU is same as iou_threshold.
torchvision.ops.box_iou(torch.tensor([[1., 1., 2., 3.]]), torch.tensor([[0., 0., 2., 2.]]))
[1] https://pytorch.org/vision/main/generated/torchvision.ops.nms.html
Versions
Versions of relevant libraries:
[pip3] numpy==1.21.0
[pip3] torch==1.13.1
[pip3] torchvision==0.14.1
[conda] numpy 1.21.0 pypi_0 pypi
[conda] torch 1.13.1 pypi_0 pypi
[conda] torchvision 0.14.1 pypi_0 pypi
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example with torchvision.ops.nms and torchvision.ops.box_iou using the versions listed in the issue. Trace the NMS behavior for an IoU exactly equal to iou_threshold and compare it with the documented strict-greater-than rule. Done means the boundary case keeps both boxes, with verification covering this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100