def IoU(boxA: dict, boxB: dict) -> float:
    """ Calculate IoU

    Args:
        boxA: Bounding box A
        boxB: Bounding box B
    """
    # determine the (x, y)-coordinates of the intersection rectangle
    xA = max(boxA['x1'], boxB['x1'])
    yA = max(boxA['y1'], boxB['y1'])
    xB = min(boxA['x2'], boxB['x2'])
    yB = min(boxA['y2'], boxB['y2'])
    surf_boxA = (boxA['x2'] - boxA['x1']) * (boxA['y2'] - boxA['y1'])
    surf_boxB = (boxB['x2'] - boxB['x1']) * (boxB['y2'] - boxB['y1'])

    # compute the area of intersection rectangle
    interArea = max(0, xB - xA + 1) * max(0, yB - yA + 1)

    # compute the intersection over union by taking the intersection
    # area and dividing it by the sum of prediction + ground-truth
    # areas - the interesection area
    iou = interArea / float(surf_boxA + surf_boxB - interArea)

    # return the intersection over union value
    return iou