BatchRandomGrayScale#

class torchaug.batch_transforms.BatchRandomGrayScale(p=0.5, inplace=False)[source]#

Convert batch of images to grayscale.

The batch of images is expected to be of shape [B, …, C, H, W] where … means an arbitrary number of dimensions.

Parameters:
  • p (float, optional) – Probability of the images to be grayscaled.

    Default: 0.5

  • inplace (bool, optional) – If True, perform inplace operation to save memory and time.

    Default: False

apply_transform(imgs)[source]#

Apply grayscale on the batch of images.

Parameters:

imgs (Tensor) – Batch of images to be grayscaled.

Return type:

Tensor

Returns:

Grayscaled batch of images.