def set_image(
    self,
    image_path=None,
    image_url=None,
    image_id=None,
    height=None,
    width=None,
    force_overwrite=False
):
    """ Sets an image entry in the dataset

    Required variables:
        image_path/image_url (atleast 1 required)

    Args
        image_path      : The path to the locally stored image relative to root_dir
        image_url       : The http public url to the image
        image_id        : An integer to use for the image id
        bbox            : The bounding box to apply to image (does not apply for detection datasets)
        height          : The image pixel-wise height
        width           : The image pixel-wise width
        force_overwrite : Flag to trigger the overwrite of image at image_id
    Returns
        image info (Dataset object will also be updated with this new image info)
    """
    assert (image_url is not None) or (image_path is not None), 'Atleast one of image path or image url must be provided'

    # Identify image id
    if image_id is None:
        image_id = self.next_image_id
        self.next_image_id += 1
    else:
        assert isinstance(image_id, int), 'Image id if provided must be an integer, got {}'.format(type(image_id))
        assert (image_id not in self.image_infos) or force_overwrite, 'Image id {} already exists, consider overwrite'.format(image_id)
        self.next_image_id = max(self.next_image_id, image_id) + 1

    # Collect image info and gather into dict object
    image_info = {
        'id'           : image_id,
        'image_path'   : image_path,
        'image_url'    : image_url,
        'width'        : width,
        'height'       : height,
        'aspect_ratio' : width / height if (width is not None and height is not None) else None
    }

    # Store all required info
    self.image_infos[image_id] = image_info
    self.all_image_index += [image_id]

    return image_info