def xxyy2yolo(size, box):
    """convert XMin XMax YMin YMax coordinates to yolo format
    
    Args
    ----
    size (tuple): (width, height)
    box (tuple): (xmin, xmax, ymin, ymax)

    Returns
    -------
    yolo (tuple): (ratio-bbox-centre-x, ratio-bbox-centre-y, ratio-bbox-w, ratio-bbox-h)
    """
    width = size[0]
    height = size[1]
    xmin, xmax, ymin, ymax = box
    box_width = xmax - xmin
    box_height = ymax - ymin

    center_x = xmin + (box_width / 2.0)
    center_y = ymin + (box_height / 2.0)

    ratio_cx = center_x / width
    ratio_cy = center_y / height
    ratio_bw = box_width / width
    ratio_bh = box_height / height

    return (ratio_cx, ratio_cy, ratio_bw, ratio_bh)