Computer vision is a field that has enabled machines not just to be able to look at an image but also to view it and figure out what that image contains with a remarkable level of accuracy. As you can imagine, this is one of the hardest things for a machine to do, and it has been made possible, after numerous failed attempts, because of a rapid increase in the performance of our processors and several advances made in the field of Artificial Intelligence.
However, it can be hard to wrap our heads around questions like what is computer vision? Where is it used? How does it work under the hood? And so on. Keeping that in mind, we have come up with this blog on computer vision tutorial for beginners to help demystify computer vision as a field and help you get started with it.
Here are some of the computer vision topics that we will cover:
Check out this Python Computer Vision video designed to help you better understand and implement face recognition using Python:
Why Computer Vision?
We have already discussed that computer vision helps us solve some of the most difficult problems there are in computer science related to real-time processing and understanding of visual information such as an image, a video stream, etc. These problems were hard to solve in the past because we did not, at that time, have the processing power required to process such data at a fast enough speed. Also, we did not have any way for our machines to be able to understand what a particular object looked like and what it should be called.
Because of these issues, even though our machines were becoming quite good at tasks such as loading, transferring, and displaying data in visual formats like videos and images, we were not able to build systems that could understand this kind of data in any meaningful way. Tasks such as figuring out the text contained in an image or being able to recognize a number in an image looked simple but were quite hard practically. Even a simple task like detecting the presence of human faces in a photo or a video was very hard to accomplish and was done after a lot of research and failed attempts.
Giving machines the ability to understand these kinds of visual images has become even more important in today’s digital age, where everyone has access to the Internet and can put any content on any of the online social media platforms. For example, if someone tries to put some false information in a textual format on any of these platforms, then most of these platforms are smart enough to either tag it as unverified or even remove it. However, if the same information is put online as an image or a video, then these systems, without computer vision, would not be able to understand its content and would, therefore, have to publish it until someone reports it.
To learn more about Machine Learning libraries, check out our blog on Machine Learning with Python Tutorial.
What is Computer Vision?
As we discussed above, computers have always found it hard to analyze, process, and gain knowledge from visual data sources, such as an image or a video. Computer vision is a field of science that tries to solve this problem by using high processing power combined with new and more efficient methods developed in Artificial Intelligence and Machine Learning. Using these tools and technologies, we can help machines gain a high-level understanding of these data sources. It also enables them to learn from already existing data sources such as photo albums, video reels, etc.
Computer vision makes heavy use of Machine Learning algorithms to learn about how to identify and label objects in images and videos. Computer vision relies heavily on neural networks, especially deep neural networks in Deep Learning. These Deep Learning systems use some common neural network architectures such as CNNs (convolutional neural networks), RNNs (recurrent neural networks), etc. These specific types of neural networks are good at certain tasks. For example, CNNs are good at processing and understanding images, but they are not good at understanding videos. Whereas, RNNs are good at processing and understanding videos as they can process images with temporal (time-related) data.
Evolution of Computer Vision
There are several computer vision components involved in making computer vision what it is today. Deep Learning is a big factor that has made computer vision so useful. But, even before Deep Learning came into being, computer vision was in use. However, it was not very powerful and required manually coding a lot of rules so that an application can derive some insights out of images. This technique involved a few steps:
Creating a Database
In this step, we try to capture a lot of images of objects we wish for our application or model to be able to process. For example, if we are building a facial recognition system, then we would capture images of human faces.
From all the images that we stored in our database, we need to get measurements of some crucial features, such as the distance between eyes, the length of the nose bridge, the width of lips, etc. These measurements are the unique characteristics that help us identify the face in each image. Using these, we will be able to build a simple model that can perform the task of facial recognition.
Adding New Images
After annotating images, we need to add more of them, either from photographs or from videos. We would have to annotate these images by going through the same measurement process and capturing all the features of the new data that we have gathered. This process needs to be repeated multiple times so that our database can grow large enough for our system to be able to extract some meaningful insights out of it.
After all this tedious and manual work of capturing images, annotating them, and repeating the previous steps to build a large database of images annotated with their features, now we need to analyze the acquired data, figure out the rules that can reasonably classify our data, and then write code so that these rules that we have come up with after so much work can be used in our system. Even after all this manual work, our systems would still perform with a good level of accuracy, but the error margin was high. These problems persisted for a long time and stagnated the capabilities of computer vision in Machine Learning.
Then, because of massive improvements in the processing speed of machines, Machine Learning became viable and provided a much better and simpler approach to computer vision. Using Machine Learning, we need not have to analyze images, figure out classification rules, and code them up into an application. Instead, we can use Machine Learning algorithms that will try and find smaller features and specific patterns that help the model classify an image. These algorithms use various statistical methods to extract useful features automatically. There are several Machine Learning algorithms available for these tasks, such as logistic regression, decision trees, random forest, support vector machine (SVM), etc.
Many problems that were considered historically challenging for computer applications to solve were solved quite easily by Machine Learning. Problems such as playing chess, reading text from an image, transcribing audio to text, finding and locating objects in images, etc. were solved by Machine Learning and not by traditional programming techniques. This was because in traditional programming developers needed to write code that contains rules, which can map an input to the output. However, in Machine Learning, we feed the algorithm with a lot of data, which contains input and the output it maps to. Therefore, the algorithm figures out the rules that it needs to map the inputs to their corresponding outputs.
One of these Machine Learning techniques, which has helped computer vision a lot, is Deep Learning. In Deep Learning, we have heavy use of neural networks, especially deep neural networks. These are neural networks that have many hidden layers that are deeply connected. These deep neural networks are good at extracting information out of an image or a video. In most cases, for creating well-performing models, we need access to a good dataset. The images need to be of good quality, and the labels should be consistent as well. If the dataset is not good, then the model might perform with poor accuracy. Another thing that might affect the performance of the Machine Learning model is the parameters that we use while training our model. When building a neural network, we need to take care of the parameters such as the number of training iterations called epochs, the number of neurons in each layer, the number of layers in a network, etc.
These developments in the ways of solving such problems and creating more optimized versions of available solutions are continuing as Machine Learning, more specifically Deep Learning. There are even pre-built models available for us to use either for free or for a small price. Companies, including Google, Amazon, etc., have invested heavily in building such models using state-of-the-art processors, algorithms, and huge datasets, and by using these models, they are offering a huge number of services, especially for computer vision such as Google Cloud’s Vision API and Amazon’s Rekognition service. These services provide users with the capabilities to incorporate computer vision in applications they build without having to invest in all the steps we have mentioned so far.
Check out this Data Science course in collaboration with IIT Madras and become a certified Data Scientist.
Computer Vision and Image Processing
Computer vision is quite a different field from image processing, and these two things should not be considered as being similar. Digital image processing is the process of creating new images from an existing image. The new images are created using special algorithms designed for achieving a specific output from an image. This includes tasks such as creating a black and white version of an image, removing noise from an image, etc. This is similar to digital signal processing. In other words, digital image processing is used for the generation of new images and does not in any way try to understand the content of an image, i.e., it has no idea what object an image contains. It only knows how to convert it from one form to another.
Computer vision, on the other hand, is used for understanding the content of an image or a video. It deals with extracting useful information out of images, e.g., if an image contains a human face, whether it was taken during the day or the night, what the objects are there in the image, etc. Computer vision does not manipulate images or create new ones in any way.
As we can see, computer vision and digital image processing are quite different from each other. However, they are quite often used with each other, which is one of the reasons they are confused as being the same or at least similar so often. Using digital image processing, we can generate a lot more images for our dataset, from which our Deep Learning model can learn. These images will contain the same objects. However, they will be different variations of the same image, such as multiple images with different levels of brightness, contrast, etc. This is done so that our model can learn from more data and better deal with images with different levels of brightness, contrast, etc.
Check out this Machine Learning Course to become a Machine Learning Engineer.
Why is Computer Vision so challenging?
As we have already seen, the tasks that computer vision enables us to perform are those that were considered to be too hard and challenging for computers to be able to solve. When we are reading about computer vision it seems very tempting to want to read about computer vision advantages and disadvantages, however the only few disadvantages that computer vision has are processing speed and it being extremely challenging. Even with computer vision, these problems are not that easily solved. We still encounter several problems when we try to build a model capable of performing a computer vision task, such as less number of images in a database from which the model is supposed to be trained, poor quality of images, poorly labeled images, less variety of images, etc.
There are also issues with the processing power needed to process these huge databases of images. The images need to be of high quality and also need to be analyzed by a deep neural network. To do this task in any reasonable amount of time, we need a lot of computing power. This kind of computing power can be used via Cloud Computing systems, especially systems such as tensor processing units or TPUs, which are built specifically for building Machine Learning models faster. They are available to be used via Cloud Computing platforms, namely, Amazon Web Services, Google Cloud Platform, Microsoft Azure, etc.
The above-mentioned problems make computer vision so challenging. Research is still being performed to make the technology even more powerful. However, some issues may persist.
Check out this Artificial Intelligence Course to become an Artificial Intelligence Engineer.
Applications of Computer Vision
Computer Vision has been incredibly useful and is being used in many applications that people use in their everyday lives. Let’s take a look at a few of these.
Self-driving cars are one of the most exciting applications of Machine Learning and computer vision. Cars driving themselves has always been one of the tasks that were deemed impossible to be solved by computer programming. This was because multiple things could go wrong in the real world, and these issues cannot be put into abstract concepts for which we can write code. However, as we know that Machine Learning takes a different approach and learns from already available data, we do not need to provide any rules for the machine to follow as it figures those rules out automatically.
Companies such as Google and Tesla are making heavy use of these technologies to improve the capabilities of their self-driving car models. In Tesla, the self-driving feature is already available to be used.
Facial recognition is another good use case of computer vision. Computer vision uses Deep Learning neural networks that can extract common features from multiple images and then learn how to identify and differentiate one image from the other. Facial recognition is a feature available in many systems. Nowadays, even smartphones have this feature. This has been made possible by computer vision.
Computer vision has been a major part of the success of several advanced healthcare systems that are used for several medical purposes. These purposes include analyzing the results of a patient’s tests and figuring out if the patient has cancer, looking at MRI scans of a person’s brain and figuring out if a person has brain damage, looking at an image of a person’s vital organs, like kidney or heart, and figuring out if they have any abnormality, etc. In many cases, these systems are found to be more accurate than a doctor’s opinion. However, these systems are rarely used on their own. They are used to assist a qualified doctor to make more informed decisions.
As you can see, computer vision is quite a vast field with its own set of rules and challenges. Because of the immense scope of the applications of computer vision, computer vision jobs are one of the most sought-after skills in today’s job market. It is also one of the most popular research topics. We hope this blog has cleared your doubts on computer vision and has whetted your appetite for learning more about it.