BatchRandomApply#

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

Apply randomly a list of transformations to a batch of images with a given probability.

Parameters:
  • transforms (list[Module] | Module) – List of transformations.

  • p (float, optional) – Probability to apply the transform.

    Default: 0.5

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

    Default: False

apply_transform(imgs)[source]#

Apply the transforms on the images.

Parameters:

imgs (Tensor) – Batch of images to transform.

Return type:

Tensor

Returns:

Transformed batch of images.