evaluate/test_ap.py
def compute_bbox_iou(box, boxes, box_area, boxes_area):
    """Calculates IoU of the given box with the array of the given boxes.
    box: 1D vector [y1, x1, y2, x2]
    boxes: [boxes_count, (y1, x1, y2, x2)]
    box_area: float. the area of 'box'   ground_truth box
    boxes_area: array of length boxes_count.

    Note: the areas are passed in rather than calculated here for
          efficency. Calculate once in the caller to avoid duplicate work.
    """
    # Calculate intersection areas
    y1 = np.maximum(box[0], boxes[:, 0])
    y2 = np.minimum(box[2], boxes[:, 2])
    x1 = np.maximum(box[1], boxes[:, 1])
    x2 = np.minimum(box[3], boxes[:, 3])
    intersection = np.maximum(x2 - x1, 0) * np.maximum(y2 - y1, 0)

    union = box_area + boxes_area[:] - intersection[:]
    iou = intersection / union
    return iou
Calculates IoU of the given box with the array of the given boxes.
    box: 1D vector [y1, x1, y2, x2]
    boxes: [boxes_count, (y1, x1, y2, x2)]
    box_area: float. the area of 'box'   ground_truth box
    boxes_area: array of length boxes_count.

    Note: the areas are passed in rather than calculated here for
          efficency. Calculate once in the caller to avoid duplicate work.
    
Calculates IoU of the given box with the array of the given boxes.

the areas are passed in rather than calculated here for
efficency. Calculate once in the caller to avoid duplicate work.
Calculates IoU of the given box with the array of the given boxes . the areas are passed in rather than calculated here for efficency . Calculate once in the caller to avoid duplicate work .
def compute_bbox_iou(box, boxes, box_area, boxes_area):
    y1 = np.maximum(box[0], boxes[:, 0])
    y2 = np.minimum(box[2], boxes[:, 2])
    x1 = np.maximum(box[1], boxes[:, 1])
    x2 = np.minimum(box[3], boxes[:, 3])
    intersection = np.maximum(x2 - x1, 0) * np.maximum(y2 - y1, 0)
    union = box_area + boxes_area[:] - intersection[:]
    iou = intersection / union
    return iou
def compute_bbox_iou ( box , boxes , box_area , boxes_area ) : y1 = np . maximum ( box [ 0 ] , boxes [ : , 0 ] ) y2 = np . minimum ( box [ 2 ] , boxes [ : , 2 ] ) x1 = np . maximum ( box [ 1 ] , boxes [ : , 1 ] ) x2 = np . minimum ( box [ 3 ] , boxes [ : , 3 ] ) intersection = np . maximum ( x2 - x1 , 0 ) * np . maximum ( y2 - y1 , 0 ) union = box_area + boxes_area [ : ] - intersection [ : ] iou = intersection / union return iou
Calculates IoU of the given box with the array of the given boxes.
Calculates IoU of the given box with the array of the given boxes .
"""Calculates IoU of the given box with the array of the given boxes.
    box: 1D vector [y1, x1, y2, x2]
    boxes: [boxes_count, (y1, x1, y2, x2)]
    box_area: float. the area of 'box'   ground_truth box
    boxes_area: array of length boxes_count.

    Note: the areas are passed in rather than calculated here for
          efficency. Calculate once in the caller to avoid duplicate work.
    """ # Calculate intersection areas
box
boxes
box_area
boxes_area