def compute_iou(groundtruth_box, detection_box):
    """
    compute IOU score by compare ground truth bbox and predicted bbox
    Args:
        groundtruth_box: ground truth bbox in [x0, y0, x1, y1]
        detection_box: predicted truth bbox in [y0, x0, y1, x1]
    Returns:
        iou: IOU score between ground truth and detected bboxes
    """
    g_xmin, g_ymin, g_xmax, g_ymax = tuple(groundtruth_box)
    d_ymin, d_xmin, d_ymax, d_xmax = tuple(detection_box)

    x_left = max(g_xmin, d_xmin)
    y_top = max(g_ymin, d_ymin)
    x_right = min(g_xmax, d_xmax)
    y_bottom = min(g_ymax, d_ymax)

    boxGArea = (g_xmax - g_xmin + 1) * (g_ymax - g_ymin + 1)

    if x_right < x_left or y_bottom < y_top:
        return 0, boxGArea

    intersection = (x_right - x_left + 1) * (y_bottom - y_top + 1)

    boxDArea = (d_xmax - d_xmin + 1) * (d_ymax - d_ymin + 1)
    iou = intersection / float(boxGArea + boxDArea - intersection)
    return iou, boxGArea