nvidia.dali.fn.grid_mask

nvidia.dali.fn.grid_mask(*inputs, **kwargs)

Performs the gridmask augumentation (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 (TensorList) – Input to the operator.

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

  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    Output size hint, in bytes per sample.

    If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.

  • preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.

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

  • seed (int, optional, default = -1) –

    Random seed.

    If not provided, it will be populated based on the global seed of the pipeline.

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

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

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