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.
- Raises
TypeError – If size is not of type integer or sequence of integer.
TypeError – If interpolation is not of type Inter.
ValueError – If size is not positive.
- 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")