pytorch-retinanet icon indicating copy to clipboard operation
pytorch-retinanet copied to clipboard

question about nms

Open feixiangdekaka opened this issue 5 years ago • 3 comments

the nms doesn't according score ,why not according each class and score .

feixiangdekaka avatar May 10 '19 04:05 feixiangdekaka

agreed.

Owen-Fish avatar Jun 06 '20 09:06 Owen-Fish

Yes, I found each anchor Box just fetch the heightest score.Thant means when useing torchvision.ops.nms(boxes, scores, iou_threshold), the scores does not indicate the the same class. https://github.com/yhenon/pytorch-retinanet/blob/master/retinanet/model.py

` scores = torch.max(classification, dim=2, keepdim=True)[0]

        scores_over_thresh = (scores > 0.05)[0, :, 0]

        if scores_over_thresh.sum() == 0:
            # no boxes to NMS, just return
            return [torch.zeros(0), torch.zeros(0), torch.zeros(0, 4)]

        classification = classification[:, scores_over_thresh, :]
        transformed_anchors = transformed_anchors[:, scores_over_thresh, :]
        scores = scores[:, scores_over_thresh, :]

        anchors_nms_idx = nms(transformed_anchors[0,:,:], scores[0,:,0], 0.5)

`

should it be link that?

for i in range(class_num): nms(boxes, scores[i], iou_threshold)

Could you give us some advise? Thank you

xu1718191411 avatar Jun 21 '20 14:06 xu1718191411

MayBe the new commit has solved this issue. https://github.com/yhenon/pytorch-retinanet/commit/af6e78e6e27ceed1611888ae20c5fabc5ed5ae0f

xu1718191411 avatar Jun 25 '20 20:06 xu1718191411