mindspore.dataset.vision.ToNumpy

class mindspore.dataset.vision.ToNumpy[源代码]

将输入PIL图像转换为numpy.ndarray图像。

支持平台:

CPU

样例:

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