mindspore.dataset.vision.UniformAugment

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

Uniformly select a number of transformations from a sequence and apply them sequentially and randomly, which means that there is a chance that a chosen transformation will not be applied.

All transformations in the sequence require the output type to be the same as the input. Thus, the latter one can deal with the output of the previous one.

Parameters
  • transforms (Sequence) – Sequence of transformations to select from.

  • num_ops (int, optional) – Number of transformations to be sequentially and randomly applied. Default: 2.

Raises
  • TypeError – If transforms is not a sequence of data processing operations.

  • TypeError – If num_ops is not of type integer.

  • ValueError – If num_ops is not positive.

Supported Platforms:

CPU

Examples

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