View source on GitHub |
Randomly crop the images to target height and width.
tf.keras.layers.RandomCrop(
height, width, seed=None, **kwargs
)
This layer will crop all the images in the same batch to the same cropping
location.
By default, random cropping is only applied during training. At inference
time, the images will be first rescaled to preserve the shorter side, and
center cropped. If you need to apply random cropping at inference time,
set training
to True when calling the layer.
Input shape:
3D (unbatched) or 4D (batched) tensor with shape:
(..., height, width, channels)
, in "channels_last"
format.
Output shape:
3D (unbatched) or 4D (batched) tensor with shape:
(..., target_height, target_width, channels)
.
Args | |
---|---|
height
|
Integer, the height of the output shape. |
width
|
Integer, the width of the output shape. |
seed
|
Integer. Used to create a random seed. |