Skip to content

Instantly share code, notes, and snippets.

@YimianDai
Last active September 6, 2019 02:03
Show Gist options
  • Save YimianDai/4d5672ca1e1f664ab16e2b3e18383096 to your computer and use it in GitHub Desktop.
Save YimianDai/4d5672ca1e1f664ab16e2b3e18383096 to your computer and use it in GitHub Desktop.
Non-maximum suppression

典型的用法

            result = F.contrib.box_nms(
                result, overlap_thresh=self.nms_thresh, topk=self.nms_topk,
                valid_thresh=self.score_thresh,
                id_index=0, score_index=1, coord_start=2, force_suppress=False)

result 是 (B, H_1 x W_1 x num_anchors x num_classes + ... + H_6 x W_6 x num_anchors x num_classes, 6) 的矩阵

在 box_nms 函数中,

	r"""
    topk : int, optional, default='-1'
        Apply nms to topk boxes with descending scores, -1 to no restriction.
    """

topk 是指对依照 score 降序排列预测的 bbox 前多少个参与 nms,默认是 topk = 400

overlap_thresh 是指如果跟 score 更高的 bbox 的 iou 超过 overlap_thresh 就会被忽略

valid_thresh 是 score 的 thresh

post_nms 是最后输出

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