Example #1
0
def rotate_nms_cc(dets, thresh):
    scores = dets[:, 5]
    order = scores.argsort()[::-1].astype(np.int32)  # highest->lowest
    dets_corners = box_np_ops.center_to_corner_box2d(
        dets[:, :2], dets[:, 2:4], dets[:, 4]
    )

    dets_standup = box_np_ops.corner_to_standup_nd(dets_corners)

    standup_iou = box_np_ops.iou_jit(dets_standup, dets_standup, eps=0.0)
    # print(dets_corners.shape, order.shape, standup_iou.shape)
    return rotate_non_max_suppression_cpu(dets_corners, order, standup_iou, thresh)
Example #2
0
    def _compare(self, boxes1, boxes2):
        """Compute matrix of (negated) sq distances.

    Args:
      boxlist1: BoxList holding N boxes.
      boxlist2: BoxList holding M boxes.

    Returns:
      A tensor with shape [N, M] representing negated pairwise squared distance.
    """
        boxes1_bv = box_np_ops.rbbox2d_to_near_bbox(boxes1)
        boxes2_bv = box_np_ops.rbbox2d_to_near_bbox(boxes2)
        ret = box_np_ops.iou_jit(boxes1_bv, boxes2_bv, eps=0.0)
        return ret
Example #3
0
def rotate_weighted_nms_cc(box,
                           dets,
                           thresh,
                           iou_preds,
                           labels,
                           dirs,
                           anchors=None,
                           nms_cnt_thresh=2.6,
                            nms_sigma_dist_interval=(0, 20, 40, 60),
                            nms_sigma_square=(0.0009, 0.009, 0.1, 1),
                            suppressed_thresh=0.3,
                           ):

    scores = dets[:, 5]
    dets_corners = box_np_ops.center_to_corner_box2d(
        dets[:, :2], dets[:, 2:4], dets[:, 4]
    )

    dets_standup = box_np_ops.corner_to_standup_nd(dets_corners)

    standup_iou = box_np_ops.iou_jit(dets_standup, dets_standup, eps=0.0)

    if anchors is None:
        centerness_c = 0
        anchors = np.zeros((1,1))
    else:
        centerness_c = 1
    result = IOU_weighted_rotate_non_max_suppression_cpu(box,
                                                         dets_corners,
                                                         standup_iou,
                                                         thresh,
                                                         scores,
                                                         iou_preds,
                                                         labels,
                                                         dirs,
                                                         anchors,
                                                         nms_cnt_thresh,
                                                         nms_sigma_dist_interval,
                                                         nms_sigma_square,
                                                         suppressed_thresh,
                                                         centerness_c)
    return result
Example #4
0
def rotate_weighted_nms_cc(
    box,
    dets,
    thresh,
    iou_preds,
    labels,
    dirs,
    anchors=None,
):
    scores = dets[:, 5]
    order = scores.argsort()[::-1].astype(np.int32)  # highest->lowest
    dets_corners = box_np_ops.center_to_corner_box2d(dets[:, :2], dets[:, 2:4],
                                                     dets[:, 4])
    dets_standup = box_np_ops.corner_to_standup_nd(dets_corners)
    standup_iou = box_np_ops.iou_jit(dets_standup, dets_standup, eps=0.0)

    result = IOU_weighted_rotate_non_max_suppression_cpu(
        box, dets_corners, standup_iou, thresh, scores, iou_preds, labels,
        dirs, anchors)

    return result