mindspore.dataset.vision.py_transforms.Resize

class mindspore.dataset.vision.py_transforms.Resize(size, interpolation=Inter.BILINEAR)[source]

Resize the input PIL image to the given size.

Parameters
  • size (Union[int, sequence]) – The output size of the resized image. If size is an integer, the smaller edge of the image will be resized to this value with the same image aspect ratio. If size is a sequence of length 2, it should be (height, width).

  • interpolation (Inter mode, optional) –

    Image interpolation mode (default=Inter.BILINEAR). It can be any of [Inter.NEAREST, Inter.ANTIALIAS, Inter.BILINEAR, Inter.BICUBIC].

    • Inter.NEAREST, means the interpolation method is nearest-neighbor interpolation.

    • Inter.ANTIALIAS, means the interpolation method is antialias interpolation.

    • Inter.BILINEAR, means the interpolation method is bilinear interpolation.

    • Inter.BICUBIC, means the interpolation method is bicubic interpolation.

Examples

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