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

>>> 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)]]
>>> image_folder_dataset = image_folder_dataset.map(operations=c_vision.RandomSelectSubpolicy(policy),
...                                                 input_columns=["image"])
parse()[source]

Return a C++ representation of the operator for execution