AutoAugment
- class torchvision.transforms.v2.AutoAugment(policy: AutoAugmentPolicy = AutoAugmentPolicy.IMAGENET, interpolation: Union[str, InterpolationMode,
AutoAugment data augmentation method based on “AutoAugment: Learning Augmentation Strategies from Data”.
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”.
policy (AutoAugmentPolicy, optional) – Desired policy enum defined by
torchvision.transforms.autoaugment.AutoAugmentPolicy. Default is AutoAugmentPolicy.IMAGENET.
interpolation (str or InterpolationMode, optional) – Desired interpolation enum defined by
torchvision.transforms.v2.InterpolationMode.
Accepted string values are "nearest", "nearest-exact", "bilinear", "bicubic",
"box", "hamming", and .
, , and are only supported for PIL images.
The corresponding enum values and Pillow integer
constants, e.g. are accepted as well.
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 AutoAugment:
Get parameters for autoaugment transformation
"box""hamming""lanczos"InterpolationModePIL.Image.BILINEARparams required by the autoaugment transformation