Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
129 Views

[OpenVino] Loading network weights from memory buffer

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
Highlighted
Employee
129 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
Highlighted
Beginner
129 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
Highlighted
Employee
129 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/... which contains plenty of SetWeights() examples.

Hope it helps,

thanks,

Shubha

 

0 Kudos