mindspore.dataset.vision.ResizeWithBBox

View Source On Gitee
class mindspore.dataset.vision.ResizeWithBBox(size, interpolation=Inter.LINEAR)[source]

Resize the input image to the given size and adjust bounding boxes accordingly.

Parameters
  • size (Union[int, Sequence[int]]) – 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, optional) – Image interpolation method defined by Inter . Default: Inter.LINEAR.

Raises
Supported Platforms:

CPU

Examples

>>> import mindspore.dataset as ds
>>> import mindspore.dataset.vision as vision
>>> from mindspore.dataset.vision import Inter
>>>
>>> decode_op = vision.Decode()
>>> bbox_op = vision.ResizeWithBBox(50, Inter.NEAREST)
>>> transforms_list = [decode_op, bbox_op]
>>> image_folder_dataset = ds.ImageFolderDataset("/path/to/image_folder_dataset_directory")
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])
Tutorial Examples: