Resize image with size and max_size.
tfm.vision.preprocess_ops.resize_image(
image: tf.Tensor,
size: Union[Tuple[int, int], int],
max_size: Optional[int] = None,
method: tf.image.ResizeMethod = tf.image.ResizeMethod.BILINEAR
)
Args |
image
|
the image to be resized.
|
size
|
if list to tuple, resize to it. If scalar, we keep the same
aspect ratio and resize the short side to the value.
|
max_size
|
only used when size is a scalar. When the larger side is larger
than max_size after resized with size we used max_size to keep the aspect
ratio instead.
|
method
|
the method argument passed to tf.image.resize.
|
Returns |
the resized image and image_info to be used for downstream processing.
|
image_info
|
a 2D Tensor that encodes the information of the image and the
applied preprocessing. It is in the format of
[[original_height, original_width], [resized_height, resized_width],
[y_scale, x_scale], [0, 0]], where [resized_height, resized_width]
is the actual scaled image size, and [y_scale, x_scale] is the
scaling factor, which is the ratio of
scaled dimension / original dimension.
|