mindspore.dataset.vision.RandAugment

class mindspore.dataset.vision.RandAugment(num_ops=2, magnitude=9, num_magnitude_bins=31, interpolation=Inter.NEAREST, fill_value=0)[source]

Apply RandAugment data augmentation method on the input image.

Refer to RandAugment: Learning Augmentation Strategies from Data .

Only support 3-channel RGB image.

Parameters
  • num_ops (int, optional) – Number of augmentation transformations to apply sequentially. Default: 2.

  • magnitude (int, optional) – Magnitude for all the transformations, must be smaller than num_magnitude_bins. Default: 9.

  • num_magnitude_bins (int, optional) – The number of different magnitude values, must be no less than 2. Default: 31.

  • interpolation (Inter, optional) –

    Image interpolation method. Default: Inter.NEAREST. It can be Inter.NEAREST, Inter.BILINEAR, Inter.BICUBIC or Inter.AREA.

    • Inter.NEAREST, nearest-neighbor interpolation.

    • Inter.BILINEAR, bilinear interpolation.

    • Inter.BICUBIC, bicubic interpolation.

    • Inter.AREA, pixel area interpolation.

  • fill_value (Union[int, tuple[int, int, int]], optional) – Pixel fill value for the area outside the transformed image, must be in range of [0, 255]. Default: 0. If int is provided, pad all RGB channels with this value. If tuple[int, int, int] is provided, pad R, G, B channels respectively.

Raises
Supported Platforms:

CPU

Examples

>>> transforms_list = [vision.Decode(), vision.RandAugment()]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, input_columns=["image"])