mindspore.dataset.vision.py_transforms.TenCrop

class mindspore.dataset.vision.py_transforms.TenCrop(size, use_vertical_flip=False)[source]

Generate 10 cropped images (first 5 images from FiveCrop, second 5 images from their flipped version as per input flag to flip vertically or horizontally).

Parameters
  • size (Union[int, 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).

  • use_vertical_flip (bool, optional) – Flip the image vertically instead of horizontally if set to True (default=False).

Examples

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