“Sound does not travel in a vaccum.“
The above concept might just be a simple fact for you – but I had a tough time learning this in the manner it was taught in one of my classes. I actually learnt it when this was implemented in a comic and one of the Super Heroes I followed used this to solve an otherwise difficult challenge.
I have been in awe with the power of comics to help us understand concepts in a simple and visual manner. The ebb and flow of stories, the build up and the climax usually hold up people like me for hours.
Now, think of a technical article. Do you remember a blog you read about a specific technique from a few months back? I’d guess you don’t. I certainly don’t!
That’s why we at Analytics Vidhya came up with the idea of the world’s first Artificial Intelligence (AI) comic! We believe comics are an awesome way of learning a concept through interactive storytelling. Simply put, it’s a brilliant way to learn complex data science topics.
With this AI comic series, I aim to bring out my imagination for the benefit of millions of kids and friends. I aim to help them understand how AI & ML will change our world. And I hope, a few years down the line, they remember Z.A.I.N as the super hero who helped them understand the super power of machines!
We will combine advanced blog content and code on machine learning and AI with the storytelling style of a comic. Are you ready to dive into the world of AI comics? Let’s begin – and welcome to issue #1!
Issue #2 of AI-COMIC: Z.A.I.N (Keep Calm and Optimise) is out now!check it out here
Z.A.I.N. is the first issue of Analytics Vidhya’s Artificial Intelligence (AI) comic series that successfully merges technical and complex Artificial Intelligence implementations with the fun of reading comic books.
The comic book series combines both of these elements:
- An intriguing storyline along with a daily life implementation of AI
- Technical AI content, including fully functional code implementation in Python and a whole lot more!
Here’s Kunal Jain, Analytics Vidhya’s Founder and CEO, along with me, to give you a glimpse into this AI comic series:
Indulge in the World of Comics through Z.A.I.N
Here is all you need to know about the chief character of this comic book series:
Note: Use the right and left arrow keys to navigate through the below slider.
Python Code and Explanation
Had fun reading the A.I. comic? Now, let’s understand the code behind the attendance system. That’s right – we are going to implement the Python code we just saw!
We’ll be using the below libraries in this section:
- OpenCV: For detecting faces and eyes by the inbuilt eye and face cascade classifiers.
- Matplotlib: For reading and plotting both the images.
- NumPy: “Complementary” – an all-time classic library!
Next, we read the .jpg file and plot it with the matplotlib library. In this case, we are using a photo of a single face (Tony Stark) which is saved in here as ‘ TS3.jpg ‘:
After reading and plotting the image, we come to the main code block:
Here, we use Face and Eye cascade Classifiers to get the coordinates of top and bottom corners of both the face and eyes respectively. Those coordinates/points are stored in variables:
- ‘x‘, ‘y‘, ‘w‘, ‘h‘ (for face cascade)
- ‘ew‘, ‘ey‘, ‘ex‘, ‘eh‘ (for eye cascade)
Then, we use these coordinates to plot rectangles around the face and eyes. The basic thought process is to count the number of rectangles around the faces, thus counting the number of faces:
Let’s implement the same code-block on a picture of the classroom. Our aim, remember, was to count the number of faces in the class. That’s exactly how Z.A.I.N saved the day! And now it’s our turn.
The image of the classroom is saved as ‘face-detection.jpg’. You can download the image from here and follow along with the code we’ll soon see. You can even play around with an image of your choice. I strongly believe the best way to learn a concept is by experimenting!
Let’s get back to our classroom. The below code makes rectangles around most of the faces in the classroom:
Awesome! We have successfully built the automated attendance system using computer vision! The adventures of Z.A.I.N have only just begun.
This first issue of AV’s AI comic, Z.A.I.N, was the story about how computer vision can change our day-to-day lives for the better. And guess what? There are many such adventures that await him and all of us.
Issue #2 is coming soon. Grab your popcorn and get ready to partake in another awesome AI adventure because the next issue is going to take our learning to a whole new level.
Thank you for reading. Feel free to leave your thoughts, your experience, and precious feedback in the comments section below!You can also read this article on Analytics Vidhya's Android APP