def switch_bbox_coordinates_size(line, old_size, new_size):
    """
    This function takes a label in COCO bbox format and fits it to a different image size
    :param line:  an annotation line
    :param old_size: the size of image the bbox is currently set for
    :param new_size: the new size of image the bbox should be converted to
    :return: the upstaed annotation line
    """
    line = line.split(",")
    id_ = line[4]
    x1 = str(round(new_size*float(line[0])/old_size))
    x2 = str(round(new_size*float(line[1])/old_size))
    x3 = str(round(new_size*float(line[2])/old_size))
    x4 = str(round(new_size*float(line[3])/old_size))

    return x1 + "," + x2 + "," + x3 + "," + x4 + "," + id_