Project 4: Undercover Detective

projectImage

After years of development, face recognition technology has begun to roll out. For example, when entering the railway station, the ID card information is compared through the camera. And the face scan clock in/out at work, the face scan payment by Alipay, the face-to-unlock on the smart phone, etc.

Face recognition technology has also been effectively applied in the field of public security, such as arresting fugitives. In recent years, many fugitives have been successfully arrested many times in singing stars’ concerts. Using AI face recognition technology, when a fugitive passes through security check, the camera captures the face information of the fugitive and compares it with the back-end database, then the system will issue a warning message.

HuskyLens has a built-in face recognition function. Can Maqueen Plus combine with HuskyLens to catch bad guys? In real life, bad guys often have to take the initiative to go to places with face recognition before they can be identified and caught. So how can bad guys be caught at those places without face recognition cameras?

Function Description:

This project uses HuskyLens face recognition function to make Maqueen Plus become an undercover detective in the folk. At ordinary times, it can move freely and has basic obstacle avoidance function. Through face recognition, the face in the screen is compared with the back-end database, and an alarm will be triggered once bad guy is found.

Materials Checklist:

projectImage

Knowledge Extension:

The human face, like other biological features of the human body (the fingerprint, the iris, etc.), is born with uniqueness and is not easy to be duplicated. Face images belong to the earliest category of images studied and are also the most widely used in the field of computer vision. This project uses HuskyLens face recognition function.

I. What is Face Recognition?

Face recognition is a kind of biometric identification technology based on human facial feature information. By collecting images or videos containing human faces with image camera or video camera, automatically detecting image information and tracking human faces, a series of technical analysis on the detected human faces is performed.

projectImage

II. The Working Principle of Face Recognition

There are four key steps in the process of face recognition:

projectImage

The following is a brief description of these 4 steps.

Face Detection:Find the location of face in the picture, usually marked with a bounding box.

projectImage

Face Alignment: Identify faces from different angles by locating feature points on the face.

projectImage

Face Encoding: It can be simply understood as extracting face information and converting it into information understandable by computers.

projectImage

Face Comparison: Compare the face information to the existing database to obtain a similarity score and give comparison result.

projectImage

Face recognition is also considered to be one of the most difficult research topics in the field of biometric recognition or even artificial intelligence area. The difficulty of face recognition is mainly attributed to the characteristics of human face as a biological feature.

Similarity: There is little difference between each individual. The structure of all human faces is similar, even the structure and appearance of human face organs are very similar. This feature is beneficial to locate human face, but unbeneficial to distinguish human individual by human face.

Changeability: The appearance of a human face is unstable. People can produce many expressions through changes in the face, and the visual images of the face vary greatly in different observation angles. In addition, face recognition is also influenced by various factors including lighting conditions (such as day and night, indoor and outdoor, etc.), covers on the face (such as masks, sunglasses, hair, beard, etc.), age, etc.

III. Face Recognition Application Scenarios

Access Control System: Areas under security protection can identify the identity of those trying to enter through face recognition, such as prisons, detention centers, residential areas, schools, etc.

Video Surveillance System: Monitoring crowds in public places such as banks, airports, stadiums, shopping malls, supermarkets, etc. to achieve the purpose of identification. For example, monitoring system is installed in airport to prevent terrorists from boarding planes.

Network Application: Using face recognition to assist credit card online payment to prevent non-credit card owners from using credit cards or to prevent false claim of social insurance, etc.

Face recognition is widely used in all walks of life at present, such as student attendance system, camera, unlocking mobile phone, and all-in-one person authentication system.

projectImage

IV. Demonstration of HuskyLens Face Recognition Function

1. Select the "Face Recognition" Function

Dial the function button to the left until the word "Face Recognition" is displayed at the top of the screen.

projectImage
2. Face Learning

Point the HuskyLens at area with faces. When a face is detected, it will be automatically selected by white bounding box on the screen, with word "Face" above.

projectImage

Point the “+” symbol at a face, short press the "learning button" to learn the face. If the same face is detected by HuskyLens, a blue box with words "Face: ID1" will be displayed on the screen,which indicates that HuskyLens has learned the face before and can recognize it now.

projectImage

* Keep pressing the "learning button", a face from different angles can be learnt.

* If there is no “+” symbol in the center of the screen before learning, it means that the HuskyLens has already learned the face in the current function. At this time, short press the "learning button", the screen will display "click again to forget". Before the countdown ends, short press the "learning button" again to delete the learned face information

Project Practice:

How is HuskyLens face recognition used? How to implement obstacle avoidance running of Maqueen Plus? How to detect bad guy? Let's break down the whole project into several small tasks and complete the undercover detective task step by step.

This project will be completed in three steps. Firstly, learn to use HuskyLens face recognition function and display the corresponding face ID on the screen of the mainboard. Then learn how to implement obstacle avoidance running of Maqueen Plus. Finally, improve the whole project by allowing Maqueen Plus to run while avoiding obstacles and detecting bad guy. If bad guy is found, an alarm will be triggered.

Task 1: Get to Know Face Recognition

1.Program Design

STEP 1 Learning and Recognition

Here you can choose a few face pictures at will and let HuskyLens learn. (Note: First switch to "learn multiple" function)

projectImage

STEP 2 Instruction Learning

Let's take a look at some of the main instructions.

①Get how many targets have been learned under the current algorithm from the requested "result". Please note that whether to learn multiple targets can be set from HuskyLens by long press the function button to enter the parameter setting.

projectImage

STEP 3 Function Analysis

Assuming there are only 3 facial information, the program is easy to implement. As shown in the following picture, only need to judge one by one.

projectImage

However, when there are 5, 10 or more faces learned, how can they be implemented by programs?

Judging one by one is rather wordy. Have you found any patterns from the above program?

In fact, as long as adding one variable, the parts with high repeatability in the above program can be simplified. The program is as follows, so that no matter how many IDs have been learned, they can be judged one by one.

projectImage

STEP 4 Flow Chart Analysis

Optimize the function of the program, when there is no learned faces detected, the LED screen displays smiling face, and when there is a learned face, its ID is displayed.

The analysis of the program flow chart is as follows. The logic may be a little bit complicated. You can use the flow chart to sort out the program logic, or you can use the program to understand the method of realizing the function of the flow chart.

projectImage

2.Program Example

projectImage

3.Execution Result

projectImage

Task 2: Obstacles Avoidance Running

1. Program Design

STEP 1 Function Analysis

Maqueen Plus, as an undercover detective in folk, needs to have a basic function of independent driving. How to deal with obstacles? How to avoid obstacles automatically?

You might think of cameras to be used to avoid obstacles. In fact, the basic obstacle avoidance function doesn't need a camera at all, and the Maqueen Plus can handle it by itself. Let's have a look!

Maqueen Plus motor has its own encoder, with which the motor speed can be read in real time. When the car encounters obstacles during driving, the car is forced to stop and the motor speed is close to 0.Therefore, the motor speed can be read to determine whether it meets obstacles. If it meets obstacles, the car will implement some obstacle avoidance actions, such as retreating and then veering.

STEP 2 Instruction Learning

Let's take a look at some of the main instructions.

①Read the current motor speed and select the left or right motor.

projectImage

STEP 3 Test Program

Output motor speed through serial port. Take the left motor as an example. Test program:

projectImage

Test results: The serial port area shows the speed of the left motor. Give the left wheel a little resistance by hand, and the motor speed can be obviously reduced.

* when you look at the speed, you will find that the speed read by the motor has a certain deviation from the speed set by the program, which is related to the battery power and the friction force on the wheels. Do you still remember the PID control learned in the last project? In fact, PID is to adjust the speed in real time through the algorithm after reading the motor speed through the encoder, so that the motor speed is as close to the set speed as possible.

projectImage

2. Program Examples

projectImage

3. Execution Result

projectImage

Maqueen Plus will automatically avoid obstacles and run. When encountering obstacles, Maqueen Plus will retreat and change direction to avoid obstacles.

* When the program is started, since the motor speed does not immediately increase, the obstacle avoidance action will be executed first. This only happened when it was just started.

Task 3: Alert if meeting with a bad person

1. Program Design

STEP 1 Function Analysis

In task 1 we implemented the function of face recognition, and in task 2 we implemented the function of obstacle avoidance. Combining the two functions and it is what we want for the undercover detective!

When HuskyLens did not recognize the designated face, Maqueen Plus kept avoiding obstacles. When the designated face is recognized, Maqueen Plus stops moving, triggers an alarm in situ, and displays the recognized face ID on the screen of the main board.

STEP 2 Flow Chart Analysis

In order to keep the program running continuously, after the face is recognized, if the face is no longer in the picture, press the A key on the main control board to restart the program. The flow chart is as follows:

projectImage
2. Program Examples

The function "Avoid Obstacles" remains unchanged, and the main program is modified. The complete program is as follows.

projectImage
3. Execution Result

First, let HuskyLens learn multiple faces by face recognition function. When running the program, place Maqueen Plus at any position and the car will automatically avoid obstacles.

If HuskyLens sees the learned face during driving, the car stops moving, triggers an alarm, and the screen of the mainboard displays the corresponding face ID. After that, when there is no learned face detected by HuskyLens, the screen of the mainboard displays A, indicating that pressing the A button can restart Maqueen Plus and continuing to search for bad guys!

Project summary:

Project review

Understand the working principle of face recognition in this lesson, and learn the operation method of face recognition by using HuskyLens.

HuskyLens combining with Maqueen Plus motor encoder makes Maqueen Plus become an undercover detective, and can constantly recognize the collect facial information while executing obstacles avoidance driving.

Knowledge Nodes Recap

1.Understand the working principle of face recognition;

2.Learn the operation method of the face recognition function of HuskyLens;

3.Learn the function of Maqueen Plus motor encoder.

Project Extension:

In this project, our detective Maqueen Plus can find the bad guy hidden in the crowd, but can we automatically follow the bad guy after capturing them, making bad guys have nowhere to escape under AI face recognition system!

If you think tracing is difficult, we will talk about how to track them in the next project. Let's continue to learn together.

License
All Rights
Reserved
licensBg
0