Computer Vision & Image Classification in AI

Instructor: Enda Folan

Enda has taught computer science and programming at college and has a BSc in computer science.

This lesson will focus on what constitutes computer vision and image classification and how deep learning with neural networks allows us to achieve these goals.

What is Computer Vision?

Have you ever found yourself looking at some object (like a pen) and tried to figure out how a stream of light reflected back to your eyes results in recognition? We know our brain has to do a lot of work just to decide that the pen is not, in fact, a twig or a straw, what color it is or how big it is, but we don't have to be conscious of how exactly it manages to do this.

Now imagine giving a computer a webcam and expecting it to do the same type of task. It may seem impossible, but that's the problem computer vision in AI tackles. If you try to break down how your brain accomplishes this you can start piecing together the methods required to teach a computer how to recognize images.

How Computer Vision Works

While the human brain converts light to electrical impulses, a computer with a webcam will convert light into binary representations of pixels on a screen. Since computers are good at crunching numbers, it becomes possible to perform an analysis of this image. Since each pixel is represented, the color of various parts of the image is identifiable. It is possible to detect areas where there is a stark contrast, such as between a red pen and a white desk. It is also possible to detect the edges of various objects in an image by analyzing these contrasts and gradients.

The key is to detect the patterns in the image that can be attributed to real-world objects. A pen tends to be a distinct shape, long and cylindrical, but they usually have more features than a straw. Pens can be bright colors or simple black or blue but they are rarely the same color as a twig. Can you see how it's starting to seem possible that we could teach a computer or Artificial Intelligence (AI) how, given a picture of a pen, it could make a reasonable guess as to what the picture is of?

Deep Learning

Now that we know the kinds of analysis that are useful in image classification, we can look at how they are applied to a topic called deep learning. Deep learning can be thought of as a type of machine learning where, instead of a human telling the computer how to recognize a pen and letting it get good at the task, you give the computer pictures of pens and let it figure out how best to recognize them from the features it learns.


A key part of deep learning involves layers. Layers are where the deep part of deep learning starts to make sense. In a deep learning image classification model, an image will be passed down through several layers, each layer manipulating the image data in a way that allows features to be identified then passing output to the next layer. The final layer outputs the prediction.

These layers form the basis of what is known as a neural network. Think of the connections between the many layers of a deep learning model as the connections the neurons in your brain make. Each connection represents a small amount of processing that allows a final decision to be made.

Deep learning mirrors the way the human brain takes input and reduces it to focus on key features. When searching for an item on your desk your brain disregards the desk surface itself and focuses on the items on the desk. In a deep learning model, there may be a layer which effectively does the same thing by manipulating an image so that only the items that stand out are passed to the next layer.


Now, we have our AI that can run analyses on images, and we have a picture of a pen. The next thing we need to do is train the AI to recognize the features of a pen in such a way that it can reliably identify whether or not a photo features a pen.

You had to learn what a pen was and had to reinforce that knowledge every time you wanted to write something down. You learned that some pens have caps, some click, and some have fountain tips. Now, you are very probably good at recognizing pens. AI can take an image and pass it through several layers of transformation and analysis but it still has no idea of the features it's looking for. It needs to be trained.

Training is the process of feeding an AI thousands of images featuring pens of different shapes, sizes, and colors, also pens on different backgrounds, clipped to a pocket or held in hand. Over thousands of images, the deep learning model will notice and file patterns that are consistent with all the pen images it has seen. Patterns like that cylindrical shape, the cap or the point will be made distinctive and recognizable as the images are passed down through the layers of the model.

Classifying Objects

Now that we have an AI that is trained to recognize pens, we can start to feed it pictures it hasn't seen before and let it tell us whether or not it detects a pen. In doing so, the AI can take the image and compare it to all the images it has trained with, searching for those patterns it knows usually signal the presence of a pen. One nice thing about an image classification AI that functions reasonably well is that every new image it successfully recognizes can be added to its training database of images. This means that over time an image classification AI can improve.

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account