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.
6404 Discussions

How do I convert a Blob of known dimensions to a C++ array of floats?

adammpolak
New Contributor I
1,293 Views

From the C++ samples that I follow along I see I can use:

 

  const SizeVector output_shape = output_info->getTensorDesc().getDims();
 
to find the dimensions and size of each dimension of an output Blob.
 
In my case it has 4 dimensions and is: [1,57,32,56]
I also know that each of the values are floats
 
I also see in the sample I am following along that there is some interface using "MemoryBlob::Cptr" to access the data
 
example: 
InferenceEngine::MemoryBlob::CPtr moutput = InferenceEngine::as<InferenceEngine::MemoryBlob>(_outBlob);
 
How can I convert my output Blob into a float[1,57,32,56] in C++? (is that even possible?)
 
 
0 Kudos
5 Replies
Zulkifli_Intel
Moderator
1,266 Views

Hello Adammpolak,

 

Thank you for reaching out to us.

 

We are checking this matter and we will get back to you soon.

 

Sincerely,

Zulkifli 


0 Kudos
Zulkifli_Intel
Moderator
1,236 Views

Hello Adammpolak,

 

We suggest you go through the OpenVINO Hello Reshape SSD C++ Sample and examine these lines of code 146-157 in the sample main.cpp file.

 

Sincerely,

Zulkifli 


0 Kudos
adammpolak
New Contributor I
1,171 Views

Really appreciate the response @Zulkifli_Intel !

 

So I checked out those lines:

auto moutputHolder = moutput->rmap();
const float* detection = moutputHolder.as<const float*>();

 

Sorry but this doesn't provide much insight into how to make this a multi-dimensional array...

0 Kudos
Zulkifli_Intel
Moderator
1,127 Views

Hello adammpolak


There is no internal function or tool available to convert a blob into an array of float. However, it is possible to access the blob data, thus you can explore in writing a function that is capable to perform the aforementioned conversion.

Here are some useful documents that you can refer to:

 

1) Integrate Inference Engine with Your C++ Application (steps 5 & 7) - Integrate Inference Engine — OpenVINO™ documentation

2) What is a Blob, and how do I Extract Detection Data from a Blob? - What is a Blob, and how do I Extract Detection Data from a Blob? (intel.com)

 

There were also previous requests in our community forum that you can refer to summarize the idea of converting the blob into float:

1) Trouble Understanding what a Blob is/how to extract info from a blob - Intel Communities

2) detection model's output data - Intel Communities

 

Sincerely,

Zulkifli


0 Kudos
Zulkifli_Intel
Moderator
1,100 Views

Hello adammpolak,


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


Sincerely,

Zulkifli


0 Kudos
Reply