tfm.vision.augment.cutout

View source on GitHub

Apply cutout (https://arxiv.org/abs/1708.04552) to image.

tfm.vision.augment.cutout(
 image: tf.Tensor, pad_size: int, replace: int = 0
) -> tf.Tensor

This operation applies a (2pad_size x 2pad_size) mask of zeros to a random location within image. The pixel values filled in will be of the value replace. The location where the mask will be applied is randomly chosen uniformly over the whole image.

Args

image An image Tensor of type uint8.
pad_size Specifies how big the zero mask that will be generated is that is applied to the image. The mask will be of size (2pad_size x 2pad_size).
replace What pixel value to fill in the image in the area that has the cutout mask applied to it.

Returns

An image Tensor that is of type uint8.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024年02月02日 UTC.