Class NormalizePad
Defined in File vision.h
Inheritance Relationships
Base Type
public mindspore::dataset::TensorTransform
(Class TensorTransform)
Class Documentation
-
class NormalizePad : public mindspore::dataset::TensorTransform
Normalize the input image with respect to mean and standard deviation and pads an extra channel with value zero.
Public Functions
-
inline NormalizePad(const std::vector<float> &mean, const std::vector<float> &std, const std::string &dtype = "float32", bool is_hwc = true)
Constructor.
- Parameters
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].
dtype – [in] The output datatype of Tensor. The standard deviation values must be “float32” or “float16”(default = “float32”).
is_hwc – [in] A boolean to indicate whether the input image is in HWC format (true) or CHW format (false) (default = true).
样例/* Define operations */ auto decode_op = vision::Decode(); auto normalize_pad_op = vision::NormalizePad({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0}); /* dataset is an instance of Dataset object */ dataset = dataset->Map({decode_op, normalize_pad_op}, // operations {"image"}); // input columns
-
~NormalizePad() = default
Destructor.
-
inline NormalizePad(const std::vector<float> &mean, const std::vector<float> &std, const std::string &dtype = "float32", bool is_hwc = true)