Class Normalize

Inheritance Relationships

Base Type

Class Documentation

class Normalize : public mindspore::dataset::TensorTransform

Normalize the input image with respect to mean and standard deviation.

Public Functions

Normalize(const std::vector<float> &mean, const std::vector<float> &std, bool is_hwc = true)

Constructor.

Example
/* Define operations */
auto decode_op = vision::Decode();
auto normalize_op = vision::Normalize({128, 128, 128}, {1.0, 1.0, 1.0});

/* dataset is an instance of Dataset object */
dataset = dataset->Map({decode_op, normalize_op},  // operations
                       {"image"});                 // input columns

参数
  • mean[in] A vector of mean values for each channel, with respect to channel order. The mean values must be in range [0.0, 255.0].

  • std[in] A vector of standard deviations for each channel, with respect to channel order. The standard deviation values must be in range (0.0, 255.0].

  • is_hwc[in] A boolean to indicate whether the input image is in HWC format (true) or CHW format (false) (Lite only supports true) (default = true).

~Normalize() = default

Destructor.