AugMix

class torchaug.transforms.AugMix(severity=3, mixture_width=3, chain_depth=-1, alpha=1.0, all_ops=True, interpolation=InterpolationMode.BILINEAR, fill=None)[source]

AugMix data augmentation method based on “AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty”.

This transformation works on images and videos only.

If the input is torch.Tensor, it should be of type torch.uint8, and it is expected to have […, 1 or 3, H, W] shape, where … means an arbitrary number of leading dimensions. If img is PIL Image, it is expected to be in mode “L” or “RGB”.

Parameters:
  • severity (int, optional) – The severity of base augmentation operators. Default: 3

  • mixture_width (int, optional) – The number of augmentation chains. Default: 3

  • chain_depth (int, optional) – The depth of augmentation chains. A negative value denotes stochastic depth sampled from the interval [1, 3]. Default: -1

  • alpha (float, optional) – The hyperparameter for the probability distributions. Default: 1.0

  • all_ops (bool, optional) – Use all operations (including brightness, contrast, color and sharpness). Default: True

  • interpolation (Union[InterpolationMode, int], optional) – Desired interpolation enum defined by torchvision.transforms.InterpolationMode. Only InterpolationMode.NEAREST, InterpolationMode.BILINEAR are supported. Default: InterpolationMode.BILINEAR

  • fill (Union[int, float, Sequence[int], Sequence[float], None, Dict[Union[Type, str], Union[int, float, Sequence[int], Sequence[float], None]]], optional) – Pixel fill value for the area outside the transformed image. If given a number, the value is used for all bands respectively. Default: None

forward(*inputs)[source]

Performs forward pass of the transform.

Parameters:

inputs (Any) – Inputs to the transform.

Return type:

Any

Returns:

Transformed inputs.