def rbox_overlaps(anchors, gt_bboxes, use_cv2=False):
    """

    Args:
        anchors: [NA, 5]  x1,y1,x2,y2,angle
        gt_bboxes: [M, 5]  x1,y1,x2,y2,angle

    Returns:
        iou: [NA, M]
    """
    assert anchors.shape[1] == 5
    assert gt_bboxes.shape[1] == 5

    gt_bboxes_ploy = [rbox2poly_single(e) for e in gt_bboxes]
    anchors_ploy = [rbox2poly_single(e) for e in anchors]

    num_gt, num_anchors = len(gt_bboxes_ploy), len(anchors_ploy)
    iou = np.zeros((num_anchors, num_gt), dtype=np.float64)

    start_time = time.time()
    for i in range(num_anchors):
        for j in range(num_gt):
            try:
                iou[i, j] = intersection(anchors_ploy[i], gt_bboxes_ploy[j])
            except Exception as e:
                print('cur anchors_ploy[i]', anchors_ploy[i],
                      'gt_bboxes_ploy[j]', gt_bboxes_ploy[j], e)
    return iou


    Args:
        anchors: [NA, 5]  x1,y1,x2,y2,angle
        gt_bboxes: [M, 5]  x1,y1,x2,y2,angle

    Returns:
        iou: [NA, M]
    
ppdet/ext_op/unittest/test_rbox_iou.py