33 using Ptr = std::shared_ptr<PreProcessChannel>;
56 std::vector<PreProcessChannel::Ptr> _channelsInfo;
73 if (_channelsInfo.empty()) {
76 if (index >= _channelsInfo.size()) {
79 return _channelsInfo[index];
90 if (_channelsInfo.empty()) {
93 if (index >= _channelsInfo.size()) {
96 return _channelsInfo[index];
104 return _channelsInfo.size();
111 void init(
const size_t numberOfChannels) {
112 _channelsInfo.resize(numberOfChannels);
113 for (
auto& channelInfo : _channelsInfo) {
114 channelInfo = std::make_shared<PreProcessChannel>();
124 if (meanImage.get() ==
nullptr) {
126 }
else if (meanImage.get()->getTensorDesc().getLayout() != Layout::CHW) {
128 }
else if (meanImage.get()->getTensorDesc().getDims().size() != 3) {
130 }
else if (meanImage.get()->getTensorDesc().getDims()[0] != getNumberOfChannels()) {
131 THROW_IE_EXCEPTION <<
"Failed to set invalid mean image: number of channels != " << getNumberOfChannels();
143 if (meanImage.get() ==
nullptr) {
145 }
else if (meanImage.get()->getTensorDesc().getDims().size() != 2) {
146 THROW_IE_EXCEPTION <<
"Failed to set invalid mean image for channel: number of dimensions != 2";
147 }
else if (channel >= _channelsInfo.size()) {
149 <<
" exceed number of PreProcess channels: " << _channelsInfo.size();
152 _channelsInfo[channel]->meanData = meanImage;
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:24
This structure stores info about pre-processing of network inputs (scale, mean image, ...)
Definition: ie_preprocess.hpp:22
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:142
Inference Engine API.
Definition: ie_argmax_layer.hpp:11
Definition: ie_preprocess.hpp:40
Definition: ie_preprocess.hpp:42
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:194
ResizeAlgorithm getResizeAlgorithm() const
Gets preconfigured resize algorithm.
Definition: ie_preprocess.hpp:183
A header file for Blob and generic TBlob<>
This class stores pre-process information for the input.
Definition: ie_preprocess.hpp:54
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:89
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:123
MeanVariant
Defines available types of mean.
Definition: ie_preprocess.hpp:39
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:72
std::shared_ptr< PreProcessChannel > Ptr
Smart pointer to an instance.
Definition: ie_preprocess.hpp:33
Plain blob (default), no extra color processing required.
Definition: ie_common.h:140
void init(const size_t numberOfChannels)
Initializes with given number of channels.
Definition: ie_preprocess.hpp:111
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:139
Blob::Ptr meanData
Mean data for a channel.
Definition: ie_preprocess.hpp:30
MeanVariant getMeanVariant() const
Gets a type of mean operation.
Definition: ie_preprocess.hpp:167
size_t getNumberOfChannels() const
Returns a number of channels to preprocess.
Definition: ie_preprocess.hpp:103
Definition: ie_preprocess.hpp:41
void setResizeAlgorithm(const ResizeAlgorithm &alg)
Sets resize algorithm to be used during pre-processing.
Definition: ie_preprocess.hpp:175
ResizeAlgorithm
Represents the list of supported resize algorithms.
Definition: ie_preprocess.hpp:49
ColorFormat getColorFormat() const
Gets a color format associated with the input.
Definition: ie_preprocess.hpp:204
void setVariant(const MeanVariant &variant)
Sets a type of mean operation.
Definition: ie_preprocess.hpp:159
float meanValue
Mean value for a channel.
Definition: ie_preprocess.hpp:27
float stdScale
Scale parameter for a channel.
Definition: ie_preprocess.hpp:24