mindspore.dataset.vision.py_transforms.Normalize

class mindspore.dataset.vision.py_transforms.Normalize(mean, std)[source]

Normalize the input NumPy image array of shape (C, H, W) with the given mean and standard deviation.

The values of the array need to be in the range (0.0, 1.0].

Parameters
  • mean (sequence) – List or tuple of mean values for each channel, with respect to channel order. The mean values must be in the range [0.0, 1.0].

  • std (sequence) – List or tuple of standard deviations for each channel, w.r.t. channel order. The standard deviation values must be in the range (0.0, 1.0].

Examples

>>> import mindspore.dataset.vision.py_transforms as py_vision
>>> from mindspore.dataset.transforms.py_transforms import Compose
>>>
>>> Compose([py_vision.Decode(),
>>>          py_vision.RandomHorizontalFlip(0.5),
>>>          py_vision.ToTensor(),
>>>          py_vision.Normalize((0.491, 0.482, 0.447), (0.247, 0.243, 0.262))])