def rescale(image, level):
    'Rescales image and enlarged cornet.'
    size = image.shape[:2]
    scale = (level * 0.25)
    scale_height = tf.cast((scale * size[0]), tf.int32)
    scale_width = tf.cast((scale * size[1]), tf.int32)
    cropped_image = tf.image.crop_to_bounding_box(image, offset_height=scale_height, offset_width=scale_width, target_height=(size[0] - scale_height), target_width=(size[1] - scale_width))
    rescaled = tf.image.resize(cropped_image, size, tf.image.ResizeMethod.BICUBIC)
    return tf.saturate_cast(rescaled, tf.uint8)
Rescales image and enlarged cornet.
def rescale(image, level):
    
    size = image.shape[:2]
    scale = (level * 0.25)
    scale_height = tf.cast((scale * size[0]), tf.int32)
    scale_width = tf.cast((scale * size[1]), tf.int32)
    cropped_image = tf.image.crop_to_bounding_box(image, offset_height=scale_height, offset_width=scale_width, target_height=(size[0] - scale_height), target_width=(size[1] - scale_width))
    rescaled = tf.image.resize(cropped_image, size, tf.image.ResizeMethod.BICUBIC)
    return tf.saturate_cast(rescaled, tf.uint8)