mindspore.dataset.vision.c_transforms.NormalizePad
- class mindspore.dataset.vision.c_transforms.NormalizePad(mean, std, dtype='float32')[source]
Normalize the input image with respect to mean and standard deviation then pad an extra channel with value zero.
- Parameters
mean (sequence) – List or tuple of mean values for each channel, with respect to channel order. The mean values must be in range (0.0, 255.0].
std (sequence) – List or tuple of standard deviations for each channel, with respect to channel order. The standard deviation values must be in range (0.0, 255.0].
dtype (str, optional) – Set the dtype of the output image (default is “float32”).
- Raises
TypeError – If mean is not of type sequence.
TypeError – If std is not of type sequence.
TypeError – If dtype is not of type str.
ValueError – If mean is not in range [0.0, 255.0].
ValueError – If std is not in range (0.0, 255.0].
RuntimeError – If given tensor shape is not <H, W, C>.
- Supported Platforms:
CPU
Examples
>>> decode_op = c_vision.Decode() >>> normalize_pad_op = c_vision.NormalizePad(mean=[121.0, 115.0, 100.0], ... std=[70.0, 68.0, 71.0], ... dtype="float32") >>> transforms_list = [decode_op, normalize_pad_op] >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns=["image"])