(boxes0, boxes1, eps=1e-5)
return overlap_area / (area0 + area1 - overlap_area + eps)
Return intersection-over-union (Jaccard index) of boxes.

    Args:
        boxes0 (N, 4): ground truth boxes.
        boxes1 (N or 1, 4): predicted boxes.
        eps: a small number to avoid 0 as denominator.
    Returns:
        iou (N): IoU values.
Return intersection-over-union (Jaccard index) of boxes.
Return intersection - over - union ( Jaccard index ) of boxes .
def iou_of(boxes0, boxes1, eps=1e-5):
    """Return intersection-over-union (Jaccard index) of boxes.

    Args:
        boxes0 (N, 4): ground truth boxes.
        boxes1 (N or 1, 4): predicted boxes.
        eps: a small number to avoid 0 as denominator.
    Returns:
        iou (N): IoU values.
    """
    overlap_left_top = torch.max(boxes0[..., :2], boxes1[..., :2])
    overlap_right_bottom = torch.min(boxes0[..., 2:], boxes1[..., 2:])

    overlap_area = area_of(overlap_left_top, overlap_right_bottom)
    area0 = area_of(boxes0[..., :2], boxes0[..., 2:])
    area1 = area_of(boxes1[..., :2], boxes1[..., 2:])
    return overlap_area / (area0 + area1 - overlap_area + eps)
def iou_of ( boxes0 , boxes1 , eps = 1e-5 ) : overlap_left_top = torch . max ( boxes0 [ ... , : 2 ] , boxes1 [ ... , : 2 ] ) overlap_right_bottom = torch . min ( boxes0 [ ... , 2 : ] , boxes1 [ ... , 2 : ] ) overlap_area = area_of ( overlap_left_top , overlap_right_bottom ) area0 = area_of ( boxes0 [ ... , : 2 ] , boxes0 [ ... , 2 : ] ) area1 = area_of ( boxes1 [ ... , : 2 ] , boxes1 [ ... , 2 : ] ) return overlap_area / ( area0 + area1 - overlap_area + eps )