img_cutout: Cutout

Description Usage Arguments Details Value Raises

View source: R/image_ops.R

Description

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

Usage

1
2
3
4
5
6
7
img_cutout(
  images,
  mask_size,
  offset = list(0, 0),
  constant_values = 0,
  data_format = "channels_last"
)

Arguments

images

A tensor of shape (batch_size, height, width, channels) (NHWC), (batch_size, channels, height, width)(NCHW).

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 list 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.

data_format

A string, one of 'channels_last' (default) or 'channels_first'. The ordering of the dimensions in the inputs. 'channels_last' corresponds to inputs with shape '(batch_size, ..., channels)' while 'channels_first' corresponds to inputs with shape '(batch_size, channels, ...)'.

Details

This operation applies a (mask_height x mask_width) mask of zeros to a location within 'img' specified by the offset. The pixel values filled in will be of the value 'replace'. The located where the mask will be applied is randomly chosen uniformly over the whole images.

Value

An image Tensor.

Raises

InvalidArgumentError: if mask_size can't be divisible by 2.


tfaddons documentation built on July 2, 2020, 2:12 a.m.