tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.27k stars 630 forks source link

A question about FCOS inference postprocess? #249

Closed xiaohu2015 closed 4 years ago

xiaohu2015 commented 4 years ago
        candidate_inds = box_cls > self.pre_nms_thresh
        pre_nms_top_n = candidate_inds.view(N, -1).sum(1)
        pre_nms_top_n = pre_nms_top_n.clamp(max=self.pre_nms_top_n)

        # multiply the classification scores with centerness scores
        box_cls = box_cls * centerness[:, :, None]

        results = []
        for i in range(N):
            per_box_cls = box_cls[i]
            per_candidate_inds = candidate_inds[i]
            per_box_cls = per_box_cls[per_candidate_inds]

            per_candidate_nonzeros = per_candidate_inds.nonzero()
            per_box_loc = per_candidate_nonzeros[:, 0]
            per_class = per_candidate_nonzeros[:, 1] + 1

            per_box_regression = box_regression[i]
            per_box_regression = per_box_regression[per_box_loc]
            per_locations = locations[per_box_loc]

Line1: why not candidate_inds = box_cls.max(dim=2)[0] > self.pre_nms_thresh, meaning get the class of max probablity.

tianzhi0549 commented 4 years ago

@xiaohu2015 we do not use max here because we hope a single location can make multiple guesses.

xiaohu2015 commented 4 years ago

@tianzhi0549 you use this trick because fcos has no dense anchors, so this trick maybe helpful to improve recall. But I have found that the code of mmdetection simply use the max,I want to know this trick can affect model performance very much?

tianzhi0549 commented 4 years ago

@xiaohu2015 it's NOT something specific to FCOS. RetinaNet in maskrcnn_benchmark uses the same trick as well. Thus, it should not be related to the elimination of anchor boxes.

xiaohu2015 commented 4 years ago

@tianzhi0549 OK, thanks