RandomGrayscale

class torchaug.transforms.RandomGrayscale(p=0.1, batch_inplace=False, batch_transform=False)[source]

Randomly convert image or videos to grayscale with a probability of p.

The input is expected to have […, 3 or 1, H, W] shape, where … means an arbitrary number of leading dimensions

The output has the same number of channels as the input.

Parameters:
  • p (float, optional) – probability that image should be converted to grayscale. Default: 0.1

  • batch_inplace (bool, optional) – whether to apply the batch transform in-place. Does not prevent functionals to make copy but can reduce time and memory consumption. Default: False

  • batch_transform (bool, optional) – whether to apply the transform in batch mode. Default: False

extra_repr()[source]

Set the extra representation of the transform.

Return type:

str