34 using Ptr = std::shared_ptr<PreProcessChannel>;
57 std::vector<PreProcessChannel::Ptr> _channelsInfo;
76 if (_channelsInfo.empty()) {
79 if (index >= _channelsInfo.size()) {
82 return _channelsInfo[index];
94 if (_channelsInfo.empty()) {
97 if (index >= _channelsInfo.size()) {
100 return _channelsInfo[index];
109 return _channelsInfo.size();
117 void init(
const size_t numberOfChannels) {
118 _channelsInfo.resize(numberOfChannels);
119 for (
auto& channelInfo : _channelsInfo) {
120 channelInfo = std::make_shared<PreProcessChannel>();
132 if (meanImage.get() ==
nullptr) {
134 }
else if (meanImage.get()->getTensorDesc().getLayout() != Layout::CHW) {
136 }
else if (meanImage.get()->getTensorDesc().getDims().size() != 3) {
138 }
else if (meanImage.get()->getTensorDesc().getDims()[0] != getNumberOfChannels()) {
139 THROW_IE_EXCEPTION <<
"Failed to set invalid mean image: number of channels != " << getNumberOfChannels();
153 if (meanImage.get() ==
nullptr) {
155 }
else if (meanImage.get()->getTensorDesc().getDims().size() != 2) {
156 THROW_IE_EXCEPTION <<
"Failed to set invalid mean image for channel: number of dimensions != 2";
157 }
else if (channel >= _channelsInfo.size()) {
159 <<
" exceed number of PreProcess channels: " << _channelsInfo.size();
162 _channelsInfo[channel]->meanData = meanImage;
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:25
This structure stores info about pre-processing of network inputs (scale, mean image, ...)
Definition: ie_preprocess.hpp:23
void setMeanImageForChannel(const Blob::Ptr &meanImage, const size_t channel)
Sets mean image values if operation is applicable.
Definition: ie_preprocess.hpp:152
Definition: cldnn_config.hpp:16
Definition: ie_preprocess.hpp:42
ResizeAlgorithm
Represents the list of supported resize algorithms.
Definition: ie_preprocess.hpp:50
void setColorFormat(ColorFormat fmt)
Changes the color format of the input data provided by the user.
Definition: ie_preprocess.hpp:210
ResizeAlgorithm getResizeAlgorithm() const
Gets preconfigured resize algorithm.
Definition: ie_preprocess.hpp:197
A header file for Blob and generic TBlob<>
This class stores pre-process information for the input.
Definition: ie_preprocess.hpp:55
const PreProcessChannel::Ptr & operator[](size_t index) const
operator [] to safely get the channel preprocessing information by index.
Definition: ie_preprocess.hpp:93
void setMeanImage(const Blob::Ptr &meanImage)
Sets mean image values if operation is applicable.
Definition: ie_preprocess.hpp:131
PreProcessChannel::Ptr & operator[](size_t index)
Overloaded [] operator to safely get the channel by an index.
Definition: ie_preprocess.hpp:75
std::shared_ptr< PreProcessChannel > Ptr
Smart pointer to an instance.
Definition: ie_preprocess.hpp:34
void init(const size_t numberOfChannels)
Initializes with given number of channels.
Definition: ie_preprocess.hpp:117
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:42
ColorFormat
Extra information about input color format for preprocessing.
Definition: ie_common.h:141
Blob::Ptr meanData
Mean data for a channel.
Definition: ie_preprocess.hpp:31
Definition: ie_preprocess.hpp:41
MeanVariant getMeanVariant() const
Gets a type of mean operation.
Definition: ie_preprocess.hpp:179
size_t getNumberOfChannels() const
Returns a number of channels to preprocess.
Definition: ie_preprocess.hpp:108
void setResizeAlgorithm(const ResizeAlgorithm &alg)
Sets resize algorithm to be used during pre-processing.
Definition: ie_preprocess.hpp:188
Definition: ie_preprocess.hpp:43
ColorFormat getColorFormat() const
Gets a color format associated with the input.
Definition: ie_preprocess.hpp:221
void setVariant(const MeanVariant &variant)
Sets a type of mean operation.
Definition: ie_preprocess.hpp:170
MeanVariant
Defines available types of mean.
Definition: ie_preprocess.hpp:40
float meanValue
Mean value for a channel.
Definition: ie_preprocess.hpp:28
float stdScale
Scale parameter for a channel.
Definition: ie_preprocess.hpp:25