mindspore.dataset.vision.py_transforms.Cutout

class mindspore.dataset.vision.py_transforms.Cutout(length, num_patches=1)[source]

Randomly cut (mask) out a given number of square patches from the input NumPy image array.

Terrance DeVries and Graham W. Taylor ‘Improved Regularization of Convolutional Neural Networks with Cutout’ 2017 See https://arxiv.org/pdf/1708.04552.pdf

Parameters
  • length (int) – The side length of each square patch.

  • num_patches (int, optional) – Number of patches to be cut out of an image (default=1).

Examples

>>> import mindspore.dataset.vision.py_transforms as py_vision
>>> from mindspore.dataset.transforms.py_transforms import Compose
>>>
>>> Compose([py_vision.Decode(),
>>>          py_vision.ToTensor(),
>>>          py_vision.Cutout(80)])