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[int, int]]) – The size of the resized image. If int is provided, resize the smaller edge of the image to this value, keeping the image aspect ratio the same. If Sequence[int, int] is provided, its two elements will be taken as the resized height and width.

  • interpolation (Inter, optional) –

    Method of interpolation. It can be Inter.NEAREST, Inter.ANTIALIAS, Inter.BILINEAR or Inter.BICUBIC. Default: Inter.BILINEAR.

    • Inter.NEAREST, nearest-neighbor interpolation.

    • Inter.ANTIALIAS, antialias interpolation.

    • Inter.BILINEAR, bilinear interpolation.

    • Inter.BICUBIC, bicubic interpolation.

Raises
Supported Platforms:

CPU

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")