Welcome back to the OpenVINO channel.
Let's look at the most simple sample code for the Inference-engine to learn the main API function calls.
A typical inference flow by the inference-engine will look like this
First, we initialize the model, set all the parameters,
you can see that done in the white boxes, Until we create an infer request..
Then we read one frame, arrange it into the input blob or input tensor
Do the inference
Take the results from the output blob and process them.
This is done by the 3 bottom yellow boxes for each of the frames you want to infer
I am going to read the sample code of hello-classification.
Find it under C:\Intel\computer_vision_sdk\inference_engine\samples\hello_classification
The first API command is to call the PluginDispatcher class.
Then, we will call from the dispatcher the plugin corresponding to the hardware target using the object "InferencePlugin"
Here we are using CPU so the plug-in name is eCPU,
it can also be eGPU, eMYRIAD, eFPGA and so on.
Now we load the Intermediate Representation, the IR files.
We create a CNNNetReader object, that will read the topology (basically the .xml file) using the method ReadNetwork
and the weights with the method ReadWeights.
Finally, we load the network from the reader using the function getNetwork()
We set the input and output blobs (or tensors) to the layout and precision desired.
You can see here that the input image data is represented by U8 format.. pixels value
and the output is FP32..
because the output is the classification confidence level in percentages per class..
We load the network to the plugin
We are using the function "LoadNetwork" from the plug-in class.
We create an Inference Request and basically ready to start the main loop of inference..
Now, we are entering the inference loop
we start to read the data (here, an image from file) using OpenCV,
we resize it, we obtain the pointer to the input blob/tensor buffer
and direct it to the image.
Now, that the data is ready in the input blob, we trigger the Inference Request,
this is where Inference actually happens.
The inference output will be stored in the output blob
Now we read the results from the Output blob.
The data format is very dependent on the application
a list of classes and probabilities for classification,
bounding boxes coordinate for object detection and so on..
and you might need to customize the output parser based on your model output.
In this example, TopResults function create a vector of the Top 10 labels, in decreasing probability, that we just print out to the user.
And we perform that loop again and again for every frame we'd like to infer
We saw the most simple inference-engine sample, Use it to implement your inference..
Please also refer to the link for the full documentation on how to integrate the Inference-engine API into your application
There are many other samples, for detection, segmentation and more..
Look them up in future videos or in the supplied package..
Subscribe to our channel and we'll send you more videos like this one..
Thank you.