The AI Comic: Z.A.I.N – Issue #1: Automating Attendance using Computer Vision

  About Z.

A.

I.

N.

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.

div#n2-ss-2{width:1200px;float:left;margin:0px 0px 0px 0px;}html[dir=”rtl”] div#n2-ss-2{float:right;}div#n2-ss-2 .

n2-ss-slider-1{position:relative;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;height:1600px;border-style:solid;border-width:0px;border-color:#3e3e3e;border-color:RGBA(62,62,62,1);border-radius:0px;background-clip:padding-box;background-repeat:repeat;background-position:50% 50%;background-size:cover;background-attachment:scroll;}div#n2-ss-2 .

n2-ss-slider-background-video-container{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;}div#n2-ss-2 .

n2-ss-slider-2{position:relative;width:100%;height:100%;}.

x-firefox div#n2-ss-2 .

n2-ss-slider-2{opacity:0.

99999;}div#n2-ss-2 .

n2-ss-slider-3{position:relative;width:100%;height:100%;overflow:hidden;outline:1px solid rgba(0,0,0,0);z-index:10;}div#n2-ss-2 .

n2-ss-slide-backgrounds,div#n2-ss-2 .

n2-ss-slider-3 > .

n-particles-js-canvas-el,div#n2-ss-2 .

n2-ss-slider-3 > .

n2-ss-divider{position:absolute;left:0;top:0;width:100%;height:100%;}div#n2-ss-2 .

n2-ss-slide-backgrounds{z-index:10;}div#n2-ss-2 .

n2-ss-slider-3 > .

n-particles-js-canvas-el{z-index:12;}div#n2-ss-2 .

n2-ss-slide-backgrounds > *{overflow:hidden;}div#n2-ss-2 .

n2-ss-slide{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20;display:block;-webkit-backface-visibility:hidden;}div#n2-ss-2 .

n2-ss-layers-container{position:relative;width:1200px;height:1600px;}div#n2-ss-2 .

n2-ss-parallax-clip > .

n2-ss-layers-container{position:absolute;right:0;}div#n2-ss-2 .

n2-ss-slide{perspective:1500px;}div#n2-ss-2[data-ie] .

n2-ss-slide{perspective:none;transform:perspective(1500px);}div#n2-ss-2 .

n2-ss-slide-active{z-index:21;}div#n2-ss-2 .

nextend-arrow{cursor:pointer;overflow:hidden;line-height:0 !important;z-index:20;}div#n2-ss-2 .

nextend-arrow img{position:relative;min-height:0;min-width:0;vertical-align:top;width:auto;height:auto;max-width:100%;max-height:100%;display:inline;}div#n2-ss-2 .

nextend-arrow img.

n2-arrow-hover-img{display:none;}div#n2-ss-2 .

nextend-arrow:HOVER img.

n2-arrow-hover-img{display:inline;}div#n2-ss-2 .

nextend-arrow:HOVER img.

n2-arrow-normal-img{display:none;}div#n2-ss-2 .

nextend-arrow-animated{overflow:hidden;}div#n2-ss-2 .

nextend-arrow-animated > div{position:relative;}div#n2-ss-2 .

nextend-arrow-animated .

n2-active{position:absolute;}div#n2-ss-2 .

nextend-arrow-animated-fade{transition:background 0.

3s, opacity 0.

4s;}div#n2-ss-2 .

nextend-arrow-animated-horizontal > div{transition:all 0.

4s;left:0;}div#n2-ss-2 .

nextend-arrow-animated-horizontal .

n2-active{top:0;}div#n2-ss-2 .

nextend-arrow-previous.

nextend-arrow-animated-horizontal:HOVER > div,div#n2-ss-2 .

nextend-arrow-next.

nextend-arrow-animated-horizontal .

n2-active{left:-100%;}div#n2-ss-2 .

nextend-arrow-previous.

nextend-arrow-animated-horizontal .

n2-active,div#n2-ss-2 .

nextend-arrow-next.

nextend-arrow-animated-horizontal:HOVER > div{left:100%;}div#n2-ss-2 .

nextend-arrow.

nextend-arrow-animated-horizontal:HOVER .

n2-active{left:0;}div#n2-ss-2 .

nextend-arrow-animated-vertical > div{transition:all 0.

4s;top:0;}div#n2-ss-2 .

nextend-arrow-animated-vertical .

n2-active{left:0;}div#n2-ss-2 .

nextend-arrow-animated-vertical .

n2-active{top:-100%;}div#n2-ss-2 .

nextend-arrow-animated-vertical:HOVER > div{top:100%;}div#n2-ss-2 .

nextend-arrow-animated-vertical:HOVER .

n2-active{top:0;}div#n2-ss-2 .

n2-style-7483fd4ddc966823f703a886978b4a45-heading{background: #000000;background: RGBA(0,0,0,0.

67);opacity:1;padding:2px 2px 2px 2px ;box-shadow: none;border-width: 0px;border-style: solid;border-color: #000000; border-color: RGBA(0,0,0,1);border-radius:3px;}div#n2-ss-2 .

n2-style-7483fd4ddc966823f703a886978b4a45-heading:Hover, div#n2-ss-2 .

n2-style-7483fd4ddc966823f703a886978b4a45-heading:ACTIVE, div#n2-ss-2 .

n2-style-7483fd4ddc966823f703a886978b4a45-heading:FOCUS{background: #01add3;background: RGBA(1,173,211,0.

85);} You can download the full comic here!.  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 ‘: View the code on Gist.

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: View the code on Gist.

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: View the code on Gist.

Awesome!.We have successfully built the automated attendance system using computer vision!.The adventures of Z.

A.

I.

N have only just begun.

  End Notes 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 Vidhyas Android APP Share this:Click to share on LinkedIn (Opens in new window)Click to share on Facebook (Opens in new window)Click to share on Twitter (Opens in new window)Click to share on Pocket (Opens in new window)Click to share on Reddit (Opens in new window) Related Articles (adsbygoogle = window.

adsbygoogle || []).

push({});.. More details

Leave a Reply