mindspore.dataset.vision.AutoAugment
- class mindspore.dataset.vision.AutoAugment(policy=AutoAugmentPolicy.IMAGENET, interpolation=Inter.NEAREST, fill_value=0)[源代码]
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 operator (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 area interpolation.
fill_value (Union[int, tuple], 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
TypeError – If policy is not of type AutoAugmentPolicy.
TypeError – If interpolation is not of type Inter.
TypeError – If fill_value is not an integer or a tuple of length 3.
RuntimeError – If given tensor shape is not <H, W, C>.
- 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"])