Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.dataset.vision.py_transforms.Normalize

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

Normalize the input numpy.ndarray image of shape (C, H, W) with the specified mean and standard deviation.

outputc=inputcmeancstdc

Note

The values of the input image need to be in the range [0.0, 1.0]. If not so, call ToTensor first.

Parameters
  • mean (Union[float, sequence]) – list or tuple of mean values for each channel, arranged in channel order. The values must be in the range [0.0, 1.0]. If a single float is provided, it will be filled to the same length as the channel.

  • std (Union[float, sequence]) – list or tuple of standard deviation values for each channel, arranged in channel order. The values must be in the range (0.0, 1.0]. If a single float is provided, it will be filled to the same length as the channel.

Raises
  • TypeError – If the input is not numpy.ndarray.

  • TypeError – If the dimension of input is not 3.

  • NotImplementedError – If the dtype of input is a subdtype of np.integer.

  • ValueError – If the length of the mean and std are not equal.

  • ValueError – If the length of the mean or std is neither equal to the channel length nor 1.

Examples

>>> from mindspore.dataset.transforms.py_transforms import Compose
>>> transforms_list = 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))])
>>> # apply the transform to dataset through map function
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns="image")