mindspore.dataset.vision.c_transforms.SoftDvppDecodeResizeJpeg

class mindspore.dataset.vision.c_transforms.SoftDvppDecodeResizeJpeg(size)[source]

Decode and resize JPEG image using the simulation algorithm of Ascend series chip DVPP module.

It is recommended to use this algorithm in the following scenarios: When training, the DVPP of the Ascend chip is not used, and the DVPP of the Ascend chip is used during inference, and the accuracy of inference is lower than the accuracy of training; and the input image size should be in range [32*32, 8192*8192]. The zoom-out and zoom-in multiples of the image length and width should in the range [1/32, 16]. Only images with an even resolution can be output. The output of odd resolution is not supported.

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

Examples

>>> # decode and resize image, keeping aspect ratio
>>> transforms_list1 = [c_vision.Decode(), c_vision.SoftDvppDecodeResizeJpeg(70)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list1,
...                                                 input_columns=["image"])
>>> # decode and resize to portrait style
>>> transforms_list2 = [c_vision.Decode(), c_vision.SoftDvppDecodeResizeJpeg((80, 60))]
>>> image_folder_dataset_1 = image_folder_dataset_1.map(operations=transforms_list2,
...                                                     input_columns=["image"])