mindspore.dataset.vision.AutoAugment

class mindspore.dataset.vision.AutoAugment(policy=AutoAugmentPolicy.IMAGENET, interpolation=Inter.NEAREST, fill_value=0)[source]

Apply AutoAugment data augmentation method based on AutoAugment: Learning Augmentation Strategies from Data . This operation works only with 3-channel RGB images.

Parameters
  • policy (AutoAugmentPolicy, optional) –

    AutoAugment policies learned on different datasets. Default: AutoAugmentPolicy.IMAGENET. It can be any of [AutoAugmentPolicy.IMAGENET, AutoAugmentPolicy.CIFAR10, AutoAugmentPolicy.SVHN]. Randomly apply 2 operations from a candidate set. See auto augmentation details in AutoAugmentPolicy.

    • AutoAugmentPolicy.IMAGENET, means to apply AutoAugment learned on ImageNet dataset.

    • AutoAugmentPolicy.CIFAR10, means to apply AutoAugment learned on Cifar10 dataset.

    • AutoAugmentPolicy.SVHN, means to apply AutoAugment learned on SVHN dataset.

  • interpolation (Inter, optional) –

    Image interpolation mode for Resize operation. Default: Inter.NEAREST. It can be any of [Inter.NEAREST, Inter.BILINEAR, Inter.BICUBIC, Inter.AREA].

    • Inter.NEAREST: means interpolation method is nearest-neighbor interpolation.

    • Inter.BILINEAR: means interpolation method is bilinear interpolation.

    • Inter.BICUBIC: means the interpolation method is bicubic interpolation.

    • Inter.AREA: means the interpolation method is pixel area interpolation.

  • fill_value (Union[int, tuple[int]], optional) – Pixel fill value for the area outside the transformed image. It can be an int or a 3-tuple. If it is a 3-tuple, it is used to fill R, G, B channels respectively. If it is an integer, it is used for all RGB channels. The fill_value values must be in range [0, 255]. Default: 0.

Raises
Supported Platforms:

CPU

Examples

>>> from mindspore.dataset.vision import AutoAugmentPolicy, Inter
>>>
>>> transforms_list = [vision.Decode(), vision.AutoAugment(policy=AutoAugmentPolicy.IMAGENET,
...                                                        interpolation=Inter.NEAREST,
...                                                        fill_value=0)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])