mindspore.dataset.vision.c_transforms.RandomSelectSubpolicy

class mindspore.dataset.vision.c_transforms.RandomSelectSubpolicy(policy)[source]

Choose a random sub-policy from a list to be applied on the input image. A sub-policy is a list of tuples (op, prob), where op is a TensorOp operation and prob is the probability that this op will be applied. Once a sub-policy is selected, each op within the subpolicy with be applied in sequence according to its probability.

Parameters

policy (list(list(tuple(TensorOp,float))) – List of sub-policies to choose from.

Examples

>>> import mindspore.dataset.vision.c_transforms as c_vision
>>>
>>> policy = [[(c_vision.RandomRotation((45, 45)), 0.5), (c_vision.RandomVerticalFlip(), 1),
>>>            (c_vision.RandomColorAdjust(), 0.8)],
>>>           [(c_vision.RandomRotation((90, 90)), 1), (c_vision.RandomColorAdjust(), 0.2)]]
>>> data_policy = data1.map(operations=c_vision.RandomSelectSubpolicy(policy), input_columns=["image"])