Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5960 Discussions

SDev, Mean values not setting propoerly in IE c++ API

Raza__Ghulam_Jilani
343 Views

Hi! I am trying to incorporate an IR model into my app via inference engine c++ api, and i wanted to specify mean and sdev values through the c++ api in the CNNNetwork object. This is how i am doing it right now,

InputInfo::Ptr input_info = in_network->getInputsInfo().begin()->second;
DataPtr output_info = in_network->getOutputsInfo().begin()->second; //OutputsDataMap outputs_map = in_network->getOutputsInfo(); in_network->setBatchSize(batch_size);
input_info->setPrecision(in_precision);
input_info->setLayout(in_layout);
input_info->getPreProcess().setResizeAlgorithm(in_resize_algo);
input_info->getPreProcess().setColorFormat(in_color_fmt);
InferenceEngine::PreProcessInfo pre_info = input_info->getPreProcess();
pre_info.init(3);
PreProcessChannel::Ptr channel_0_info = pre_info[0];
channel_0_info->stdScale = 0.229; //0.229, 0.224, 0.225
channel_0_info->meanValue = 0.485; //0.485, 0.456, 0.406
PreProcessChannel::Ptr channel_1_info = pre_info[1];
channel_1_info->stdScale = 0.224;
channel_1_info->meanValue = 0.456;
PreProcessChannel::Ptr channel_2_info = pre_info[2];
channel_2_info->stdScale = 0.225;
channel_2_info->meanValue = 0.406;
input_info->getPreProcess().setVariant(InferenceEngine::MeanVariant::MEAN_VALUE);

std::cout << "Done setting mean and std scale " << std::endl;
const PreProcessChannel::Ptr info = pre_info[0];
std::cout << <<info->stdScale << " " << info->meanValue << std::endl;
output_info->setPrecision(out_precision);

 

Here I am setting std dev and mean values for individual channels but when i run, the IE doesnt seem to use these values and as a result pre proccessing isnt happening. the resize operation works correctly tho.

Also the PreProcessInfo class allows to set mean Image but not std image, also there is no function to set meanValue/stdValue, but in mean variants, MEAN_VALUE is provided. why is that so?

Can anyone please specify the correct way to give sdev, mean values to inference engine in cpp.

Thanks.

Raza

0 Kudos
2 Replies
Iffa_Intel
Moderator
321 Views

Greetings,


Any chance that you had followed this link to properly set up stdScale and meanValue in IE - https://github.com/intel/inference-engine-node/issues/26


Please also helps to refers this documentation too - https://docs.openvinotoolkit.org/latest/structInferenceEngine_1_1PreProcessChannel.html


Sincerely,

Iffa


Iffa_Intel
Moderator
289 Views

Greetings,


Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question


Sincerely,

Iffa


Reply