mindspore.dataset.vision.py_transforms.MixUp

class mindspore.dataset.vision.py_transforms.MixUp(batch_size, alpha, is_single=True)[source]

Apply mix up transformation to the input image and label. Make one input data combined with others.

Parameters
  • batch_size (int) – Batch size of dataset.

  • alpha (float) – Mix up rate.

  • is_single (bool) – Identify if single batch or multi-batch mix up transformation is to be used (Default=True, which is single batch).

Examples

>>> import mindspore.dataset.vision.py_transforms as py_vision
>>>
>>> # Setup multi-batch mixup transformation
>>> transform = [py_vision.MixUp(batch_size=16, alpha=0.2, is_single=False)]
>>> # Apply the transform to the dataset through dataset.map()
>>> dataset = dataset.map(input_columns="image", operations=transform())