def calc_area(bboxes: Union[List[List], FloatTensor, ndarray], size: Union[None, Tuple[int, int]] = None) -> List[float]:
    """calculates the fractional area of a rectangle given 4 numbers (2points)
    (x1, y1, x2, y2) and the original size

    Args:
        bboxes (Union[List[List], FloatTensor, ndarray]): List of bounding boxes
        size (Tuple[int, int]): the size of the image (w, h) to calc the area

    Returns:
        List[Float]: a list of areas
    """

    if size is None:
        A = 1.0
    else:
        A = size[0]*size[1]*1.0
    areas = [(bb[2]-bb[0])*(bb[3]-bb[1])/A for bb in bboxes]

    return areas
calculates the fractional area of a rectangle given 4 numbers (2points)
    (x1, y1, x2, y2) and the original size

    Args:
        bboxes (Union[List[List], FloatTensor, ndarray]): List of bounding boxes
        size (Tuple[int, int]): the size of the image (w, h) to calc the area

    Returns:
        List[Float]: a list of areas
    
src/marqo/s2_inference/processing/image_utils.py