|From Deep Learning for Vision Systems by Mohamed Elgendy
In this article, we’ll zoom in on the interpreting device component (of a computer vision system) to take a look at the pipeline it uses to process and understand images.
Are you ready to start exploring computer vision systems? Let’s dig right in! Vision systems are composed of two main components: 1) a sensing device and 2) an interpreting device.
Applications of computer vision vary, but a typical vision system uses a similar sequence of distinct steps to process and analyze image data. These are referred to as a vision pipeline. Many vision applications start off by acquiring images and data, then processing that data, performing some analysis and recognition steps, and finally make a prediction based on the extracted information.
Let’s apply the above pipeline on an image classifier example. Suppose we have an image of a motorcycle, and we want the model to predict the probability of the object from the following classes: car, motorcycle, and dog.
Image classifier is an algorithm that takes in an image as input and outputs a label or “class” which identifies that image.
A class in machine learning is the output category of your data. You can call these categories as well.
Here’s how the image flows through the classification pipeline:
- First, a computer receives visual input from an imaging device like a camera. This is typically captured as an image or a sequence of images forming a video.
- Each image is sent through some pre-processing steps whose purpose is to standardize each image. Common preprocessing steps include resizing an image, blurring, rotating, change its shape or transforming the image from one color to another—like from color to grayscale. Only by standardizing each image, for example: making them the same size, can you then compare them and further analyze them in the same way.
- Next, we extract features. Features are what help us define certain objects, and they’re usually information about object shape or color. For example, some features that distinguish the shape of a motorcycle’s wheel, headlights, mudguards, and so on. The output of this process is a features vector, which is a list of unique shapes that identify the object.
- Finally, these features are fed into a classification model! This step looks at the features vector from the previous step and predicts the class of the image. Pretend that you’re the classifier model and let’s go through the classification process: You look at the list of features in the vector feature one-by-one and try to divine what’s in the image.
- First, you see a feature of a wheel—could this be a car, motorcycle or a dog? Clearly it isn’t a dog because dogs don’t have wheels (at least normal dogs, not robots!). Then, this could be an image of a car or a motorcycle
- Then you move on to the next feature “the headlights.” It’s a higher probability that this is a motorcycle than a usual car
- The next feature is “rear mudguard.” Again, there’s a higher probability it’s a motorcycle
- The object has only two wheels, hmm, this is closer to a motorcycle
- And you keep going through all the features like the body shape, pedal, etc. until you have created a better guess of the object in the image
The output of this process is the probabilities of each class. As you can see in the above example, the dog has the lowest probability of 1% whereas there’s an 85% probability that this is a motorcycle. You can see that, although the model was able to predict the right class with high probability, it’s still a little confused in distinguishing between cars and motorcycles because it predicted that there’s a 14% chance this is an image of a car. Because we know that it’s a motorcycle, then we can say that our ML classification algorithm is 85% accurate. Not too bad! To improve this accuracy, we may need to do more of step 1 (acquire more training images) or step 2 (more processing to remove noise) or step 3 (extract better features) or step 4 (change the classifier algorithm and tune some hyperparameters or even more training time). Many different approaches can improve the performance of our model. They all lie in one or more of the pipeline steps. And this is what we’ll be working on in this article.
That was the big picture of how images flow through the computer vision pipeline. In the next section, we will dive one level deeper into each one of the pipeline steps:
- Input image
- Image preprocessing
- Feature extraction