Design and implementation of face recognition attendance management system

. In view of the inefficiency and cheating in time attendance, a face recognition attendance management system has been developed. The system is developed under Windows 10 using Java language and MySql database. After the user logs on to the system, click the punch-in button. The system calls camera through openCV to take pictures, and then matches this photo with the photo in the database. If the match is successful, the system can punch in successfully. The full day's work time is calculated by clocking in to record the employee's clock-in time each time. In order to improve the speed of face recognition, the face recognition algorithm in this system first uses the perceptual hash algorithm to filter the photos, and then calls the face comparison interface of the Rainbow Soft Face Recognition Engine for face recognition, thereby improving the speed of face recognition.


Introduction
As early as the early industrial era, paper check-in has been used by Western capitalists. This is the most primitive and pure check-in, but this check-in method has been eliminated by the vast majority of enterprises at present, and the calculation of workers' working hours is laborious, the efficiency is very low, the management is inconvenient, and the paper is wasted [1] . At present, a large number of domestic universities and enterprises are still using IC punching machine. In the era of rapid computer development, it integrated a lot of advantages, can use the computer to count attendance data, and even do some complex calculations, but its magnetic card and head are more likely to be damaged [2] [3] . In the era of smart phone development, mobile phone software attendance is also very popular. The use of mobile phone App attendance, eliminating the cost of attendance machine, IC card, but this punch card also has a lot of drawbacks, there are many illegal software on the market to modify the positioning of mobile phones, easy to cause losses to enterprises. Fingerprint punching is a new technical means of development in recent years, which can solve the shortcomings of the above centralized punching method. However, the sensitivity of fingerprint punching is still somewhat low. There are often unsuccessful fingerprint identification and unsuccessful punching, and the efficiency of fingerprint identification is not satisfactory [4] [5] . Face recognition prevents punching cheating, and the recognition accuracy is also high, so face recognition is used in all walks of life. Face recognition in addition to being used to punch, but also can be combined with other aspects, through the combination of punch management and manual management, can be adapted to a variety of different working environment of enterprises.

System design
The system is developed using windows10, uses IDEA development tools as a whole, and adopts the MVC architecture, and the server is developed in the Java language in the background. Web front-end pages are developed using HTML5 and use the Bootstrap frontend framework for dynamic layout, while also using Ajax for real-time interaction of frontend and back-end data. On the server side, a small server, Tomcat10, is used and deployed on the enterprise's local server. The database uses Mysql.

Registration module
Based on face recognition attendance management system, the system is only for internal management, to meet the company's attendance needs. Therefore, there is no registration page set up in the start interface of the web page, only the company's personnel director and super account will have this function. Whenever a new employee is hired, the new employee and the personnel supervisor should complete the application for the attendance system account. When registering, in order to better manage employees, it is necessary to input employees' necessary personal information such as name, gender, telephone number, personal profile, etc. In order to prevent the failure of face login caused by system maintenance or other circumstances, we have added the mailbox login function. In order to ensure the uniqueness of the system account, each mailbox can only bind one system account, using the mailbox verification code for verification. In order to prevent attendance data disorder, the system stipulates that an employee information data can only be registered once. When the face data is collected, the face information will be checked, and when the face information exists in the database, the registration will be rejected. The system uses the snowflakes algorithm to assign a unique work number for the employee. The snowflakes algorithm is implemented using a one-bit identifier, a 41-bit timestamp plus a 10-bit data machine bit, and a 64-bit string consisting of 12-bit random sequence codes, and finally an 18-bit work id is generated by displacement. This algorithm is generated based on timestamps and is therefore unique and incremental.

Login module
The login interface will pop up when you first open the system. All functions of the system need to complete the login operation to be carried out. Since the registration function can only be operated after login, the system will provide a super account with the registration function and the account can only be logged in through the mailbox. In order to improve the efficiency of the employee login system, the function of face login is set up, and the function of retrieving the mailbox password is hidden. Face data is retained at the time of registration and will not be changed again, and if an employee wants to change their email login password, they need to use face login before modifying it. In order to avoid the employee's camera device is not available resulting in normal access to the system, the system provides mailbox login function.

Punch module
The punch card function can only be used after entering the system. This function is under the personal affairs navigation bar. The punch-in function interface is simple, and there are two functions, punching and viewing the punch records of the past. In order to avoid the occurrence of other employees replacing the punching, when an employee clicks the punchin button, the system will call the camera to collect the face information of the current employee, then comparing this photo with the registered photo set of the system. If the match is successful, then this punch is valid, otherwise this punch is invalid. When the punch is valid, the system records the punch-in time, stores the current time in the database clock-in schedule, and displays it on the clock-in interface in real time. At the time of display, the clocking record is calculated, and when the clocking record is even, the system calculates and displays the employee's length of work. The system provides viewing capabilities, and employees can select a date to view their punching records.

Role design
In order to facilitate the management of company personnel, the system provides different functions for people in different positions. Ordinary employees have the right to view work logs, apply for overtime, withdraw overtime, apply for leave, withdraw leave, and view their attendance records. The department head has the right to approve the employee's leave of absence for no more than one day, approve employee's overtime and view attendance for all employees in the department. The personnel supervisor registers the new employee, revises the employee's department, position information, and sets up working days. The leader has the role of approving the employee's leave of more than one day and modifying the department head. The system also set up an administrator role, this administrator has all the functions of the system.

Overtime and leave function module
Leave-related functions are completed by Html and Ajax technology, and the employee leave page will have four paging boxes to view the detailed application content of the four states (submit, pass, complete, reject) and present four different background colors according to the different states. And according to the different times of leave, it will be assigned to different levels of supervisors for approval. The approval page has a search function, and the supervisor can query the specified employee application by name on the management page. Employees can fill in the overtime start time, as well as length and reasons of overtime, and send it to the superior department supervisor for approval. Figure 1 shows the leave page.

Use OpenCV to get photos
OpenCV will call the local camera. In order to prevent the use of photos, the system can also be logged in, and uses the key frame design, only when the keyframe is transformed 3 times, the photo will be valid, otherwise the photo is invalid. At the same time, in order to prevent the capture of keyframes, the system will always occupy camera resources, resulting in other functional constraints, design a time limit. If the keyframe is not captured within 10 seconds, the process of face recognition is stopped.

Use the perceptive hash algorithm to filter photos
When the face recognition function is called, all the face registration photos are read from the database and sent to the backend for comparison. At this time, when the system develops to a certain extent, a large amount of face photo data will be generated, and in order to improve the speed of face recognition, a perceptual hashing algorithm (PHash) is introduced [6] . When performing face recognition, the OpenCV camera is used to take pictures, which we call temporary photos. We iterate through the registered photo collection of the database, processing each photo in the database with a temporary photo. First, the two photos are grayscaled, resulting in a 20-bit string based on three color channels, usually referred to as the fingerprint of the photo, and then the two fingerprints are compared. Set the threshold value of two fingerprints to classify the registered photo set of the database. When the result of comparison threshold between the database photo and the temporary photo is higher than the set value, the photo is classified into a photo set with a high success match rate, and conversely, the photo is classified into a photo set with a low success match rate.

Use the hongsoft face recognition engine for face recognition
The main method of face comparison is the FaceCompare() method under the FaceMain class, which requires three parameters to be passed in. The first is the newly initialized face recognition engine, followed by the introduction of two photos that need to be compared, and then began to face detection of the two photos, and then the feature extraction of the faces, calculating the characteristic values of the two photos, and finally setting a similar threshold. When the calculated feature threshold is greater than the similar threshold, we think that the two photos are the same person.

Database design
The related data stored on this system uses Mysql, which is a relational database. The information in the database mainly contains the basic personal information of employees, as well as the facial feature pictures selected by employees, punch card records, overtime, leave records and employee logs, etc. The personal information table is stored separately from the facial feature table for more efficient reading and search performance. Facial features are an important part of face recognition. The background will take all the face data in the table at one time, package it into a byte number, and provide it to the face module for comparison. Punch card information is the information record of employees clocking in and out of work, and superior leaders and supervisors can view the employee's punch card data. Leave requests and overtime tables store information about employees' leave and overtime, and superior leaders can view, approve, and reject them. The face recognition process is to take out the ITM Web of Conferences 47, 01024 (2022) CCCAR2022 https://doi.org/10.1051/itmconf/20224701024 face feature infographic from the database and compare it with the facial information of the current camera punch card employee.

Experimental testing and analysis of results
Through the perceptual hashing algorithm, the corresponding face image can be searched without calling the face recognition interface. Experiments have found that adding a perceptual hashing algorithm before face recognition can improve the recognition speed of face pictures and reduce the search time. The time comparison effect is shown in Table 1 below. Test this system in a laboratory attendance and the system is fully functional. Click Face Login in the login interface, and the camera captures the image information and sends it back to the background face recognition module for data comparison. System test results: 95% accuracy of 100 tests, good response time experience. Through the test, it was found that the reason for the recognition failure was that when the employee logged in, checked in, and signed out, the camera and people were shaken, and the pictures taken were blurred, resulting in unrecognizability. Figure 2 shows the renderings of the punch card interface.

Conclusion
Based on face recognition technology to achieve punch card attendance web system, the page uses modular design, for the future system maintenance to provide convenience. The system can accurately identify the corresponding employees, punch in, and count the commuting time, and complete the sub-module of leave. In terms of attendance, there will be no difficulty ITM Web of Conferences 47, 01024 (2022) CCCAR2022 https://doi.org/10.1051/itmconf/20224701024 in managing paper check-in, waste paper and slow speed of fingerprint recognition, which improves the attendance efficiency of enterprises, schools and other offices.