(bboxes)
return square_bboxes
Convert bounding boxes to a square form.

    Arguments:
        bboxes: a float numpy array of shape [n, 5].

    Returns:
        a float numpy array of shape [n, 5],
            squared bounding boxes.
Convert bounding boxes to a square form.
Convert bounding boxes to a square form .
def convert_to_square(bboxes):
    """Convert bounding boxes to a square form.

    Arguments:
        bboxes: a float numpy array of shape [n, 5].

    Returns:
        a float numpy array of shape [n, 5],
            squared bounding boxes.
    """

    square_bboxes = np.zeros_like(bboxes)
    x1, y1, x2, y2 = [bboxes[:, i] for i in range(4)]
    h = y2 - y1 + 1.0
    w = x2 - x1 + 1.0
    max_side = np.maximum(h, w)
    square_bboxes[:, 0] = x1 + w*0.5 - max_side*0.5
    square_bboxes[:, 1] = y1 + h*0.5 - max_side*0.5
    square_bboxes[:, 2] = square_bboxes[:, 0] + max_side - 1.0
    square_bboxes[:, 3] = square_bboxes[:, 1] + max_side - 1.0
    return square_bboxes
def convert_to_square ( bboxes ) : square_bboxes = np . zeros_like ( bboxes ) x1 , y1 , x2 , y2 = [ bboxes [ : , i ] for i in range ( 4 ) ] h = y2 - y1 + 1.0 w = x2 - x1 + 1.0 max_side = np . maximum ( h , w ) square_bboxes [ : , 0 ] = x1 + w * 0.5 - max_side * 0.5 square_bboxes [ : , 1 ] = y1 + h * 0.5 - max_side * 0.5 square_bboxes [ : , 2 ] = square_bboxes [ : , 0 ] + max_side - 1.0 square_bboxes [ : , 3 ] = square_bboxes [ : , 1 ] + max_side - 1.0 return square_bboxes