View source on GitHub |
Randomly crop an arbitrary shaped slice from the input image.
tfm.vision.preprocess_ops.random_crop_image_v2(
image_bytes,
image_shape,
aspect_ratio_range=(3.0 / 4.0, 4.0 / 3.0),
area_range=(0.08, 1.0),
max_attempts=10,
seed=1
)
This is a faster version of random_crop_image
which takes the original
image bytes and image size as the inputs, and partially decode the JPEG
bytes according to the generated crop.
Returns | |
---|---|
cropped_image
|
a Tensor representing the random cropped image. Can be the original image if max_attempts is exhausted. |