I'm trying to run inference on the NCS2 on non-image data, shape 200x6. I'm stuck on how to make an input blob. The example code is all image or audio based so it's not obvious to me how to form more generic data into a blob.
It starts life as an array of arrays (or vector of vectors) of floats. I can potentially convert to other forms first if it makes the conversion to a blob workable.
I know the NCS2 can do it because I have it working in Python, but of course most of the detail is hidden there so it's not much help. Can anyone advise on how I might convert a standard CPP array to an input blob which can be passed into an inference request?
I'm happy to supply more information, but trying to keep it general for now.
Thanks.
Link Copied
Hi Colin,
Greetings to you.
You’re right, the example code does not have array based. That would upset me too.
Anyway, you can create blob using the InferenceEngine::Blob or InferenceEngine::TBlob classes.
An implementation step-by-step guide is provided in the Integration Steps. Point No. 6 (Prepare Input) provides some options to prepare input, which may help you.
In addition, I would like to share a video on example implementation of Inference-Engine main function calls.
Inference-Engine API Sample Code
Regards,
Peh
Thanks for the tips.
The video still assumes you're working with images and it isn't clear how I'd do anything without cv. The integration steps documentation says this:
/** Iterate over all input blobs **/
for (auto & item : input_info) {
auto input_name = item.first;
/** Get input blob **/
auto input = infer_request.GetBlob(input_name);
/** Fill input tensor with planes. First b channel, then g and r channels **/
// ...
}
Actually I think I'll probably struggle with reading the output blob as well when it comes to it. The output should just be three numbers so would be nice if I could index into it directly, but doesn't look like that's going to be possible based on what's going on in the examples.
Hi Colin,
Greetings to you.
We don’t have a specific example for array as an input. I am so sorry for that.
For non-image workloads, I would suggest you have a look at supported models such as GNMT, BERT, TDNN, ESPNet, and the following demos and sample :
Regards,
Peh
Thank you.
I am intending to look more closely at the speech recognition example as it seems closest to what I need.
Is there any possibility of creating an array- or vector-based example? It seems like it would be a good thing to include as it's a common point that we can all reach no matter what kind of data we're working with.
Hi Colin,
Greetings to you. I’m glad to hear that you’ve found the example that close to what you need. The full implementation of this coding can be found in this directory:
<path_to_openvino>\inference_engine\samples\cpp\speech_sample
You may also find from this link:
I hope this example will help you to achieve what you need.
Regards,
Yu Chern
Hi Colin,
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.
Regards,
Yu Chern
Unfortunately I don't think you have provided a solution. This example uses the same techniques as the others and gives not clue at all how I might make use of arbitrary data stored in other forms.
I have found CopyVectorToBlob() here: https://docs.openvinotoolkit.org/2021.2/ie_plugin_api/group__ie__dev__api__memory.html
but the documentation is not clear on how to use it. It does not appear to exist in the InferenceEngine namespace. Can you help?
For more complete information about compiler optimizations, see our Optimization Notice.