Super detailed | Face attendance system based on MATLAB

Super detailed | Face attendance system based on MATLAB (deep learning method)
insert image description here

With the development of information technology, big data, and artificial intelligence technology, the application of human biometrics has become more and more extensive. Biometric authentication technologies such as fingerprints, irises, and faces are widely used in people's work, study, and life. Driven a new round of information security technology reform.

In the previous series, the author introduced three methods of face recognition and their program implementation. In this paper, the face recognition method is applied to attendance management, and image acquisition and face recognition can be performed by calling the camera and static image input. And carry out data statistics, which has the characteristics of time saving, high efficiency and high accuracy, and improves classroom management and teaching management .

00 directory

1 Experimental conditions
2 System design
3 System implementation
4 Source code acquisition
5 Outlook

The background and research history of face recognition technology have been introduced in the previous article, so I won’t go into details here. The following will directly introduce the system design process.

01 Experimental conditions

The system is developed based on MATLAB. Convolutional neural networks are used for face recognition, so deep learning modules are required. For face detection, the camera needs to be used, so the following hardware support packages need to be installed
insert image description here

This installation package can be found in the additional functions
insert image description here

After installing the installation package in matlab, enter imaqhwinfo('winvideo') on the command line
insert image description here

If there is a device displayed in the red box, the installation is successful.

02 System design

2.1 System flow

insert image description here

The workflow of the attendance system based on MATLAB is as above. It is mainly composed of a camera and GUI . First, you need to enter the administrator password to enter the attendance system. You can collect images through the camera or static images. For the collected images, perform face detection and detect faces Afterwards, preprocessing will be performed, including cropping, size normalization, grayscale, and histogram equalization; and then the pre-trained convolutional neural network will be used for face recognition .

2.2 CASIA_Face database introduction

Due to the lack of a face database for attendance, a public face database is used. The CASIA-FaceV5 Asian face dataset has 500 people , 5 pictures per person, a total of 2500 pictures, and the picture size is 640*480. The data set has a total of 500 folders, and the folder name is: 000 499; a folder represents a person, and there are 5 pictures in it, and the picture name is: folder name_0.bmp folder name_4.bmp, as follows As shown in the figure, four of the photos are used as the training set, and one photo is used as the test set for training.
insert image description here
insert image description here

2.3 Face Detection

This article uses the **Viola-Jones (VJ)** algorithm for face detection. The VJ algorithm was jointly
proposed by scholars Paul Viola and Michael Jones, and has the advantage of fast positioning speed.

The VJ algorithm is mainly divided into three parts. In the first part, the method of integral image is used to quickly extract the feature information of the image; in the second part, the extracted features are classified by using the weak classifier to reduce the computational complexity; in the third part, the cascaded classifier is used for further classification to improve human Accuracy of face localization.

The Viola-Jones face detection algorithm uses Haar eigenvalues ​​for target detection: a cascade classifier is generated through the Adaboost algorithm, and the feature matching is directly performed on a small area of ​​the image to determine whether there is a human face in the area. The algorithm includes training There are two parts: the training part uses the Adaboost algorithm to extract eigenvalues ​​from the pre-collected positive and negative samples for calculation, and finally generates a cascade classifier; face detection .

About this algorithm is very good in this blog, and interested students can learn by themselves, so I won’t go into details here.
Object Detection - Viola-Jones

The call to the Viola-Jones algorithm is given in MATLAB, which is very convenient, and the accuracy of face detection is very high, so here we use the built-in Viola-Jones algorithm of MATLAB for face detection.
insert image description here

The effect of the program is as follows:
insert image description here

2.4 Image preprocessing

insert image description here

The input image is cropped according to the face coordinates determined by the Viola-Jones algorithm. Since the size of the face area cropped by different images is different, in order to facilitate the training of the convolutional neural network, it is necessary to unify the size of the cropped face image, and then , the input data dimension can be reduced by grayscale , and the influence of grayscale changes caused by illumination changes on correct recognition can also be reduced; the histogram of the image is an important statistical feature of the image, which can be considered as the grayscale density of the image function approximation. The gray histogram is a discrete function, which represents the corresponding relationship between each gray level of the digital image and the frequency of occurrence of the gray level. The basic idea of ​​histogram equalization is to change the histogram of the original image into a form of uniform distribution, which increases the dynamic range of the pixel gray value to achieve the effect of enhancing the overall contrast of the image.
insert image description here

The effect of this process is as follows:
insert image description here

2.5 Model Training

After preprocessing the images of the database, the batch of databases can be used for training. The network structure and corresponding parameters designed in this paper are as follows, and the classification training is carried out in MATLAB. The results are as follows. After the model is trained, it can be carried out. Face recognition is done.
insert image description here
insert image description here
insert image description here

Judging from the training results, the accuracy of the training set and test set of the model is not bad. Although the accuracy is not particularly high, it is relatively easy to use for secondary development and improvement.

03 System Implementation

In this paper, MATLAB GUI is used to integrate the above functions, and the following attendance system is designed:

3.1 Enter the system

Enter guide on the command line and select choose_sys.fig to enter the system.
insert image description here
insert image description here

After entering the administrator account and password, you can enter the attendance system. If you do not have an administrator account and password, you can click Register.
insert image description here

When you use it for the first time, you need to train the CNN network. Click "Train CNN". If you need to add images yourself, you can add the image data to the CASIA_Face folder. The naming rules must be the same as other files.
insert image description here

3.2 Identification

There are two recognition methods, one is static image recognition and the other is real-time camera recognition.

3.2.1 Static Image Recognition

Click "Read Static Image Recognition" to read the static image and automatically perform face detection-preprocessing-face recognition. The results are as follows:
insert image description here

As shown in the figure, the GUI will display the original image, the cropped face image, and the matching person in the library, and the label of the person who has recognized the result, the number of check-in times, and the check-in time will be displayed in the GUI.

For images that are not in the face database, the database can also recognize them, but the accuracy rate is not high, which may be because the background of the face data involved in the training is messy, not standard, there are few samples, and the accuracy of the convolutional neural network itself is not high. It is also the direction that the author hopes to improve in the future , but there are also a few images that can identify images that are not in the library, as follows:
insert image description here

3.2.2 Automatic Camera Identification

The author did not load his own data, but used a computer to identify the image displayed on the mobile phone, and the results are as follows
insert image description here
insert image description here
insert image description here

After the camera captures a face, it will pause for 3 seconds for face recognition, and then perform recognition again. When it captures a face that is not in the database, it will also pause for 3 seconds for face recognition, and you can see the face recognition for people in the database. Face data recognition accuracy is relatively high.

3.3 Punch Statistics

After a series of check-ins, you can make statistics on the check-in records, click "Punch Statistics", as follows
insert image description here

It will generate a record sheet of the number of times each labeler punches the card and the passing line of the punch card, and will generate the corresponding excel data table at the same time
insert image description here

04 Source code acquisition

https://mbd.pub/o/bread/ZJmWm5py
(guaranteed to work)

05 Outlook

This system implements functions such as face detection, image processing, convolutional neural network training, and face recognition. It has a good effect on the recognition of face databases, but there are still many problems, such as the effect of face recognition outside the database. It is not good, and it is easy to recognize faces that are not in the library as faces in the library, etc., but the annotations of this system are complete and clear, which is convenient for students to carry out secondary development and improvement of the system.

Guess you like

Origin blog.csdn.net/sfejojno/article/details/130841085