AugMix¶
-
class
torchvision.transforms.
AugMix
(severity: int = 3, mixture_width: int = 3, chain_depth: int = -1, alpha: float = 1.0, all_ops: bool = True, interpolation: torchvision.transforms.functional.InterpolationMode = <InterpolationMode.BILINEAR: 'bilinear'>, fill: Optional[List[float]] = None)[source]¶ AugMix data augmentation method based on “AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty”. If the image 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) – The severity of base augmentation operators. Default is
3
.mixture_width (int) – The number of augmentation chains. Default is
3
.chain_depth (int) – The depth of augmentation chains. A negative value denotes stochastic depth sampled from the interval [1, 3]. Default is
-1
.alpha (float) – The hyperparameter for the probability distributions. Default is
1.0
.all_ops (bool) – Use all operations (including brightness, contrast, color and sharpness). Default is
True
.interpolation (InterpolationMode) – Desired interpolation enum defined by
torchvision.transforms.InterpolationMode
. Default isInterpolationMode.NEAREST
. If input is Tensor, onlyInterpolationMode.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-
forward
(orig_img: torch.Tensor) → torch.Tensor[source]¶ img (PIL Image or Tensor): Image to be transformed.
- Returns
Transformed image.
- Return type
PIL Image or Tensor