mindspore.dataset.vision.HWC2CHW
- class mindspore.dataset.vision.HWC2CHW[source]
Transpose the input image from shape <H, W, C> to <C, H, W>. If the input image is of shape <H, W>, it will remain unchanged.
Note
This operation supports running on Ascend or GPU platforms by Offload.
- Raises
RuntimeError – If shape of the input image is not <H, W> or <H, W, C>.
- Supported Platforms:
CPU
Examples
>>> import mindspore.dataset as ds >>> import mindspore.dataset.vision as vision >>> >>> image_folder_dataset = ds.ImageFolderDataset("/path/to/image_folder_dataset_directory") >>> transforms_list = [vision.Decode(), ... vision.RandomHorizontalFlip(0.75), ... vision.RandomCrop(512), ... vision.HWC2CHW()] >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns=["image"])
- Tutorial Examples: