def convert_bbox_from_albumentations(bbox, target_format, rows, cols, check_validity=False):
if target_format not in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(target_format)<EOL>)<EOL><DEDENT>if check_validity:<EOL><INDENT>check_bbox(bbox)<EOL><DEDENT>bbox = denormalize_bbox(bbox, rows, cols)<EOL>if target_format == '<STR_LIT>':<EOL><INDENT>x_min, y_min, x_max, y_max = bbox[:<NUM_LIT:4>]<EOL>width = x_max - x_min<EOL>height = y_max - y_min<EOL>bbox = [x_min, y_min, width, height] + list(bbox[<NUM_LIT:4>:])<EOL><DEDENT>return bbox<EOL>
Convert a bounding box from the format used by albumentations to a format, specified in `target_format`.

    Args:
        bbox (list): bounding box with coordinates in the format used by albumentations
        target_format (str): required format of the output bounding box. Should be 'coco' or 'pascal_voc'.
        rows (int): image height
        cols (int): image width
        check_validity (bool): check if all boxes are valid boxes

    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`.