GETTING STARTED
ROBOTICS
TAKING LEARNING TO THE REAL WORLD
CAPSTONE PROJECT

ACTIVITY: Making a Face Recognition System

Making a Face Recognition System – Overview

You must have seen your parents or neighbour or at least someone unlocking their Smartphone by simply looking at it. Ever thought about the magic behind it? How does it recognize them?

The answer is face recognition.

Face recognition technology is a super interesting and useful application of artificial intelligence that makes lots of things easy for us. Let us have a look how.

What is Face Recognition?

Face recognition is an extremely useful application of artificial intelligence that can identify an individual from an image or from a video by analyzing their facial patterns and textures.

Face recognition systems first detect a face and then match it with the data of the faces stored in a database.

Face recognition has a lot of applications in daily life such as Smartphones, security systems, social media platforms, and healthcare.

In this lesson, we’re going to use face recognition to make our very own robo-pet! But first, let’s understand how to set up a face recognition system.

Understanding the Logic

To make our face recognition system, we’ll first have to train PictoBlox to recognize us. We’ll do it by clicking a picture of our face and then saving it. Once we’ve trained it, it will be able to recognize us whenever we come in front of the camera.

Sounds cool, right? Now, let’s make our own face recognition system!

Let’s Code!

First, let’s train PictoBlox to detect your face. 

Storing the Face into the System

Let’s begin by writing the script to feed our face into the memory.

  1. Open a new project in PictoBlox.
  2. Place when () key pressed block from the Events palette, and choose up-arrowfrom the drop-down.
  3. Now, we need Tobi to instruct the user to look into the camera.
  4. Thus, place a say () block from the Looks palette, and write “Please look into the camera” in the space given.
  5. To make Tobi say it out loud, place speak () block from the text-to-speech palette and write the same in it.
  6. Now, we need to turn the cameras on, thus from the Artificial Intelligence palette, place the turn () video on stage with () % transparency block.
  7. We need the camera to analyze, thus add a wait () seconds block from the Controls palette and write 3 in the space given.
  8. Duplicate the pair of say () and speak () block and write Analysing in both the spaces given.
  9. We will add the user image as the class. Thus, place add class () as () from the () block and write the name into the space given.
  10. Next, we want Tobi to assure the user that the face was stored. Thus, again use the say () and speak () block for the same and write Face in both the space given.
  11. After the face is stored, we need to turn the camera off, thus from the Artificial Intelligence palette, place the turn () video on stage with () % transparency block and choose off from the drop-down.
  12. Finally, set the position of Tobi, thus add a go to x () y () block from the Motions palette and set x as -200 and y as -120. 

Find the complete script below.Storing the Face

Matching the Face with the Stored Face

Let’s make the script to match the face with the one stored in the system.

  1. Place a when flag clicked hat block from the Events palette into the scripting area.
  2. Let us make Tobi guide the user to look into the camera, thus place the say () and the speak () block and write “Please look into the camera” in both the spaces given.
  3. Now, let’s turn the camera ON. Thus, place the turn () video on stage with () % transparency block.
  4. We need the camera to analyze, thus add a wait () seconds block from the Controls palette and write 3 in the space given.
  5. Duplicate the pair of say () and speak () block and write Analysing in both the spaces given.
  6. Now, to match up the face with the one stored in the class, place the do face matching on () block from the Face Detection palette and select camera from the drop-down.
  7. Now, if the face is matched, we need Tobi to say that the face matched. Thus, place an if-else block from the Events palette.
  8. Place is () class detected from the Face Detection palette.
  9. Now, to make the Tobi say that the ‘Face Matched!’, place a pair of say () and speak () block and write Face matched! In both the spaces given.
  10. Now, what if the faces do not match. We’ll make Tobi say that the ‘Face dint match’.
  11. Thus, into the else arm place say () and speak () block and write “Face didn’t match.” in both the spaces.

With this, our face recognition system is ready! Have fun testing it.Macthing the face

Now you can store any face by pressing the up-arrow key and then match it using the green flag. Using these scripts, we’re going to make our robo-pet. Let’s get to it straight away!

×
×

Cart