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 image. If size is an integer, the smaller edge of the image will be resized to this value, keeping the image aspect ratio the same. If size is a sequence of length 2, it should be in shape of (height, width).

  • interpolation (Inter, optional) –

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

    • Inter.NEAREST, nearest-neighbor interpolation.

    • Inter.ANTIALIAS, antialias interpolation.

    • Inter.BILINEAR, bilinear interpolation.

    • Inter.BICUBIC, bicubic interpolation.

Examples

>>> from mindspore.dataset.transforms.py_transforms import Compose
>>> transforms_list = Compose([py_vision.Decode(),
...                            py_vision.Resize(256),
...                            py_vision.ToTensor()])
>>> # apply the transform to dataset through map function
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns="image")