Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

[OpenVino] Loading network weights from memory buffer

K__Alex
Beginner
1,044 Views

Hi,

I'm trying to load the network weights from a memory buffer on Openvino but it seems that it doesn't work properly, strangely this happens on one network but works fine on another -- so I'm assuming a) there is a bug somewhere b) I'm abusing something.

// typecasting from char to uint8_t
std::vector<uint8_t> weight_file8U(weight_file.begin(), weight_file.end());
SizeVector dims;  dims.push_back(weight_file.size());
//creating tensor descriptor
TensorDesc td(InferenceEngine::Precision::U8, dims, Layout::ANY);
//create blob
InferenceEngine::TBlob<uint8_t>::Ptr wblob = 
   InferenceEngine::make_shared_blob<uint8_t>(td, 
           (uint8_t *)weight_file8U.data(), 
           weight_file8U.size());
//set weights
networkReader.SetWeights(wblob);

My question is whether the above snippet is the right way to load the network weights.

Also another question, not totally related, is it possible to use Valgrind with OpenVino?

Thanks!

0 Kudos
3 Replies
Cary_P_Intel1
Employee
1,044 Views

Hi, Alex,

sorry that didn't see your question till now, currently the coding style is totally different from what you wrote above. You can refer to the sample code in the package, if you still have problem in coding it, feel free to ask question again.

0 Kudos
Wong__Jeremy
Beginner
1,044 Views

I check through the sample source files. There is no example of using "SetWeights". May I clarify from you whether the "SetWeights" method is support or not?

0 Kudos
Shubha_R_Intel
Employee
1,044 Views

Dear Wong, Jeremy,

Please look for SetWeights() examples in our https://github.com/opencv/dldt . A quick grep shows plenty of examples in the OpenVino Inference Engine source code. Right now only 2019R1 source code is available but R2 should be added very soon (as OpenVino 2019R2 was just released). For instance look at https://github.com/opencv/dldt/blob/2019/inference-engine/tests/unit/engines/mkldnn/graph/structure/graph_structure_test.cpp which contains plenty of SetWeights() examples.

Hope it helps,

thanks,

Shubha

 

0 Kudos
Reply