def compute_iou(boxA, boxB):
    """Computes the Intersection over Union (IoU) for two bounding boxes.

    Args:
        boxA, boxB (`numpy.ndarray`): Bounding boxes [xmin, ymin, width, height]
            as arrays with shape (4,) and dtype float.

    Returns:
        IoU (`float`): The IoU of the two boxes. It is within the range [0, 1],
        0 meaning no overlap and 1 meaning full overlap of the two boxes.
    """
    xA = max(boxA[0], boxB[0])
    yA = max(boxA[1], boxB[1])
    xB = min(boxA[0] + boxA[2], boxB[0] + boxB[2])
    yB = min(boxA[1] + boxA[3], boxB[1] + boxB[3])
    interArea = abs(max((xB - xA, 0)) * max((yB - yA), 0))
    if interArea == 0:
        return 0
    boxAArea = abs(boxA[2] * boxA[3])
    boxBArea = abs(boxB[2] * boxB[3])
    iou = interArea / float(boxAArea + boxBArea - interArea)
    return iou