mindspore.dataset.vision.ToNumpy

class mindspore.dataset.vision.ToNumpy[source]

Convert the PIL input image to numpy.ndarray image.

Supported Platforms:

CPU

Examples

>>> from mindspore.dataset.transforms import Compose
>>>
>>> # Use ToNumpy to explicitly select C++ implementation of subsequent op
>>> transforms_list = Compose([vision.Decode(True),
...                            vision.RandomHorizontalFlip(0.5),
...                            vision.ToNumpy(),
...                            vision.Resize(100, 120)])
>>> # apply the transform to dataset through map function
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns="image")
execute_py(img)[source]

Execute method.

Parameters

img (PIL Image) – Image to be converted to numpy.ndarray.

Returns

Image converted to numpy.ndarray