Apply cutout to images with random offset.
tfa.image.random_cutout(
images: tfa.types.TensorLike
,
mask_size: tfa.types.TensorLike
,
constant_values: tfa.types.Number
= 0,
seed: tfa.types.Number
= None
) -> tf.Tensor
This operation applies a (mask_height x mask_width)
mask of zeros to
a random location within images
. The pixel values filled in will be of
the value constant_values
. The location where the mask will be applied is
randomly chosen uniformly over the whole images.
Args |
images
|
A tensor of shape (batch_size, height, width, channels) (NHWC).
|
mask_size
|
Specifies how big the zero mask that will be generated is that
is applied to the images. The mask will be of size
(mask_height x mask_width) . Note: mask_size should be divisible by 2.
|
constant_values
|
What pixel value to fill in the images in the area that has
the cutout mask applied to it.
|
seed
|
A Python integer. Used in combination with tf.random.set_seed to
create a reproducible sequence of tensors across multiple calls.
|
Returns |
A Tensor of the same shape and dtype as images .
|
Raises |
InvalidArgumentError
|
if mask_size can't be divisible by 2.
|