VIETNAM NATIONAL UNIVERSITY, HANOIINTERNATIONAL SCHOOL STUDENT RESEARCH REPORT ATTENDANCE SYSTEM IMPLEMENTATION USING FACE RECOGNITION CN.NC.SV.23_29 Team Leader: Tran Khanh Huyen ID: 22
Trang 1VIETNAM NATIONAL UNIVERSITY, HANOI
INTERNATIONAL SCHOOL
STUDENT RESEARCH REPORT
ATTENDANCE SYSTEM IMPLEMENTATION USING
FACE RECOGNITION CN.NC.SV.23_29
Team Leader: Tran Khanh Huyen
ID: 22070803 Class: BDA2022A
Hanoi, April 15, 2024
Trang 2TEAM LEADER INFORMATION
- Program: Business Data Analytics
- Address: Ba Dinh, Hanoi
- Phone no / Email: +84 359988618 / trankhanhhuyen0211@gmail.com
II Academic Results
III Other achievements
Advisor(s)
(Sign and write full name)
Pham Dinh Tan
Pham Thi Viet Huong
Hanoi, April 15, 2024
Team Leader
(Sign and write full name)
Tran Khanh Huyen
Trang 3On behalf of the Face Recognition Team, we express our deepest gratitude to
Dr Pham Dinh Tan and Dr Pham Thi Viet Huong for their invaluable contributionsand dedicated service Their expertise and insights have been instrumental inadvancing our research and development efforts Their commitment to excellence hasnot only enhanced the capabilities of our facial recognition technologies but alsoinspired a culture of innovation within our team
We are particularly grateful for their willingness to share their knowledge andmentorship of our newer members, fostering an environment of learning and growth.Their collaborative spirit and leadership have been key factors in our group’sachievements
As we move forward, we remain appreciative of the advisors’ ongoing supportand look forward to continued collaboration We are confident that their guidance willguide us to achieve greater research milestones
With respect and gratitude,
Tran Khanh Huyen
Leader
Face Recognition Team
Trang 4CHAPTER 1: APPLYING THE REAL-TIME FACE RECOGNITION MODEL
2 Overview of Real-Time Face Recognition Models 13
1.1 Importance and Applications of Deep Learning 17
2 Deep Learning Approaches for Face Recognition 182.1 Deep Learning Based Face Recognition for Attendance Systems 18
Trang 52.2 Utilizing InsightFace for Face Recognition 192.3 Advantages and Limitations of InsightFace 20
1.2 Advantages and Limitations of Redis Database 25
2 Implement Face Detection and Face Recognition Algorithms 27
3 Optimize Parameters To Improve Face Recognition Accuracy 37
Trang 7LIST OF TABLES
Table 1: Comparing the effectiveness of face recognition models based on accuracy(%) and recognition time (ms)
LIST OF FIGURES
Figure 1: Face Recognition Pipeline
Figure 2: Implementing a Face Recognition System
Figure 3: Visualization of CNN Architecture for Face Detection
Figure 4: Features of InsightFace
Figure 5: Dataset Preparation Process
Figure 6: Module Integration Process
Figure 7: Visualization of Detection and Recognition module
Figure 8: UI Design Process
Figure 9: Redis’s data sampling and storing - Student Registration
Figure 10: 2D Euclidean Distance
Figure 11: 3D Euclidean Distance
Figure 12: 2D Manhattan Distance
Figure 13: 3D Manhattan Distance
Figure 14: 2D Cosine Similarity
Figure 15: 3D Cosine Similarity
Figure 16: Distance Method
Figure 17: Similarity Method
Figure 18: System Operation Illustration - ‘Home’ Page Interface
Figure 19: System Operation Illustration - ‘Registration form’ Page Interface
Figure 20: System Operation Illustration - ‘Real Time Prediction’ Page InterfaceFigure 21: System Display When Facial Recognition Matches or No Suitable Match isFound
Figure 22: System Operation Illustration - ‘Report’ Page Interface
Figure 23: Testing Images
Figure 24: Fast Face Recognition Model
Figure 25: Authenticating Identity via Deep Learning
Figure 26: Real-Time Prediction
Trang 81 Project Name
- English: Attendance system implementation using face recognition.
- Vietnamese: Xây dựng hệ thống điểm danh sử dụng nhận dạng khuôn
Trang 9or to create attendance reports This system not only reduces the time and effort needed to maintain a manual attendance system but also provides an effective solution to prevent proxy attendance.
- Vietnamese:
Trong thời đại số hóa hiện nay, hệ thống nhận dạng khuôn mặt đóng một vai trò quan trọng trong hầu hết mọi lĩnh vực Nhận dạng khuôn mặt là một trong những biometrics được sử dụng nhiều nhất Nó có thể được sử dụng cho mục đích bảo mật, xác thực và nhận dạng, và có nhiều lợi ích khác Hệ thống này nhằm xây dựng một hệ thống điểm danh lớp học sử dụng nhận dạng khuôn mặt Cơ sở dữ liệu được tạo bởi hình ảnh của các học sinh và giảng viên trong trường Khuôn mặt được phát hiện và nhận dạng từ video trực tiếp của lớp học Hệ thống lưu giữ bản ghi về tất cả người đã điểm danh, có thể truy cập để tham khảo trong tương lai hoặc
để tạo báo cáo điểm danh Hệ thống này không chỉ giảm thiểu thời gian
và công sức cần thiết để duy trì hệ thống điểm danh thủ công, mà còn cung cấp một giải pháp hiệu quả để ngăn chặn điểm danh giả mạo.
Trang 10SUMMARY REPORT IN STUDENT RESEARCH
2023-2024 ACADEMIC YEAR
I LITERATURE REVIEW
Managing attendance is a critical responsibility for educational institutions andbusinesses Traditional methods, such as manual sign-ins, are not only prone to errorsbut also consume a significant amount of time To address these challenges, theimplementation of an attendance system using face recognition technology has beenproposed This system leverages facial recognition technology to automaticallyidentify and record the attendance of students or employees, thereby enhancingefficiency and reducing the likelihood of fraudulent activities The system operates bycapturing an image of an individual's face and comparing it with a pre-existingdatabase of registered faces If a match is found, the individual's attendance isrecorded This system is particularly beneficial for large institutions with numerousstudents or employees By utilizing facial recognition, the attendance process becomesboth time-efficient and accurate This system not only streamlines the attendanceprocess but also ensures the integrity of the attendance records
1 Concerning the Rationale of the Study
The implementation of a face recognition-based attendance system is afascinating research subject This system holds several advantages over conventionalmethods like roll call or card-based systems It offers high accuracy, reduces errors,improves efficiency, and is cost-effective
The system conserves precious time for both students and teachers byeliminating the necessity for manual recording and verification Despite the initialinvestment, it proves to be more cost-effective in the long run due to its minimalmaintenance needs
The technology limits the chances of proxy attendance, impersonation, or classskipping as it employs surveillance cameras to monitor arrivals and departures, and it'scontactless, making it a perfect choice for environments that prioritize cleanliness Italso provides data insights for analytics, allowing institutions to improve attendancerates and overall performance
Integration with other systems streamlines data management processes Theconvenience and security provided by face recognition technology enhance the userexperience As technology continues to advance, it can future-proof attendancesystems and ensure scalability to meet future demands
Furthermore, it assists institutions in adhering to regulatory requirements for
Trang 11attendance tracking and data privacy Researchers can investigate the benefits andchallenges of face recognition-based attendance systems, contributing to the progress
of attendance management practices This research could potentially transform theway attendance is managed in various institutions
2 Research questions
When researching the implementation of an attendance system using facerecognition, it's essential to formulate clear research questions that guide the study.Here are some potential research questions:
- What are the key factors influencing the accuracy of face recognitiontechnology in attendance systems?
- How does the face recognition-based attendance system improve efficiencycompared to traditional methods?
- What are the potential challenges and limitations of implementing a facerecognition-based attendance system?
- How can the face recognition-based attendance system be scaled to meet futuredemands?
3 Motivation and Objective
The motivation for this research is rooted in the limitations and inefficiencies oftraditional attendance systems, such as manual entry or card swiping These methodsare often susceptible to errors and manipulation, leading to inaccuracies and securityconcerns In contrast, face recognition-based attendance systems offer numerousadvantages, including enhanced precision, effectiveness, security, and convenience.They provide real-time tracking and eliminate the need for manual input, reducing therisk of buddy punching and unauthorized access
Moreover, these systems can be integrated with other software for data analysis,making them adaptable to various organizational sizes They leverage advancedtechnology to improve overall efficiency and compliance with rules The primaryobjective of this project is to create an automated, fast, and efficient attendancesystem This includes minimizing time wastage during conventional class attendance,utilizing the latest trends in machine vision to implement a feasible solution for theclass attendance system, and creating a digital environment that prevents false rollcalls as one-to-one attendance marking is possible only
By doing so, we aim to enhance the accuracy, efficiency, security, andconvenience of attendance systems, meeting the evolving needs of organizations
Trang 12Furthermore, we aspire to contribute to the ongoing technological advancements in thefield of facial recognition and machine vision, thereby paving the way for futureinnovations in this domain Ultimately, our goal is to create a system that not onlyaddresses the current challenges but also anticipates and adapts to future needs andtrends.
4 Research Methods
The research methodology for this project focuses on implementing anattendance system using face recognition We apply Machine Learning to addressfacial recognition, incorporating advanced face detection and recognition algorithms.The system is deployed on a simple hardware setup using a laptop with a webcam
5 Structure
The research paper begins with a Literature Review section that discusses the
rationale of the study, presents the research questions and outlines the motivation andobjectives It also describes the research methods and provides an overview of thestructure of the study
This is followed by the Data & Methodology section, which is divided into
three chapters The first chapter focuses on applying real-time face recognition models
to the attendance system The second chapter explores the utilization of deep learning
in face recognition for the development of an attendance system The third chapterdetails the research methods used in the study
The next section, Results & Discussions, presents the detailed results of the
study and provides an analysis It also reviews the methodology and discusses thechallenges, limitations, and potential future work
The Conclusion & Recommendations section summarizes the findings of the
study, provides a concluding statement, and discusses practical applications It alsooffers recommendations for future research
The paper concludes with an Appendix that includes a detailed description of
the face recognition algorithm, the operation of the class attendance system,
experimental results, and illustrations The paper also includes sections for
Abbreviations and References.
Trang 13II DATA & METHODOLOGY
CHAPTER 1: APPLYING THE REAL-TIME FACE RECOGNITION MODEL TO
THE ATTENDANCE SYSTEM
1 Face Recognition Basics
1.1 Understanding Face Recognition
Face recognition is a method of biometric identification that leverages thedistinct features of a person's face for identification Most of these systems operate bycomparing a facial print with a database of recognized faces, and if a match is found,the individual is identified If the facial print is not in the database, the system isunable to locate the person Some advanced facial recognition systems, equipped withartificial intelligence, can recognize individuals even if their physical appearancealters, such as using makeup or gaining weight
1.2 Face Recognition Process
A face recognition pipeline involves several steps, including face detection,feature extraction, and face recognition The pipeline’s efficiency is crucial whendeploying face recognition systems on embedded devices
Figure 1: Face Recognition Pipeline
- Step1_Face Alignment and Detection: The initial phase in facial recognition
involves pinpointing faces within a given image or video One of the hurdles inface detection is dealing with faces not directly facing the camera, as theyappear vastly different from the system To address this, algorithms are used tostandardize face orientation, often by identifying and using universal faciallandmarks such as the chin base, nose tip, eye edges, and points around the eyesand mouth A machine learning model is trained to locate these landmarks onany face and adjust the orientation towards the center
- Step2_Face Feature Extraction: Following face detection and alignment, the
subsequent step is to extract distinguishing features from the faces This task ishandled by Convolutional Neural Networks (CNNs), which are adept at pullingout high-level attributes from an image that are instrumental in recognizingfaces within a database
Trang 14- Step3_Face Recognition or Face Identification: The final stage involves
comparing the extracted features to those of faces in a database Typically, thiscomparison is made using the Euclidean distance metric, which calculates thesimilarity between two feature vectors
2 Overview of Real-Time Face Recognition Models
Face recognition models have evolved significantly over the years, withadvancements in both traditional and deep learning techniques Some state-of-the-artreal-time face recognition models:
- VGG-Face: This model is a deep learning-based approach that uses the VGG16
architecture and is trained on a large dataset of celebrity faces
- FaceNet: Developed by Google, FaceNet directly learns a mapping from face
images to a compact Euclidean space where distances directly correspond to ameasure of face similarity
- OpenFace: An open-source library that uses deep neural networks for facial
recognition, specifically designed for mobile and web applications
- DeepFace: Developed by Facebook, DeepFace represents a breakthrough in the
field of face recognition as it achieved near-human accuracy
- DeepID: This model is developed by researchers at the Chinese University of
Hong Kong It uses a deep learning approach to learn highly discriminative facefeatures for recognition
- ArcFace: This model, developed by the InsightFace project, provides
state-of-the-art performance on several face recognition benchmarks
- Dlib: Dlib is a modern C++ toolkit that also provides machine learning
algorithms, including support for face recognition
- SFace: This is another model that has shown good performance in face
recognition tasks
- InsightFace: This is an open-source 2D&3D deep face analysis toolbox, mainly
based on PyTorch and MXNet
➥ These models have significantly contributed to real-time face recognitionadvancements, each with unique approaches and methodologies They continue toshape the future of face recognition technology
3 Model Development and Optimization Process
Real-time face recognition systems require efficient algorithms and hardware toachieve high performance These systems need to process video frames quickly and
Trang 15accurately to provide real-time results.
3.1 Preprocessing Techniques
- Face Alignment: This process involves detecting a face and its features, and
then rotating, scaling, and translating the image to achieve a more uniformappearance The goal is to align the eyes and mouth in the same locationsacross faces
- Face Normalization: This step aims to reduce the variations between images
due to lighting conditions or camera characteristics Techniques such ashistogram equalization or tanh-estimators can be used to normalize the pixelintensity across the image
- Feature Extraction: In this stage, important features or characteristics are
extracted from the face images These features could be edges, corners, or otherinteresting parts of the image Deep learning techniques, such as convolutionalneural networks (CNNs), are often used for feature extraction in facerecognition systems
- Improving Accuracy and Robustness: This involves fine-tuning the model and
implementing techniques to handle different challenges such as variations inpose, expression, illumination, age, etc Techniques such as data augmentation,ensemble methods, or advanced training strategies can be used to improve themodel’s accuracy and robustness
3.2 Machine Learning Algorithm
The predominant ML model utilized in facial recognition is the deep learningConvolutional Neural Network These networks are particularly adept at processingvisual data for tasks like image categorization
CNNs are designed to recognize and utilize visual elements from images tocategorize them into various groups The complexity of a CNN, particularly its depth,
is crucial in facial recognition as it enables the network to discern intricate facialdetails
While a basic CNN may only recognize elementary facial traits like thecontours of the nose or the placement of the eyes, a more advanced, deeper CNN candetect subtler aspects like skin texture or chin contour After training on a collection offacial images, a CNN can apply its learned knowledge to identify individuals in newimages, a process known as facial recognition
Trang 163.3 Performance Optimization
- Hardware Acceleration: This involves using specialized hardware, such as
GPUs or FPGAs, to perform certain tasks more efficiently than ageneral-purpose CPU could In the context of face recognition, these taskscould include the heavy computations involved in processing large amounts ofimage data, performing complex mathematical operations, and running deeplearning models By offloading these tasks to specialized hardware, we cansignificantly improve the speed of the face recognition process
- Parallel Processing: This is a computational technique where multiple
calculations or processes are carried out simultaneously Large problems canoften be divided into smaller ones, which can then be solved at the same time
In face recognition, parallel processing can be used to distribute the workload
of processing multiple faces or multiple images across multiple cores or nodes.This can greatly speed up the face recognition process, especially when dealingwith large datasets or real-time applications
- Algorithm Optimization: This involves refining the face recognition algorithm
to make it more efficient This could involve reducing redundant computations,optimizing the feature extraction and matching processes, or implementingmore efficient data structures and algorithms For example, we could usedimensionality reduction techniques to reduce the amount of data that needs to
be processed, or we could use more efficient matching algorithms to speed upthe recognition process By optimizing the algorithm, we can make the facerecognition system faster and more efficient, and potentially improve itsaccuracy as well
4 Implementation of a Face Recognition Attendance System
Installing an attendance system implementation using face recognition in a classinvolves the following steps:
Trang 17Figure 2: Implementing a Face Recognition System
- Step1_Identifying appropriate locations: Identify areas in the class where
installing the face recognition cameras would be most effective These locationsshould ensure that all students' faces can be captured accurately
- Step2_Selecting a face recognition system: Research and choose a face
recognition system that suits the requirements (including setting up algorithms,creating student profiles, integrating with other class management systems, andtraining the system; then testing and calibrating)
- Step3_Installing the equipment: Install the required face recognition cameras
and software (which may involve mounting the cameras at the desired locationsand connecting them to the network)
- Step4_Announcement: Inform students, teachers, and officers about the new
attendance system and its benefits Provide any necessary training on how touse the system properly
- Step5_Monitoring and maintenance: Regularly monitor the system's
performance and address any issues promptly Provide maintenance and updates
as required to ensure smooth operation
- Step6_Evaluation and optimization: Continuously evaluate the system's
effectiveness and make necessary optimizations based on feedback and data(may involve making adjustments to camera placement, system settings, ornetwork infrastructure)
Trang 18CHAPTER 2: UTILIZING DEEP LEARNING IN FACE RECOGNITION FOR THE DEVELOPMENT OF AN ATTENDANCE SYSTEM
1 Deep Learning Basics
1.1 Importance and Applications of Deep Learning
Deep learning is a subset of machine learning that uses artificial neuralnetworks with multiple layers (hence the 'deep' in deep learning) to model andunderstand complex patterns and relationships in data It's inspired by the structure andfunction of the human brain—specifically, the interconnections among neurons
Deep learning drives many artificial intelligence (AI) applications and servicesthat improve the convenience and quality of our lives It's used in facial recognitionsystems, voice-controlled assistants, automatic image tagging, and personalizedmarketing, among other things
Face recognition is a significant application of deep learning Deep learningmodels can be trained to recognize and classify different faces based on complexpatterns and relationships in image data This has opened up many new applications,from security systems to convenient features on smartphones and other devices
1.2 Understanding Neural Networks
Neural networks, which are designed to mimic the human brain's structure, are
a set of algorithms that identify patterns They interpret sensory data using a form ofmachine perception, categorizing or clustering raw input The patterns they recognizeare numerical and encapsulated in vectors All real-world data, such as images, sound,text, or time series, must be transformed into these vectors
A neural network consists of multiple neuron layers, including an input layerthat receives the data, hidden layers that process the data, and an output layer thatproduces the final result The network learns by adjusting the neurons' weights andbiases based on the output error
There are various types of neural networks, each with its own strengths andspecific uses For example, Convolutional Neural Networks (CNNs) are commonlyused for image-related tasks, including facial recognition In the context of facerecognition, other types of networks such as Artificial Neural Networks (ANNs),Vision Transformers (ViTs), Deep Learning Models, and Sparse ConvNets are alsoutilized
Trang 191.3 Convolutional Neural Network (CNN)
Convolutional Neural Network (CNN) is a type of Neural Network that hasshown great effectiveness in tasks such as image recognition and classification CNNsare designed with an architecture that mirrors the organization of neurons in the humanfrontal lobe, the area responsible for processing visual stimuli This design, whicharranges artificial neurons in three dimensions (width, height, depth), allows CNNs tobetter model spatial hierarchies For instance, the first layer of a CNN might learnsmall local patterns like edges, while subsequent layers learn larger patterns composed
of the features identified in the preceding layers
CNNs can automatically learn hierarchical feature representations from rawpixel data, eliminating the need for manual feature extraction They have been verysuccessful in face recognition tasks
Figure 3: Visualization of CNN Architecture for Face Detection
2 Deep Learning Approaches for Face Recognition
2.1 Deep Learning Based Face Recognition for Attendance Systems
Deep learning has revolutionized the field of face recognition, significantlyoutperforming traditional methods This is particularly beneficial for applications likeattendance systems, where accurate and efficient recognition is crucial Deep learningmodels, unlike traditional methods that manually extract features such as edges andtextures, can automatically learn the most discriminative features for face recognitionfrom the data This ability is advantageous in handling the many variations in facialexpressions, lighting conditions, and poses
In our research, we have chosen to use the Fast Face Recognition Model instead
of traditional models This decision was made to reduce the number of image samplesneeded, minimize data processing and model training time, and still maintain goodaccuracy The Fast Face Recognition Model offers several benefits: it requires fewersamples, does not require model retraining for a new person, provides good accuracy,and has a low processing time Traditional models, on the other hand, require a large
Trang 20number of images for each person to train the model (at least 100 to 200 images perperson), cannot add new person details into the model without retraining, and theaccuracy of the model decreases as the number of persons classified increases Theyalso have a high processing time.
Despite our choice of the Fast Face Recognition Model for this study, we willstill detail the steps involved in preparing and processing the dataset for facerecognition models in general in the following sections This is to provide acomprehensive understanding of the process, regardless of the specific model used
Several deep learning models have been widely used for face recognition
These include models like VGG-Face, FaceNet, OpenFace, DeepFace, DeepID
ArcFace, Dlib, and InsightFace, which were mentioned in Chapter 1 These modelshave demonstrated remarkable success in handling a wide range of variations andproviding more accurate recognition results The advent of large-scale labeled facedatasets and powerful computational resources has further propelled deep learningmethods to become the dominant approach for face recognition
Evaluating the performance of face recognition models involves severalmetrics, including accuracy, precision, recall, F1 score, and Area Under the Curve(AUC) Each of these metrics provides a different perspective on the model’sperformance, aiding in the comparison of different models and identifying areas forimprovement Thus, deep learning techniques have not only revolutionized facerecognition but also provided a robust framework for evaluating their performance
2.2 Utilizing InsightFace for Face Recognition
In the context of our research, we have selected InsightFace As introduced inChapter 1, InsightFace is a comprehensive open-source project for 2D and 3D faceanalysis It offers state-of-the-art algorithms for face detection, face recognition, andfacial attribute analysis
InsightFace employs deep learning, specifically CNNs, to automatically learnhierarchical feature representations directly from raw pixel data This approachbypasses the need for manual feature extraction, a common requirement in traditionalface recognition methods The CNN within InsightFace is capable of learning toidentify key facial features, such as the distance between the eyes or the width of themouth These learned features are then used to differentiate one individual fromanother
Furthermore, InsightFace provides pre-trained models that have been trained onlarge-scale face recognition datasets This feature allows us to harness the power of
Trang 21transfer learning, where the model has already learned useful feature representationsfrom a large amount of data We can then fine-tune the model on our specific task with
a smaller amount of data
Beyond these capabilities, InsightFace also offers efficient tools for facedetection and alignment, which are crucial preprocessing steps for face recognition
Figure 4: Features of InsightFace
2.3 Advantages and Limitations of InsightFace
One of the main advantages of InsightFace is its robustness and versatility Theuse of CNNs allows the system to effectively handle common challenges in facerecognition, such as variations in lighting, pose, and expression Moreover,InsightFace provides tools for efficient face detection and alignment, which are crucialpreprocessing steps for face recognition
However, like any deep learning-based system, InsightFace requires asignificant amount of computational resources for training the models, especially forlarge datasets While the pre-trained models provided by InsightFace can be a greatstarting point, they may not always be optimal for specific tasks or datasets, andfurther fine-tuning may be required Despite these challenges, InsightFace proves to be
a robust and versatile tool for face recognition tasks in our research
Trang 223 Development of an Attendance System
3.1 System Requirements and Specifications
- Hardware Requirements: The system should be able to run on standard
computer hardware, including a webcam for capturing images for facerecognition
- Software Requirements: The system should be compatible with multiple
operating systems, including Windows, macOS, and Linux It should also becompatible with various web browsers such as Google Chrome, Firefox, Safari,and Microsoft Edge
- Network Requirements: The system should be able to operate in both online and
offline modes In the online mode, it should be able to sync data with a remoteserver for backup and cross-device accessibility
- User Requirements: The system should be user-friendly and require minimal
technical knowledge to operate It should provide clear instructions andfeedback to the user
- Performance Requirements: The system should be able to process attendance
quickly and accurately It should also be robust enough to handle a largenumber of users
- Security Requirements: The system should ensure the privacy and security of
the users’ data It should include features like secure login and data encryption
- Scalability Requirements: The system should be scalable and able to handle an
increasing amount of work by adding resources to the system
- Reliability Requirements: The system should be reliable and provide consistent
results It should have a low failure rate and provide error messages whenfailures occur
- Maintenance Requirements: The system should be easy to maintain and update.
It should also provide logs and reports for troubleshooting and performancemonitoring
3.2 Dataset Preparation
Figure 5: Dataset Preparation Process
Trang 23- Step1_Data Collection: The first step is to collect the data This involves
capturing images of the individuals who will be using the system These imagesshould be taken under various lighting conditions and from different angles toensure the robustness of the face recognition module Specifically, this researchwas conducted on a dataset consisting of facial images of students and facultymembers from VNUIS
- Step2_Data Labeling: Once the images have been collected, they need to be
labeled This involves associating each image with the identity of the individual
it represents This step is crucial for the training of the face recognition module
- Step3_Data Preprocessing: The labeled images then need to be preprocessed.
This involves steps such as resizing the images to a standard size, convertingthem to grayscale (if necessary), and normalizing the pixel values
- Step4_Data Augmentation: To increase the size of the dataset and improve the
robustness of the system, data augmentation techniques can be applied Thisinvolves creating modified versions of the images (e.g., by rotating or flippingthe images) to increase the diversity of the dataset
- Step5_Data Splitting: Finally, the dataset needs to be split into a training set and
a test set The training set is used to train the face recognition module, while thetest set is used to evaluate its performance
3.3 Integrating the Face Recognition Module
Figure 6: Module Integration Process
- Step1_Module Selection: The first step is to select a suitable module for face
detection and face recognition This could be an open-source library or acustom-built module The module should be capable of accurately detecting andrecognizing faces in various lighting conditions and from different angles Inthis research, we chose OpenCV and InsightFace to meet these requirements
- Step2_Module Configuration: Once the module has been selected, it needs to be
configured This involves setting various parameters such as the threshold forface detection and the method for face comparison (e.g., Euclidean distance or
Trang 24cosine similarity) This also includes fine-tuning the parameters to optimize themodule’s performance under different lighting conditions and angles.
- Step3_Module Training: Following the configuration, the subsequent step is to
train the module using the prepared dataset This involves feeding the labeledimages into the module and allowing it to learn the unique features of eachindividual’s face
- Step4_Module Evaluation: After the training phase, the module must undergo
an evaluation process This entails utilizing a test dataset to assess the module’seffectiveness The outcomes of this evaluation phase can be leveraged to furtherrefine the module’s parameters This iterative process of training and evaluationensures the module’s robustness and accuracy in face detection and recognitiontasks
- Step5_Module Implementation: The final step involves incorporating the
trained and evaluated module into the Attendance System This requiresembedding the module into the system’s codebase and verifying its effectivecommunication with other system components, such as the user interface andthe database This ensures seamless operation within the overall systemarchitecture
Figure 7: Visualization of Detection and Recognition module
Trang 253.4 User Interface Design
Figure 8: UI Design Process
- Step1_User Analysis: The first step is to identify the needs of the users This
involves understanding what features the users need and how they will use thesystem
- Step2_Task Analysis: Identify the tasks that the user will perform This could
include logging in, recording attendance, viewing attendance records, etc
- Step3_Environment Analysis: Analyze the environment in which the user will
use the system This includes the physical environment (like lighting conditions
if the system uses face recognition) and the technological environment (like thehardware and software on which the system will run)
- Step4_Interface Design: After identifying the user's needs, the subsequent step
involves sketching out potential interface layouts and designing the interfacebased on the user, task, and environment analysis This comprehensive processincludes deciding where to place buttons, menus, and other interface elements,determining the layout of the screen, identifying the elements that will bepresent on the screen, and establishing the flow from one screen to another.This ensures the interface is intuitive and user-friendly, catering to the specificneeds and expectations of the user
Trang 26CHAPTER 3: RESEARCH METHODS
1 Register Faces to Face Database
1.1 Introducing Redis
Redis, a renowned name in the world of databases, is a tool that allows you tostore a variety of information, from simple strings to complex data like image blogposts, comments, and even bytes like images Much like traditional databases, Redisprovides the functionality to store and retrieve data However, what sets Redis apart isits ability to handle these operations with remarkable speed and efficiency You canstore your data and then retrieve it later using queries, a common feature in databases.But with Redis, these operations are performed at lightning speed, providing aseamless experience for developers and end-users alike Redis is a database thatcombines the familiarity of traditional databases with the speed and efficiency ofin-memory data storage
1.2 Advantages and Limitations of Redis Database
● Advantages
Redis, an open-source in-memory data structure store, is known for itsexceptional speed and versatility It stores data in memory, ensuring ultra-fast dataaccess, making it ideal for applications where speed is crucial Redis supports a variety
of data structures, allowing developers to model complex relationships directly withinthe database, reducing the need for complex application code
Redis is known for its simplicity and developer-friendly nature Its commandset is intuitive and easy to understand, reducing the learning curve For scalability,Redis provides sharding for horizontal data distribution and supports replication forhigh availability It also supports transactions, allowing multiple commands to beexecuted atomically This is vital for maintaining data integrity in applications thatrequire multiple operations to be performed as a single unit of work
Redis is a powerful, flexible, and fast database solution that is well-suited to awide range of applications Its in-memory nature, rich data structure support,scalability features, and ease of use make it a compelling choice for developers.Whether you're building a real-time analytics platform, a gaming leaderboard, or a chatapplication, Redis offers the features and performance you need to deliver a great userexperience
● Limitations
Trang 27However, it’s crucial to acknowledge the trade-offs associated with Redis.Because it’s primarily an in-memory store, scaling for very large datasets can becomeexpensive as RAM is usually costlier than disk storage While Redis does offerpersistence mechanisms, its focus on in-memory operation means potential data lossrisks exist if a system fails before data is written to disk Additionally, Redis’ queryingcapabilities, while present, are less extensive than those found in traditional SQLdatabases Redis’ largely single-threaded nature can create bottlenecks underextremely high loads with many concurrent requests.
Storing images from a webcam into Redis can be done by encoding the imageinto binary or base64 format However, retrieving and viewing these images can bemore complex Redis is a fast and flexible key-value data store, suitable for storingtemporary data or data that needs quick access However, Redis is not a multimediadatabase management system, so storing and retrieving images may not be optimal.Storing images in Redis can quickly fill up RAM, especially if you store many images
or large images If you need to store and retrieve images frequently, you might need toconsider using a database management system designed for multimedia storage.Moreover, viewing images from a webcam also depends on other factors such as thequality of the webcam, network connection speed, and the software used to view theimages
1.3 Database Connection and Data Storage
Our research starts by creating an account to take information of HostName,Port Number, and Password to save user's information into the Database
All information about a person is saved such as Name, Position (Student orLecturer), and Time when checking attendance We have this information by taking apicture or having a video of a person who wants to check attendance Redis Databasehelps us to store and retrieve data quickly for processing and delivering the final result
Trang 28Figure 9: Redis’s data sampling and storing - Student Registration
2 Implement Face Detection and Face Recognition Algorithms
2.1 Distance and Similarity Methods
2.1.1 Distance
a Euclidean Distance
Euclidean Distance (ED) is a fundamental mathematical concept applied infacial recognition research to quantify the similarity between faces While it offers asimple and efficient approach, it has limitations that necessitate more sophisticatedtechniques in modern systems
Here's how ED is applied in scientific research on facial recognition that we'vestudied Firstly, ED plays a crucial role in classic algorithms like Eigenfaces (the keycomponents that capture the most significant variations across a set of face images)and Fisherfaces (addresses a limitation of Eigenfaces by employing LDA) for facialrecognition These algorithms project face images onto a lower dimensional spacewhere ED is used to measure similarity and identify known faces In addition, ED can
be used for both face verification (determining if a face belongs to a claimed identity)and identification (finding the closest match from a database) A threshold is set on thedistance - faces below the threshold are considered similar Lastly, ED can be applied
to analyze the positions of facial feature points to recognize facial expressions likehappiness, sadness, or anger
ED, while useful, faces challenges in real-world facial recognition due to itssensitivity to factors like changing lighting conditions, pose variations, and differentfacial expressions These are common in natural images making ED less reliable.Additionally, modern systems often work with complex, high-efficiency ED decreases
Trang 29To address these limitations, research has moved towards advanced techniqueslike metric learning Moreover, deep learning with CNNs offers a powerful solution, asthese models learn complex facial features and perform similarity matching in a waythat's robust to the variations that hinder ED.
● 2D Euclidean Distance
At its core, ED in 2D facial recognition is about measuring similarity within ageometric space First, key facial landmarks - like eyes, nose, mouth, and eyebrows -are pinpointed Their x and y coordinates are then compiled into a feature vector,which acts as a simplified, numerical representation of the face's 2D geometry Tocompare two faces, the ED is calculated between the corresponding landmarks of theirfeature vectors This provides a measure of how much the faces differ geometrically.Finally, a similarity threshold helps determine if the faces are close enough in this 2Dspace to potentially represent the same person
Figure 10: 2D Euclidean Distance
ED, while useful in 2D facial recognition, has limitations that impact itsaccuracy It's very sensitive to changes in pose (how the head is angled), lightingvariations, and occlusions like glasses or masks These factors significantly alter thedetected position of facial landmarks, leading to inaccurate distance calculations andpotential recognition failures Moreover, facial features in 2D can lack sufficientdistinguishing power, especially when dealing with large databases or when variationsare present This makes it less reliable for accurately identifying individuals Finally,2D images latch the 3D depth information crucial for robustly representing a face'sunique characteristics, further limiting the effectiveness of ED
Trang 30ED has diverse applications in 2D facial recognition For face verification, ithelps confirm if someone is who they claim to be A reference image of the claimedidentity is used to create a feature vector, which is then compared to the feature vector
of an unknown face A small ED implies a potential match In identification, ED can
be used to search a database for the face most similar to an unknown one The facewith the smallest distance is deemed the "closest match" However, this approach can
be less accurate in real-world settings Additionally, ED is used in facial expressionsanalysis - by tracking shifts in landmark positions over time, changes in distance cansignal basic expressions like happiness or surprise
Figure 11: 3D Euclidean Distance
While ED is a valuable tool in 3D facial recognition, it does face limitations.Calculating dense correspondence and a multitude of ED in 3D space can be extremelycomputationally demanding, making it potentially unsuitable for real-time applicationswith limited hardware resources Additionally, even with 3D information, severe