Image classification using OpenCV with OpenVINO Inference Engine

The final topic that we will discuss in this chapter is how to carry out image classification using OpenCV with OpenVINO Inference Engine.

Before we jump into the details, let's have a brief look at an image classification problem. Image classification, also known as image recognition, is a part of the deep learning set of tasks and is perhaps one of the most common ones. In this task, a set of images are provided as input to the model and the model outputs the class or the label of the input images.

A common example of this is the dog and cat classification problem where a model is trained on a large number of images of cats and dogs and then, during the testing phase, the model predicts whether the input image is an image of a cat or a dog.

While this might look like a very naive problem, image classification carries a lot of importance in industrial applications. For example, if your camera boasts of having AI powers, what it means is that it can recognize the objects present in the image and change the image settings accordingly—whether it is an image of natural scenery or an Instagram-worthy snap of some food. The following image shows the output of an AI mobile phone camera:

Consider the preceding image I took of the roof of my house. Note that the camera, when switched to AI mode, was able to detect that I was taking a picture of plants and automatically changed the settings to match that. All of this is possible only because of image classification. Now, consider that you, as a computer vision engineer, are trying to train a model that can recognize whether the image is of a plant, waterfall, or human. 

All of the efforts that you put in training the model will be wasted if your model cannot infer the class or the label of the image within a few milliseconds. No user wants to wait for even a couple of seconds for the camera to detect the object and change the settings.

This brings us back to the importance of OpenVINO's Inference Engine. OpenVINO has its own version of an image classification toolkit that can be used as follows.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset