def convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity=False):
    """Convert a bounding box from a format specified in `source_format` to the format used by albumentations:
    normalized coordinates of bottom-left and top-right corners of the bounding box in a form of
    `[x_min, y_min, x_max, y_max]` e.g. `[0.15, 0.27, 0.67, 0.5]`.

    Args:
        bbox (list): bounding box
        source_format (str): format of the bounding box. Should be 'coco' or 'pascal_voc'.
        check_validity (bool): check if all boxes are valid boxes
        rows (int): image height
        cols (int): image width

    Note:
        The `coco` format of a bounding box looks like `[x_min, y_min, width, height]`, e.g. [97, 12, 150, 200].
        The `pascal_voc` format of a bounding box looks like `[x_min, y_min, x_max, y_max]`, e.g. [97, 12, 247, 212].

    Raises:
        ValueError: if `target_format` is not equal to `coco` or `pascal_voc`.

    """
    if source_format not in {'coco', 'pascal_voc'}:
        raise ValueError(
            "Unknown source_format {}. Supported formats are: 'coco' and 'pascal_voc'".format(source_format)
        )
    if source_format == 'coco':
        x_min, y_min, width, height = bbox[:4]
        x_max = x_min + width
        y_max = y_min + height
    else:
        x_min, y_min, x_max, y_max = bbox[:4]
    bbox = [x_min, y_min, x_max, y_max] + list(bbox[4:])
    bbox = normalize_bbox(bbox, rows, cols)
    if check_validity:
        check_bbox(bbox)
    return bbox
Convert a bounding box from a format specified in `source_format` to the format used by albumentations:
    normalized coordinates of bottom-left and top-right corners of the bounding box in a form of
    `[x_min, y_min, x_max, y_max]` e.g. `[0.15, 0.27, 0.67, 0.5]`.

    Args:
        bbox (list): bounding box
        source_format (str): format of the bounding box. Should be 'coco' or 'pascal_voc'.
        check_validity (bool): check if all boxes are valid boxes
        rows (int): image height
        cols (int): image width

    Note:
        The `coco` format of a bounding box looks like `[x_min, y_min, width, height]`, e.g. [97, 12, 150, 200].
        The `pascal_voc` format of a bounding box looks like `[x_min, y_min, x_max, y_max]`, e.g. [97, 12, 247, 212].

    Raises:
        ValueError: if `target_format` is not equal to `coco` or `pascal_voc`.