mindspore.dataset.vision.py_transforms.UniformAugment
- class mindspore.dataset.vision.py_transforms.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 be chosen from.
num_ops (int, optional) – Number of transformations to be sequentially and randomly applied (default=2).
- Raises
TypeError – If transforms is not of type ImageTensorOperation.
TypeError – If num_ops is not of type integer.
ValueError – If num_ops is not positive.
- Supported Platforms:
CPU
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")