Shortcuts

AugMix

class torchvision.transforms.v2.AugMix(severity: int = 3, mixture_width: int = 3, chain_depth: int = - 1, alpha: float = 1.0, all_ops: bool = True, interpolation: Union[InterpolationMode, int] = InterpolationMode.BILINEAR, fill: Union[int, float, Sequence[int], Sequence[float], None, Dict[Union[Type, str], Optional[Union[int, float, Sequence[int], Sequence[float]]]]] = 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 is 3.

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

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

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

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

  • interpolation (InterpolationMode, optional) – Desired interpolation enum defined by torchvision.transforms.InterpolationMode. Default is InterpolationMode.NEAREST. If input is Tensor, only InterpolationMode.NEAREST, InterpolationMode.BILINEAR are supported.

  • fill (sequence or number, optional) – Pixel fill value for the area outside the transformed image. If given a number, the value is used for all bands respectively.

Examples using AugMix:

Illustration of transforms

Illustration of transforms
forward(*inputs: Any) Any[source]

Do not override this! Use transform() instead.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources