Warning: This project is deprecated. TensorFlow Addons has stopped development,
The project will only be providing minimal maintenance releases until May 2024. See the full
announcement here or on
github.
tfa.image.cutout
Stay organized with collections
Save and categorize content based on your preferences.
Apply cutout to images.
tfa.image.cutout(
images: tfa.types.TensorLike
,
mask_size: tfa.types.TensorLike
,
offset: tfa.types.TensorLike
= (0, 0),
constant_values: tfa.types.Number
= 0
) -> tf.Tensor
This operation applies a (mask_height x mask_width)
mask of zeros to
a location within images
specified by the offset.
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.
|
offset
|
A tuple of (height, width) or (batch_size, 2)
|
constant_values
|
What pixel value to fill in the images in the area that has
the cutout mask applied to it.
|
Returns |
A Tensor of the same shape and dtype as images .
|
Raises |
InvalidArgumentError
|
if mask_size can't be divisible by 2.
|
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.
Last updated 2023-05-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-05-25 UTC."],[],[]]