mindspore.dataset.vision.py_transforms.UniformAugment

class mindspore.dataset.vision.py_transforms.UniformAugment(transforms, num_ops=2)[source]

Uniformly select and apply a number of transforms sequentially from a list of transforms. Randomly assign a probability to each transform for each image to decide whether to apply the transform or not.

All the transforms in transform list must have the same input/output data type.

Parameters
  • transforms (list) – List of transformations to be chosen from to apply.

  • num_ops (int, optional) – number of transforms to sequentially apply (default=2).

Examples

>>> from mindspore.dataset.transforms.py_transforms import Compose
>>> transforms = [py_vision.CenterCrop(64),
...               py_vision.RandomColor(),
...               py_vision.RandomSharpness(),
...               py_vision.RandomRotation(30)]
>>> transforms_list = Compose([py_vision.Decode(),
...                            py_vision.UniformAugment(transforms),
...                            py_vision.ToTensor()])
>>> # apply the transform to dataset through map function
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns="image")