I got udacity intel AI edge scholarship and in the introduction, they provided Introduction of Intel OpenVINO. In this article, we are going to explore the basic of openVINO.
OpenVINO toolkit can boost your inference applications across multiple deep neural networks with high throughput and efficiency.
OpenVINO stands for Open Visual Inference and Neural Network Optimization.
What is OpenVINO?
OpenVINO stands for Open Visual Inference and Neural Network Optimization. OpenVINO is a toolkit provided by Intel to facilitate faster inference of deep learning computer vision models. This toolkit helps developers to create cost-effective and robust computer vision applications.
Learn more about openvino here.
It enables deep learning inference at the edge and supports heterogeneous execution across computer vision accelerators — CPU, GPU, Intel® Movidius™ Neural Compute Stick, and FPGA.
OpenVION provides a number of inbuilt trained models here.
Download & Install the OpenVINO:
There is the very good official documentation of OpenVION from intel, which descriptive and easy to understand. Please use below link
- To download
2. Get started
OverView of OpenVINO:
The execution process is as follows —
- We have to feed a pre-trained model to the Model Optimizer. It optimizes the model and converts it into its intermediate representation (.xml and .bin file).
- The Inference Engine helps in the proper execution of the model on the different number of devices. It manages the libraries required to run the code properly on different platforms.
The two main components of the OpenVINO toolkit are Model Optimizer and Inference Engine. So, we will dip dive into there details, to have a better understanding of under the hood.
The model optimizer is a cross-platform CLI tool that facilitates the transition between the training and deployment environment. It adjusts the deep learning models for optimal execution on end-point target devices. If you want to understand the optimization technique for TensorFlow you can check out this article.
If you check the diagram carefully optimizer contains three steps
- Preparing to inference.
OpenVION is a toolkit, not a deep learning library that will help you to train a model. It helps you to optimize and serve the model on different devices.
There is a detailed documentation of how under the hood this works. I don’t want to go into detail.
Now our model is ready for inferencing. The optimizer CLI converted and optimized model and ready for inference. The model optimizer produces the intermediate representation of a model. This is the input for the inference engine to take inference over the input data.
The Inference Engine is a C++ library with a set of C++ classes to infer input data (images) and get a result. The C++ library provides an API to read the Intermediate Representation, set the input and output formats, and execute the model on devices.
The best thing about the OpenVION inference engine is the heterogeneous execution of the model and it is possible because of the Inference Engine. It uses different plug-ins for different devices.
Code sample Example:
We will take sample store-aisle-monitor-python. This code sample has been provided by intel.
We will take some code sample snippets and brief description.
# Initialize the class
infer_network = Network()
# Load the network to IE plugin to get shape of input layer
n, c, h, w = infer_network.load_model(args.model, args.device, 1, 1, 2, args.cpu_extension)
The above code is self-explanatory.
just initializing the Network class and loading the model using the
load_model the function returns the plugin along with the input shape.
We only need the input shape that’s why we have specified  after the function call.
exec_netfunction will start an asynchronous inference request.
We need to pass request-id and input frame for inference.
res = infer_network.get_output(cur_request_id)
for obj in res:
if obj > args.prob_threshold:
xmin = int(obj * initial_w)
ymin = int(obj * initial_h)
xmax = int(obj * initial_w)
ymax = int(obj * initial_h)
class_id = int(obj)
get_output the function will give us the model’s result.
You can clone the git repo and start making your hands dirty. Happy coding!
Introduction to Intel® Distribution of OpenVINO™ toolkit for Computer Vision Applications |…
The Intel® Developer Zone offers tools and how-to information to enable cross-platform app development through platform…www.coursera.org