mindspore.dataset.vision.py_transforms.FiveCrop

class mindspore.dataset.vision.py_transforms.FiveCrop(size)[source]

Generate 5 cropped images (one central image and four corners images).

Parameters

size (int or sequence) – The output size of the crop. If size is an integer, a square crop of size (size, size) is returned. If size is a sequence of length 2, it should be (height, width).

Examples

>>> import mindspore.dataset.vision.py_transforms as py_vision
>>> from mindspore.dataset.transforms.py_transforms import Compose
>>>
>>> Compose([py_vision.Decode(),
>>>          py_vision.FiveCrop(size=200),
>>>          # 4D stack of 5 images
>>>          lambda *images: numpy.stack([py_vision.ToTensor()(image) for image in images])])