Face Recognition Access Control | Study Pack of HUSKYLENS for micro:bit 02

0 4736 Medium

Lesson 2 Face Recognition Access Control with an AI Machine Vision Sensor

 

Introduction

With the development of technology, the application of face recognition in access control has become more and more widely used. Compared with traditional keys and access control cards, face recognition access control does make face your best pass.This tutorial showcases a cutting-edge application of integrating micro:bit with HUSKYLENS to build a facial recognition AI camera as a sophisticated access control system. 

This project uses the function of AI camera HUSKYLENS to recognize multiple faces, and implements face recognition access control by performing different operations based on different recognition results. When a stranger is recognized, an alarm will sound; when a family member is recognized, the door will open automatically.

projectImage

Learning Objectives

1. Think about the drawbacks of traditional keys and access control cards

2. Learn the advantages of face recognition access control in AI vision technology

3. Use AI camera HUSKYLENS and micro:bit to make a face recognition access control

Preparation

projectImage

Learning Content

How many steps are needed to open a door with a key or access card?

projectImage

The door opening action that we are accustomed to, actually needs to be divided into 3 steps. Moreover, this situation is based on the absence of accidents such as losing the key or forgetting the key. If there is an unexpected situation, door opening needs far more than these steps.

The Disadvantages of Traditional Keys And Access Cards

1. Inconvenient to open the door when your hands are occupied

After a huge purchase on the weekend, your hands must be full of “trophies”. When standing in front of the door with your hands occupied, you have no choice but put all your “trophies” down to free your hands. Then you rummage around in your pockets and bags for your keys. Finally, you get the door open. But when seeing all your “trophies” scattered all over the place, you must feel a headache.

2. It is difficult to sort out various cards
projectImage

After staying at home for a long time, we can finally go out~. But we may find that every time we go out, we need to sort out and check the various "cards" that we need to bring, travel card, ID card, credit card, etc. With so many cards, we may worry about messing around, rummaging when using, forgetting to bring, or losing it. Life is so“hard”!

projectImage

In your daily life, do you encounter door-opening problems that make you have a headache?

The Advantages of Face Recognition Access Control

Compared with the traditional key and card access control, face recognition access control has the following advantages:

1. Easy to use

Face recognition access control achieves a non-inductive operation. Just stand in front of the door, glance at it, you will be automatically recognized, and you can get in/out then. It liberates your hands so you can open the door easily even when your hands are full of things.

2. Accurate recognition

Simply input the face, and all recognition tasks are handed over to the algorithm. No longer have to find the key corresponding to the door in a bunch of similar keys.

3. High security

What we fear most is the loss of keys and cards. Loss means that they may be used fraudulently. At the same time, the key and the door card are easy to be copied, which would be a potential safety hazard. The face recognition access control can make the door open only for you, and people without permission cannot enter.

AI machine vision sensor HUSKYLENS Face Recognition Function Demonstration

If you want to use HUSKYLENS to achieve face recognition access control, you must first let HUSKYLENS learn the faces of family members and let it know the corresponding members.

In Lesson 1, we learned that the HUSKYLENS face recognition function is set to learn and recognize only one face by default, but there must be more than one person in a family. So, it needs to be set to a state that can learn and recognize multiple faces.

1. Operating and Setting—Learn Multiple Faces

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

2. Long press the function button to enter the parameter setting of the face recognition function.

3. Dial the function button until "Learn Multiple" is displayed, then short press the function button, and dial to the right to turn on the "Learn Multiple" switch, that is, the progress bar turns blue and the square icon on the progress bar moves to the right. Then short press the function button to confirm this parameter.

projectImage

4. Dial the function button to the left until "Save & Return" shows. And the screen prompts "Do you want to save the parameters?" Select "Yes" in default, now short-press the function button to save the parameters and return automatically.

2. Learning and Detection with AI machine vision sensor

(1)Face Detection

Point the HuskyLens at any faces. When a face is detected, it will be automatically selected by a white frame with the words "Face" on the screen. Adjust the angle and distance between HUSKYLENS and the face, so that the white frame can contain the entire face as much as possible.

projectImage

(2)Face Learning

After the face is detected, press the "learning button" to learn the first face, and then release the "learning button" to end the learning. A message will be displayed on the screen: "Press again to continue, press other buttons to end". If you want to continue learning the next face, press the "learn button" before the countdown ends. If you no longer need to learn other faces, just press the "function button" before the countdown ends, or do not operate any buttons and wait for the end of the countdown. The face ID displayed by HUSKYLENS is consistent with the order of entering the face, that is: ID will be marked as "ID1", "ID2", "ID3" and so on in order, and different face IDs correspond to different color frames.

projectImage

(3)Face Recognition

When HUSKYLENS recognizes a learned face, there will be a colored frame on the screen to select the face and display the ID of the face. The size of the frame changes with the angle of the face, and the frame will automatically track the face. Multiple different faces can be recognized and tracked at the same time, and the colors of the frames corresponding to different faces are also different.

projectImage

AI Vision Project Practice

After learning the operation of AI machine vision sensor HUSKYLENS, let's complete the production of face recognition access control together!

First of all, the function to be realized is that when HUSKYLENS recognizes human faces, it can detect family members from strangers in the program terminal. The second is to add a servo, using its rotation angle to control the opening and closing of the door, so as to realize the automation of opening and closing the door. Now, we are going to complete the project of face recognition access control in two tasks.

Task1: Face Distinguishing

In the beginning, we need to let HUSKYLENS recognize multiple faces, distinguish faces, and give corresponding feedback

Task2: Smart Access Control

After learning how to distinguish faces, we can add more functions on this basis. For example, when a family member is recognized, the door will be opened automatically; when a stranger is recognized, the door not only does not open, but also makes an alarm.

Task 1: Face Distinguishing

Hardware Connection
projectImage

AI Vision Program Design

Function Instruction:

Here we take it by default that the HUSKYLENS has learned the faces of family members already (for the specific learning process, please refer to the demonstration of HUSKYLENS face recognition function in this lesson), when the camera detects the faces, it will determine whether the face belongs to the family that has been learned. In order to make the recognition process more intuitive, when a "√" is displayed on the main control board, it means that the recognized face belongs to the family; when a "×" is displayed on the main control board, it means that the recognized face is a stranger.

Flowchart Analysis:
projectImage

The MakeCode Sample Program

projectImage

Makecode Sample Program link : https://makecode.microbit.org/_7YhLM1cxr2Jp

AI Vision Project Operating Effect

When HUSKYLENS detects the face belonging to the family, “√” is displayed on the micro:bit. When HUSKYLENS detects the face of a stranger, the micro:bit displays "×".

projectImage

Task 2: Smart Access Control

Connect HUSKYLENS to the I2C interface of the expansion board through the 4Pin cable as the terminal input device of the smart access control system, and then the servo should be connected to the P0 port of the expansion board according to the correct line sequence.

Hardware Connection
projectImage

AI Vision Program Design

Function Instruction:

Next, add the actuator-the servo, and simulate the process of opening and closing the door by controlling the angle of the servo.

Flowchart Analysis:
projectImage

The MakeCode Sample Program

projectImage

Makecode Sample Program link : https://makecode.microbit.org/_ETEavEUiEULA

Note: It is recommended to operate the servo within 10°-170° to avoid hardware damage.

AI Vision Project Operating Effect

When HUSKYLENS detects a face belonging to the family, it displays "√" on the dot matrix screen, opens the door, and automatically closes the door after 5 seconds. When HUSKYLENS an unlearned stranger, "×" is displayed on the dot matrix screen, and the servo does not perform any operation.

Project Review

Through the face recognition access control project, we have further understood the principle of face recognition and the operation of HUSKYLENS to learn and recognize multiple faces. Congratulations! You have achieved the remarkable feat of implementing facial recognition with the utilization of microbit.

Nowadays, face recognition systems can be seen everywhere in our lives, What problems can we solve by using HUSKYLENS's face recognition function in our daily life?

Project Development

Campus security needs to be consolidated from human defense, technical defense, and security defense. With the development of intelligent security, smart methods such as the application of face recognition systems have gradually been applied to campus security.

The application of face recognition on campus, on the one hand, can bring an intelligent experience to the teachers and students, on the other hand, it can prohibit strangers from entering and leaving at will, making our school safer.

Think about how to apply face recognition to campus management? To better save manpower and material resources, and make campus management more efficient and intelligent, which places should we put HUSKYLENS at?

License
All Rights
Reserved
licensBg
0