Real Time Face Attendance System Using ML

The emergence of the big data era and the economic significance of facial recognition technology have greatly increased the prospects and market demand for this technology. The purpose of this essay is to design a real-time video-based facial recognition attendance system. This article primarily sets four directions to consider the issues: the face recognition attendance system's truancy rate with real-time video processing, the stability of the system with real-time video processing, the accuracy rate of the system during actual check-in, and the interface settings of the system with real-time video processing. A PYTHON script and a SQL database are used to support the proposed system, which was developed on the Miniconda platform. The algorithm used by the system is based on image comparison, comparing the picture recorded by the system while it is running with the encoded values of the face from the image from the database. The system's output is an excel spread sheet.


Introduction
• In this era of Internet explosion, computer technology has involved many areas of people's lives and work. The occasions where people come into contact with computers are gradually expanding. The frequency with which people use computing is also increasing. One of the most challenging projects in the field has a broad application prospect because of its huge sense of innovation. As an important identity label for people to distinguish different individuals, face recognition technology has gradually entered people's lives. Face recognition is the combination of artificial intelligence and computer. Because of its huge challenging innovation and broad application prospects, it has become the most challenging topic in this field. In recent years, the face recognition application system has developed rapidly as a computer security technology in the world, especially today, when terrorist activities are rampant, this technology has received more and more attention. Face recognition technology has many typical applications in the field of public safety, civil economy, and home entertainment [1][2]. The pipeline of general enterprises needs to record the attendance of personnel, which has become a basic requirement of the company. Additionally, instructors could unintentionally make a mistake when taking attendance. A circumstance where an employee's attendance is incorrectly reported in the ledger could occur in an employee-based business. This limitation can be overcome by automating the procedure with the use of an AI system that recognises the person as they enter the building, notes their attendance, and stores the data for a long period of time in a database. In any event, it will be useful to have this information on hand. Face recognition is useful in this system in a number of ways, some of which are given below Reduces the possibility of human error  Administrators don't have to manually enter absences in the Register, which saves time and money.  AI-based attendance systems are far more automated than manual attendance systems. These programmes continuously update and retain daily records. Facial recognition attendance systems can be set up to handle daily attendance as well as generate extremely precise timesheets for particular employees on a wide scale.

BACKGROUND STUDY (LITERATURE)
Real time Monitoring System : This attendance system for classroom environments uses face recognition [1]. built an attendance system that does away with the current system's manual process. Face recognition is the method used to take attendance. The algorithm takes into account the person's posture as well as their expression when taking attendance. The author of Attendance System Using Face Recognition and Class Monitoring System claims that Attendance System Using Face Recognition would upload facial images of various people and pupils from attendance recognition to a database. This implies that automatic attendance systems based on facial recognition also cut down on manual labour. Automatic Attendance System Using Face Recognition [3]. This system employs the Viola-Jones and PCA facial recognition algorithms. In this system, a digital camera is used to take two pictures: one at the start and one at the conclusion of the course. Both photographs will be processed by this system, which is an essential step in the process of using face recognition to locate the pupil. The attendance of a student will be noted if they can be identified both before and after class. System for Managing Attendance in Classrooms: A revolutionary technique called as a 3D facial model is developed using the Facial Recognition System [4] to recognise a student's face inside of a classroom. These analytical investigations will make it possible to identify pupils in an automated attendance system. It recognizes faces from photos or video streams to track attendance and evaluate performance. Design and setup of a wireless iris recognition attendance management system [6] This technology can recognise irises by using the iris as a biometric property. Iris Recognition is a wireless technology that has been developed and put into use. The iris recognition technology is built upon the Daugman algorithm. This iris recognition system uses the three phases of extracting the image, preserving the image's features, and comparing those details to the image that is saved in the database to capture an iris recognition image. However, the iris recognition topography is subpar.

METHODOLOGY
The plan presented here calls for creating an automatic attendance system that can track attendance and identify individuals based on their faces. Both corporations and educational organizations that require staff employees to keep track of their attendance might use this technique. The system's benefits may be enjoyed by administrators and attendees at the institution. Additionally, the system intends to reduce the resources needed to maintain attendance by reducing human mistake that could occur when documenting attendance, such as proxy attendance in educational institutions. A histogram of oriented gradients is used in the provided method as a practical solution for the application. As part of this system, a highdefinition camera will be mounted outside the classroom or workplace to monitor attendance camera will be placed within the classroom so that any pupil or staff member can be captured by its lens. The subjects' faces will be scanned by the camera's facial recognition and identification algorithms, which will record their attendance. An individual walking through the front door turns his face towards the camera, creating 128-d encodings. Then, using the data we acquired as training, we compare these 128-d encodings to the known encodings. If a match is discovered, we enter the person's name into our database, which is set up according to the day and hour that he was admitted to the location. We can now track attendance more easily and methodically as a result. If there isn't a match, the algorithm will just start looking for the next visitor. detected, suggesting that the system has not yet been updated with the person's photo. This keeps happening up until the system is turned off. Admin can examine the attendance and data of an employee or student by logging in to the set home page with the correct credentials. In a local excel sheet that the admin can access, we update the attendance in real time.

ALGORITHMS 4.1 Existing LBP
LBP is basically a texture based descriptor which it encoded local primitive into binary string. (Timo Ojala et al., 2002). The original LBP operator works on a 3 × 3 mask size. 3 × 3 mask size contains 9 pixels. The center pixel will be used as a threshold to convert the neighboring pixels (the other 8 pixels) into binary digit. If the neighboring pixel value is larger than the center pixel value, then it is assigned to 1, otherwise it is assigned to 0. After that, the neighborhoods pixel bits are concatenated to a binary code to form a byte value representing the center pixel. Figure 1 shows an example of LBP conversion. where Pc indicates centre pixel and Pn (n = 0,…, 7) are 8 of its neighbouring pixels respectively. The starting point of the encoding process can be any of neighbouring pixels as long as the formation of binary string is following the order either in clockwise or anticlockwise rotation.

Working principle of proposed LBP
The original LBP operator is composed of 3 × 3 filter size with 9 pixels. Instead of the circular pattern, it looks more rectangular in shape. The 9 pixels adjacent to each other means every detail will be taken as sampling points even the non-essential details. It is more affected by uneven lighting condition because the small filter size emphasizes small scale detail (Lee and Li, 2007), even the shadow created by non-uniform lighting condition. In our proposed approach, a larger radius size, R is implemented in LBP operator. In the paper of Md. Abdur Rahim et.al (2013), the equation of modifying the radius size has been introduced. However, the paper did not mention the effect of changing the radius size. In the proposed approach, analysis is done on different radius sizes in order to enhance the system and reduce the illumination effect. By increasing the radius size, the filter size will be increased. Although the radius has been increased, total 8 sampling points are taken which is similar to the original LBP operator. In the approach, CLAHE is performed on the grayscale input facial images to improve the contrast. The contrast improved images remain as grayscale images. The proposed LBP operator extracts the grayscale features from the contrast improved grayscale images which requires only 8 bit computation. After that, the pixels at the sampling points will be encoded as 8 bit binary string in the same way as original LBP operator encoding process. Enhanced LBP with radius size two, perform better compared to original LBP and has more consistent recognition rate compared to other radius size. Hence, enhanced LBP with radius size two will be used as proposed approach. The proposed LBP operator will be further explained in Chapter 4 (result and discussion).

R=1(original)
X sh Basically, the increasing in the size of the radius means extending the circular pattern of LBP externally. The green spots within the blocks indicate the sampling pixels to be encoded into binary string. For the sampling pixel located I between blocks, it indicates average pixel value is computed from the adjacent pixels (diagonal). The feature vector of the image is constructed after the Local Binary Pattern of every pixel is calculated. The histogram of the feature vector image is computed in order to be classified by distance classifier.In order to overcome this problem, the feature vector image is then divided into blocks. A histogram is constructed in each region respectively. Every bin in a histogram represents a pattern and contains the frequency of its appearance in the region. The feature vector of entire image is then constructed by concatenating the regional histograms in the sequence to one histogram.

Working Principle of PCA
In this proposed approach, PCA face recognition is studied, as it is one of the popular face recognition methods that was suggested and used by the previous researchers. The accuracy of PCA is computed in order to compare with the enhanced LBP. PCA includes a few steps which will briefly be described in the following paragraphs. For PCA, the image scale, length (M) and height (M) is not so important. This is because PCA is mostly dealing with number of total images, N instead of M. However, same size of test image and training image is a must for PCA computation.
Same length and height of the image is assumed in the following equation for illustration. Given a training set of N images with size × , the first step of PCA is to convert two dimensional vectors to one dimensional vector. The one dimensional vector can be either column vector or row vector. In this approach, the column vector conversion is done. For each facial image with matrix notation × will be converted to column vector Γi, with dimension 2 × 1.There are N facial images, each face is represented by column vector Γ1, Γ2, Γ3, .., ΓN. Feature vector of each face is stored in this column vector. The dimension reduced face matrix is constructed by concatenating every single column vector. PCA is briefly explained by using the equation in the following steps.
Step1: Prepare the data Step 2: Obtain the mean/average face vector Next, the average face vector which is also known as mean face is calculated. The mean is computed row by row between the column vectors. The equation of mean face is shown below.
Step 3: Subtract the mean/average face vector In order to ensure the image data is centred at the origin, the mean face is subtracted from each column vector.
Step 4: Calculate the covariance matrix where A is the matrix constructed from the concatenation of the column vectors after remove the mean face.
The purpose of covariance matrix to be constructed is to compute the eigenvectors and eigenvalues. However, have dimension 2 × 2 which is extremely large to be calculated. ,and have the same eigenvalues, and their eigenvectors can be related as = .
Hence which have dimension 2 2 is calculated instead of because 2 ≪ 2 , less computational time is required.
Step 5: Calculate the eigenvectors and eigen values from the covariance matrix. = i =1,2,…,N-1 is the eigenvector of whereas is eigenvector of .Eigenvalues of , are calculated and sorted Step 6: Projection of facial image to Eigen face.
The facial image is projected on the Eigen face by using the equation to obtain the projected image Ω. Γ − is the centered vector, which the mean face is removed.
Steps 1 to 6 are used to train the training image set. For test image only step 1,2, 3 and 6 is required.
Step 4 and 5 are not required for test image as the Eigen face is needed only to compute once while training. The Euclidean distance is then used as distance classifier to calculate the shortest distance between the projected image and projected test image for recognition.

IMPLEMENTATION
When a face is recognized and the image in the database is verified, the system declares the employee to be present. If it doesn't, the employee's attendance record is still marked as absent. Algorithm: INPUT: Student's faces at the entrance.
Step I: Start Step II: Entering Student information into the database of Student's.
Step III: Setup the camera at the entrance. Student's faces will appear in the camera Step IV: LBP Algorithm.
Step V: Face Recognition utilizing the Local Binary Pattern Algorithm by contrasting the Students faces with pictures in the employee's database.
Step VI: IF student's face is present in the database, THEN Go to Step 7. ELSE: Go back to Step 2.
Step VII: IF Faces are recognized and matched THEN Mark them as present.
ELSE: Mark as absent.
Step VIII: Mark the attendance in the attendance database.
Step IX: End. This is the initial page of our project which contains tabs to check registered employees and to fill the automatic attendance.

Fig. 5 Initial Page
After filling the details of Students (i.e Enrollment No and Name), it automatically captures the images for haar feature Extraction and stores the images in Training database.
After Entering the Enrollment ID and Name, the next step is to take images of the student. After the initial Capture the image is saved.
Then the model is trained with the captured images.
Then we should enter the subject to mark attendance for. The Attendance is marked.

RESULTS AND ANALYSIS
Our system requires a minimum distance of three feet in order to recognize an image. The facial recognition accuracy of our technology is 90%. This technology can identify the employees whether or not they have glasses on or a beard. The accuracy is also influenced by the system setup and processing power. Since these projects use machine learning methods, a powerful computer system is needed to process them. High configuration produces better outcomes.

ADVANTAGES OF THE SYSTEM
The suggested methodology employs a considerably simpler and more efficient technique. The system is made easier by using an intuitive Framework. It has a simpler algorithm and fewer complex database configurations. The system is better since it is platform independent.

CONCLUSION
In this approach, a face recognition based automated student attendance system is thoroughly described. The proposed approach provides a method to identify the individuals by comparing their input image obtained from recording video frame with respect to train image. This proposed approach able to detect and localize face from an input facial image, which is obtained from the recording video frame. Besides, it provides a method in pre-processing stage to enhance the image contrast and reduce the illumination effect. Extraction of features from the facial image is performed by applying both LBP and PCA. The algorithm designed to combine LBP and PCA able to stabilize the system by giving consistent results. The accuracy of this proposed approach is 100 % for high-quality images, 92.31 % for low-quality images and 95.76 % of Yale face database when two images per person are trained.

FUTURE ENHANCEMENT
Based On the technology improvements such being having the capability of small size but high processing power this project can be broadly used. Below are some future workouts on this project.  Creating Portable CCTV.  Adding in-built night vision capability.  Adding deep learning if having high power device.  More feature such as 1. Deadly weapon detection 2. Accident detection 3. Fire Detection

Acknowledgement
For his insightful suggestion, knowledgeable counsel, and moral support during the writing of this work, we would like to express our gratitude to Varkala Satheesh Kumar.