BatchRandomHorizontalFlip#

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

Horizontally flip the given batch of images randomly with a given probability.

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 being flipped.

    Default: 0.5

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

    Default: False

apply_transform(imgs)[source]#

Flip the batch of images.

Parameters:

imgs (Tensor) – Batch of images to be horizontally fliped.

Return type:

Tensor

Returns:

Horizontally fliped batch of images.