Skip to content

ops.nms get wrong results when set iou_threshold=0 #8949

Open
@ccblublu

Description

@ccblublu

🐛 Describe the bug

boxes = torch.tensor([[       2748,         618,        2830,         659],
       [       2690,         642,        2749,         681],
       [       2690,         639,        2746,         681]])

score = torch.tensor([1,1,0.5])

iou =  torchvision.ops.box_iou(boxes, boxes)

index1 =  torchvision.ops.nms(boxes, socre, iou_threshold=0)

index2 = torchvision.ops.nms(boxes, socre, iou_threshold=0.1)

(index1==index2).all()

when set iou_threshold=0, then index return is wrong:
i set boxes
([[ 2748, 618, 2830, 659],
[ 2690, 642, 2749, 681],
[ 2690, 639, 2746, 681]])
from ops.box_iou:
([[1.0000, 0.0030, 0.0000],
[0.0030, 1.0000, 0.8846],
[0.0000, 0.8846, 1.0000]] is normal
but when run nms with score [1,1,0.5]
get result:
tensor([0, 2])
while set iou_threshold=0.1,it return:
tensor([0, 1]) is correct

Versions

torch==2.4.1
torchvision==0.19.1
CUDA==12.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions