mindspore.dataset.vision.c_transforms.ResizeWithBBox
- class mindspore.dataset.vision.c_transforms.ResizeWithBBox(size, interpolation=Inter.LINEAR)[source]
Resize the input image to the given size and adjust bounding boxes accordingly.
- Parameters
size (Union[int, sequence]) – The output size of the resized image. If size is an integer, 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.LINEAR). It can be any of [Inter.LINEAR, Inter.NEAREST, Inter.BICUBIC].
Inter.LINEAR, means interpolation method is bilinear interpolation.
Inter.NEAREST, means interpolation method is nearest-neighbor interpolation.
Inter.BICUBIC, means interpolation method is 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.
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 = c_vision.Decode() >>> bbox_op = c_vision.ResizeWithBBox(50, Inter.NEAREST) >>> transforms_list = [decode_op, bbox_op] >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns=["image"])