mindspore.dataset.transforms.py_transforms.RandomChoice
- class mindspore.dataset.transforms.py_transforms.RandomChoice(transforms)[source]
Randomly select one transform from a series of transforms and applies that on the image.
- Parameters
transforms (list) – List of transformations to be chosen from to apply.
Examples
>>> from mindspore.dataset.transforms.py_transforms import Compose, RandomChoice >>> transforms_list = [py_vision.RandomHorizontalFlip(0.5), ... py_vision.Normalize((0.491, 0.482, 0.447), (0.247, 0.243, 0.262)), ... py_vision.RandomErasing()] >>> transforms = Compose([py_vision.Decode(), ... py_transforms.RandomChoice(transforms_list), ... py_vision.ToTensor()]) >>> image_folder_dataset = image_folder_dataset.map(operations=transforms, input_columns=["image"])