31 using Ptr = std::shared_ptr<PreProcessChannel>;
58 std::vector<PreProcessChannel::Ptr> _channelsInfo;
75 if (_channelsInfo.empty()) {
78 if (index >= _channelsInfo.size()) {
81 return _channelsInfo[index];
92 if (_channelsInfo.empty()) {
95 if (index >= _channelsInfo.size()) {
98 return _channelsInfo[index];
106 return _channelsInfo.size();
113 void init(
const size_t numberOfChannels) {
114 _channelsInfo.resize(numberOfChannels);
115 for (
auto &channelInfo : _channelsInfo) {
116 channelInfo = std::make_shared<PreProcessChannel>();
126 if (meanImage.get() ==
nullptr) {
128 }
else if (meanImage.get()->getTensorDesc().getLayout() != Layout::CHW) {
130 }
else if (meanImage.get()->getTensorDesc().getDims().size() != 3) {
132 }
else if (meanImage.get()->getTensorDesc().getDims()[0] != getNumberOfChannels()) {
134 << getNumberOfChannels();
146 if (meanImage.get() ==
nullptr) {
148 }
else if (meanImage.get()->getTensorDesc().getDims().size() != 2) {
149 THROW_IE_EXCEPTION <<
"Failed to set invalid mean image for channel: number of dimensions != 2";
150 }
else if (channel >= _channelsInfo.size()) {
151 THROW_IE_EXCEPTION <<
"Channel " << channel <<
" exceed number of PreProcess channels: "
152 << _channelsInfo.size();
155 _channelsInfo[channel]->meanData = meanImage;
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:22
This structure stores info about pre-processing of network inputs (scale, mean image, ...)
Definition: ie_preprocess.hpp:20
void setMeanImageForChannel(const Blob::Ptr &meanImage, const size_t channel)
Sets mean image values if operation is applicable. Also sets the mean type to MEAN_IMAGE for a partic...
Definition: ie_preprocess.hpp:145
Inference Engine API.
Definition: ie_argmax_layer.hpp:11
Definition: ie_preprocess.hpp:38
Definition: ie_preprocess.hpp:40
void setColorFormat(ColorFormat fmt)
Changes the color format of the input data provided by the user This function should be called before...
Definition: ie_preprocess.hpp:197
ResizeAlgorithm getResizeAlgorithm() const
Gets preconfigured resize algorithm.
Definition: ie_preprocess.hpp:186
A header file for Blob and generic TBlob<>
This class stores pre-process information for the input.
Definition: ie_preprocess.hpp:56
const PreProcessChannel::Ptr & operator[](size_t index) const
operator [] to safely get the channel preprocessing information by index. Throws exception if channel...
Definition: ie_preprocess.hpp:91
void setMeanImage(const Blob::Ptr &meanImage)
Sets mean image values if operation is applicable. Also sets the mean type to MEAN_IMAGE for all chan...
Definition: ie_preprocess.hpp:125
MeanVariant
Defines available types of mean.
Definition: ie_preprocess.hpp:37
PreProcessChannel::Ptr & operator[](size_t index)
Overloaded [] operator to safely get the channel by an index Throws an exception if channels are empt...
Definition: ie_preprocess.hpp:74
std::shared_ptr< PreProcessChannel > Ptr
Smart pointer to an instance.
Definition: ie_preprocess.hpp:31
Plain blob (default), no extra color processing required.
Definition: ie_common.h:134
void init(const size_t numberOfChannels)
Initializes with given number of channels.
Definition: ie_preprocess.hpp:113
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:40
ColorFormat
Extra information about input color format for preprocessing.
Definition: ie_common.h:133
Blob::Ptr meanData
Mean data for a channel.
Definition: ie_preprocess.hpp:28
MeanVariant getMeanVariant() const
Gets a type of mean operation.
Definition: ie_preprocess.hpp:170
size_t getNumberOfChannels() const
Returns a number of channels to preprocess.
Definition: ie_preprocess.hpp:105
Definition: ie_preprocess.hpp:39
void setResizeAlgorithm(const ResizeAlgorithm &alg)
Sets resize algorithm to be used during pre-processing.
Definition: ie_preprocess.hpp:178
ResizeAlgorithm
Represents the list of supported resize algorithms.
Definition: ie_preprocess.hpp:47
ColorFormat getColorFormat() const
Gets a color format associated with the input.
Definition: ie_preprocess.hpp:207
void setVariant(const MeanVariant &variant)
Sets a type of mean operation.
Definition: ie_preprocess.hpp:162
float meanValue
Mean value for a channel.
Definition: ie_preprocess.hpp:25
float stdScale
Scale parameter for a channel.
Definition: ie_preprocess.hpp:22