mindspore.dataset.vision.Resize
- class mindspore.dataset.vision.Resize(size, interpolation=Inter.LINEAR)[source]
Resize the input image to the given size with a given interpolation mode.
- Parameters
size (Union[int, Sequence[int]]) – The output size of the resized image. The size value(s) must be positive. 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, optional) –
Image interpolation mode (default=Inter.BILINEAR). It can be any of [Inter.BILINEAR, Inter.LINEAR, Inter.NEAREST, Inter.BICUBIC, Inter.AREA, Inter.PILCUBIC, Inter.ANTIALIAS].
Inter.BILINEAR, bilinear interpolation.
Inter.LINEAR, bilinear interpolation, here is the same as Inter.BILINEAR.
Inter.NEAREST, nearest-neighbor interpolation.
Inter.BICUBIC, bicubic interpolation.
Inter.AREA, pixel area interpolation.
Inter.PILCUBIC, bicubic interpolation like implemented in Pillow, only valid when the input is a 3-channel image in the numpy.ndarray format.
Inter.ANTIALIAS, antialias interpolation.
- Raises
TypeError – If size is not of type int or Sequence[int].
TypeError – If interpolation is not of type Inter.
ValueError – If size is not positive.
RuntimeError – If given tensor shape is not <H, W> or <H, W, C>.
- Supported Platforms:
CPU
Examples
>>> from mindspore.dataset.vision import Inter >>> decode_op = vision.Decode() >>> resize_op = vision.Resize([100, 75], Inter.BICUBIC) >>> transforms_list = [decode_op, resize_op] >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns=["image"])