mindspore.dataset.vision.py_transforms.HWC2CHW
- class mindspore.dataset.vision.py_transforms.HWC2CHW[源代码]
将输入的numpy.ndarray图像的shape从(H, W, C)转换为(C, H, W)。
异常:
TypeError - 当输入图像的类型不为
numpy.ndarray
。TypeError - 当输入图像的维度不为3。
- 支持平台:
CPU
样例:
>>> from mindspore.dataset.transforms.py_transforms import Compose >>> >>> transforms_list = Compose([py_vision.Decode(), ... py_vision.HWC2CHW()]) >>> # apply the transform to dataset through map function >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns="image")