mindspore.dataset.vision.py_transforms.Cutout
- class mindspore.dataset.vision.py_transforms.Cutout(length, num_patches=1)[source]
Randomly cut out a certain number of square patches on the input numpy.ndarray image, setting the pixel values in the patch to zero.
See Improved Regularization of Convolutional Neural Networks with Cutout.
- Parameters
- Raises
TypeError – If length is not of type int.
TypeError – If num_patches is not of type int.
ValueError – If length is less than or equal 0.
ValueError – If num_patches is less than or equal 0.
RuntimeError – If shape of the input image is not <H, W, C>.
- Supported Platforms:
CPU
Examples
>>> from mindspore.dataset.transforms.py_transforms import Compose >>> >>> transforms_list = Compose([py_vision.Decode(), ... py_vision.ToTensor(), ... py_vision.Cutout(80)]) >>> # apply the transform to dataset through map function >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns="image")