mindspore.dataset.vision.c_transforms.UniformAugment

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

Perform randomly selected augmentation on input image.

Parameters
  • transforms – List of C++ operations (Python operations are not accepted).

  • num_ops (int, optional) – Number of operations to be selected and applied, which must be positive (default=2).

Raises
  • TypeError – If transforms contains uncallable Python object.

  • TypeError – If num_ops is not of type integer.

  • ValueError – If num_ops is not positive.

Supported Platforms:

CPU

Examples

>>> import mindspore.dataset.vision.py_transforms as py_vision
>>> transforms_list = [c_vision.RandomHorizontalFlip(),
...                    c_vision.RandomVerticalFlip(),
...                    c_vision.RandomColorAdjust(),
...                    c_vision.RandomRotation(degrees=45)]
>>> uni_aug_op = c_vision.UniformAugment(transforms=transforms_list, num_ops=2)
>>> transforms_all = [c_vision.Decode(), c_vision.Resize(size=[224, 224]),
...                   uni_aug_op]
>>> image_folder_dataset_1 = image_folder_dataset.map(operations=transforms_all,
...                                                   input_columns="image",
...                                                   num_parallel_workers=1)