31 using Ptr = std::shared_ptr<PreProcessChannel>;
58 std::vector<PreProcessChannel::Ptr> _channelsInfo;
72 if (_channelsInfo.empty()) {
75 if (index >= _channelsInfo.size()) {
78 return _channelsInfo[index];
89 if (_channelsInfo.empty()) {
92 if (index >= _channelsInfo.size()) {
95 return _channelsInfo[index];
103 return _channelsInfo.size();
110 void init(
const size_t numberOfChannels) {
111 _channelsInfo.resize(numberOfChannels);
112 for (
auto &channelInfo : _channelsInfo) {
113 channelInfo = std::make_shared<PreProcessChannel>();
123 if (meanImage.get() ==
nullptr) {
125 }
else if (meanImage.get()->dims().size() != 3) {
127 }
else if (meanImage.get()->dims()[2] != getNumberOfChannels()) {
129 << getNumberOfChannels();
130 }
else if (meanImage.get()->layout() != Layout::CHW) {
143 if (meanImage.get() ==
nullptr) {
145 }
else if (meanImage.get()->dims().size() != 2) {
146 THROW_IE_EXCEPTION <<
"Failed to set invalid mean image for channel: number of dimensions != 2";
147 }
else if (channel >= _channelsInfo.size()) {
148 THROW_IE_EXCEPTION <<
"Channel " << channel <<
" exceed number of PreProcess channels: "
149 << _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: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:142
Definition: ie_argmax_layer.hpp:11
Definition: ie_preprocess.hpp:39
ResizeAlgorithm
Represents the list of supported resize algorithms.
Definition: ie_preprocess.hpp:47
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: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:88
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:122
PreProcessChannel::Ptr & operator[](size_t index)
Overloaded [] operator to safely get the channel by an index. Throws an exception if channels are emp...
Definition: ie_preprocess.hpp:71
std::shared_ptr< PreProcessChannel > Ptr
Smart pointer to an instance.
Definition: ie_preprocess.hpp:31
void init(const size_t numberOfChannels)
Initializes with given number of channels.
Definition: ie_preprocess.hpp:110
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:38
Blob::Ptr meanData
Mean data for a channel.
Definition: ie_preprocess.hpp:28
Definition: ie_preprocess.hpp:38
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:102
void setResizeAlgorithm(const ResizeAlgorithm &alg)
Sets resize algorithm to be used during pre-processing.
Definition: ie_preprocess.hpp:175
Definition: ie_preprocess.hpp:40
void setVariant(const MeanVariant &variant)
Sets a type of mean operation.
Definition: ie_preprocess.hpp:159
MeanVariant
Defines available types of mean.
Definition: ie_preprocess.hpp:37
float meanValue
Mean value for a channel.
Definition: ie_preprocess.hpp:25
float stdScale
Scale parameter for a channel.
Definition: ie_preprocess.hpp:22