nvidia.dali.experimental.dynamic.grid_mask#

nvidia.dali.experimental.dynamic.grid_mask(input, /, *, batch_size=None, device=None, angle=None, ratio=None, shift_x=None, shift_y=None, tile=None)#

Performs the gridmask augmentation (https://arxiv.org/abs/2001.04086).

Zeroes out pixels of an image in a grid-like fashion. The grid consists of squares repeating in x and y directions, with the same spacing in both directions. Can be rotated around the origin.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:

input (Tensor/Batch) – Input to the operator.

Keyword Arguments:
  • angle (float or Tensor/Batch of float, optional, default = 0.0) – Angle, in radians, by which the grid is rotated.

  • ratio (float or Tensor/Batch of float, optional, default = 0.5) – The ratio between black square width and tile width.

  • shift_x (float or Tensor/Batch of float, optional, default = 0.0) – The x component of the translation vector, applied after rotation.

  • shift_y (float or Tensor/Batch of float, optional, default = 0.0) – The y component of the translation vector, applied after rotation.

  • tile (int or Tensor/Batch of int, optional, default = 100) – The length of a single tile, which is equal to width of black squares plus the spacing between them.