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