John Paul
John Paul
INTRODUCTION
Traditionally, schools and universities relied on methods like ID cards or passwords for
student identification. However, these methods can be slow and prone to errors. Facial
recognition technology offers a faster and more accurate alternative. It works by comparing a
student's face to a database of known faces using cameras and software. While it enhances
safety and saves time and money, it's crucial to address privacy, security, and fairness
concerns.
The project aims to implement a facial recognition system to accurately and efficiently verify
student identities in schools and universities. This modern and secure alternative to
traditional methods will improve the convenience and reliability of identity verification for
students. It also seeks to enhance student safety by preventing unauthorized access to
restricted areas.
1
1.4 Objectives of the Project
Develop and implement a facial recognition system for real-time student identification.
Integrate the system with existing school or university systems for seamless operation.
Provide training and support for staff and ensure compliance with relevant laws and
regulations.
1.5 Significance
Implementing facial recognition for student identity verification offers several benefits:
Overall, the implementation of a facial recognition system can enhance the efficiency,
security, and convenience of identity verification in schools and universities, providing a
safer and more modern learning environment for students.
There are some limitations to consider when implementing a facial recognition system for
student identity verification in schools and universities.
1. Firstly, the accuracy of facial recognition technology can be affected by factors such as
lighting conditions and changes in appearance, such as wearing glasses or growing a
beard. This may result in false negatives or false positives, which could cause
inconvenience and delays for students and staff.
2
2. Secondly, the cost of implementing a facial recognition system can be high, especially
for smaller schools or universities with limited budgets. This may make it difficult for
some institutions to justify the expense of implementing such a system.
3. Thirdly, some students and staff may have concerns about data privacy and security
when using a facial recognition system. It is important to address these concerns and
ensure that the system is compliant with all relevant laws and regulations regarding data
privacy and security.
4. Lastly, there may be cultural or social factors that make some students uncomfortable
with the use of facial recognition technology
5. It is important to consider these factors and ensure that the implementation of the
system is respectful and culturally sensitive.
1.7 Methodology
Agile Methodology is the methodology we intend to use, as it more flexible and iterative,
allowing for quick adaptation to changing requirements and feedback. It also emphasizes
collaboration and communication, which is essential in a project where multiple stakeholders
are involved, such as students, teachers, and administrators.
3
CHAPTER TWO
LITERATURE REVIEW
2.1 Introduction
Facial biometrics, hailed for its convenience and security, faces several challenges that
necessitate ongoing technological advancements and innovative solutions. This literature
review delves into the primary security challenges in facial biometrics, including spoofing
attacks, forced authentication, stealing numerical codes, data breaches, privacy concerns, and
biometric data theft. Each challenge is scrutinized, and strategies for addressing them are
discussed. The review draws upon reputable sources, incorporating insights from industry
experts and relevant conversations.
4
2.4 Stealing Numerical Codes
The theft of numerical codes representing facial features poses a significant threat in
facial recognition. Prevention strategies encompass liveness detection, 3D scanning, multi-
factor authentication, user interface design improvements, and the option to disable facial
recognition. A nuanced approach, considering the specific use case, is crucial in
implementing effective preventive measures against numerical code theft(Thales Group,
n.d.).
5
CHAPTER THREE
SYSTEM ANALYSIS AND DESIGN
1.1. INTRODUCTION
In this chapter, we embark on a detailed analysis and design of the attendance system
using facial recognition. The goal is to create an efficient and user-friendly solution for
attendance tracking in educational institutions.
6
1.2.2. System Functionalities
The system must encompass essential functionalities to fulfill its objectives. Facial
image capture and secure storage are fundamental, requiring compatibility with technologies
like OpenCV and Insightful Face. Recognition and authentication capabilities are pivotal,
demanding accuracy and efficiency. Automatic attendance marking based on successful
recognition ensures real-time data updates. Integration with existing Student Information
Systems (SIS) is paramount for data consistency. Reporting features should be robust,
allowing for customizable and detailed attendance reports. Privacy and security
considerations are critical, emphasizing adherence to regulations and the implementation of
robust measures to safeguard facial biometric data.
7
infrastructure, and potential ancillary expenses. Here's a breakdown of the economic
feasibility:
3.3.2.1 Open-Source Technologies
Cost Implication: Minimal
Rationale: The utilization of open-source technologies, such as OpenCV, InsightFace, Redis,
and Streamlit, significantly reduces software licensing costs. These technologies offer robust
functionalities without incurring direct expenses.
8
3.3.2.6 Scalability
Cost Implication: Potentially Moderate
Rationale: Scalability costs may be incurred if there is a need to scale up resources to
accommodate a growing user base. However, the pay-as-you-go model of cloud hosting
allows for cost-effective scaling based on demand.
The economic feasibility of the system is favorable due to the strategic use of open-
source technologies. The primary cost considerations lie in hosting and cloud infrastructure,
with potential additional expenses for security measures and scalability. The overall cost-
effectiveness is enhanced by the community-driven support for open-source tools,
minimizing licensing and development costs.
9
Prone to Errors: Manual recording is susceptible to errors, including accidental
omissions, duplicate entries, and illegible handwriting, leading to inaccuracies in
attendance data.
Time-Intensive: Verifying and managing manual attendance records is a time-
consuming process, diverting resources that could be better utilized elsewhere.
Limited Accessibility: Retrieving historical attendance data for analysis or auditing
purposes can be challenging due to the physical nature of paper registers.
10
Fig 3.1 Manual Attendance Data Flow Diagram
Description:
1. Manual Attendance Recording Process: The manual attendance process involves
recording attendance through paper-based registers and roll call.
2. Attendance Records Collection: The recorded attendance data is collected and
compiled, often manually, into a centralized record.
3. Verification and Record Management: The attendance records undergo verification
and are managed manually, involving cross-checking for errors and maintaining
physical records.
4. Accessing Historical Attendance Data: Historical attendance data is accessed as
needed, typically involving the retrieval of physical records for analysis or compliance
purposes.
11
3.4.4 Impact on Educational Institutions
The reliance on a manual attendance system affects educational institutions in several
ways:
Resource Intensity: Educational staff spend considerable time managing attendance-
related tasks that could be more efficiently handled through automation.
Accuracy Concerns: Inaccurate attendance records may lead to discrepancies in
student or staff attendance, impacting the overall reliability of institutional data.
Audit and Compliance Challenges: Meeting audit and compliance requirements
becomes more challenging when relying on manual processes for attendance tracking.
12
3.5.1 Automated Attendance Processes
The system leverages automation to streamline the attendance recording process:
Facial Recognition Technology: Utilizing facial recognition technology, the system
captures and verifies attendance without the need for manual input.
Real-Time Data Updates: Attendance data is updated in real-time, providing instant
access to current attendance information.
Efficient Record Keeping: Automated systems maintain a digital record of attendance,
eliminating the need for paper-based registers.
Error Reduction: Automation minimizes the risk of errors associated with manual data
entry, ensuring more accurate attendance records.
Time Efficiency: The system significantly reduces the time and effort expended on
attendance-related tasks, allowing staff to focus on more value-added activities.
Real-Time Accessibility: Instant access to real-time attendance data facilitates quicker
verification and analysis, enhancing overall operational efficiency.
Improved Audit Trail: The digital nature of the system provides a comprehensive audit
trail, simplifying compliance with audit and regulatory requirements.
13
3.5.3.1 InsightFace Integration: Facial Recognition Technology
InsightFace is a deep learning-based facial recognition framework that has been
integrated into the system. Its role includes:
Facial Feature Extraction: InsightFace is utilized to extract facial features from input
images, enabling the system to uniquely identify individuals based on their facial
characteristics.
Verification and Matching: The facial embeddings obtained from InsightFace are used
for real-time verification and matching against the pre-registered facial features,
allowing the system to accurately identify individuals.
Storage of Facial Features: Redis serves as the storage backend for the facial features
of registered individuals. The system utilizes Redis hashes to store and retrieve these
features.
Real-Time Data Updates: Attendance records and related information are updated in
real-time within the Redis database, ensuring instant access to the latest attendance
data.
User Interface Development: Streamlit is employed to design the user interface of the
application. It provides a simple and intuitive interface for administrators to interact
with the attendance system.
Real-Time Data Display: Streamlit facilitates the real-time display of attendance data,
making it accessible and comprehensible for users.
14
3.5.3.4 WebRTC Streamer: Real-Time Video Streaming
WebRTC Streamer is utilized for real-time video streaming within the application. Its roles
include:
Video Frame Callbacks: WebRTC Streamer enables the capture and processing of
video frames from the webcam or other video sources. This is essential for real-time
facial recognition during attendance verification.
Integration with Streamlit: The real-time video stream is seamlessly integrated into the
Streamlit user interface, enhancing the user experience.
Image Processing: OpenCV functions are employed for image manipulation, including
tasks such as drawing rectangles around detected faces, displaying text, and
processing video frames.
Real-Time Prediction: OpenCV is crucial for real-time prediction, where it processes
video frames, applies facial recognition, and overlays relevant information.
Video Frame Conversion: `av` facilitates the conversion of video frames to and from
the necessary formats, ensuring compatibility with different components of the
system.
15
Dataframe Operations: Pandas is employed for creating and manipulating dataframes,
facilitating the organization and analysis of attendance-related data.
16
Fig 3.2 Manual Attendance Data Flow Diagram
1.1. Merits and Demerits
In evaluating the automated attendance system against the traditional manual approach,
a nuanced examination of their respective merits and demerits unveils critical insights.
Error-Prone:
Human errors in data entry and calculations pose a significant challenge for the manual
system. Inaccuracies in attendance records may compromise the reliability of the data.
17
1.1.3. Merits of Automated System
Efficiency and Accuracy:
The automated attendance system excels in efficiency and accuracy, streamlining attendance
processes and minimizing the likelihood of errors. This contributes to the production of
reliable attendance records.
Real-Time Tracking:
One of the standout features is the capability for real-time tracking of attendance during
events. This functionality enables prompt decision-making based on current attendance data.
Enhanced Reporting:
Automated systems offer enhanced reporting capabilities, facilitating the generation of
comprehensive attendance reports. This provides administrators with valuable insights for
analysis and strategic planning.
Technical Dependencies:
The reliance on technology introduces a vulnerability to interruptions. Technical issues, such
as power outages or system failures, may disrupt operations and impact the system's
immediate effectiveness.
Learning Curve:
The introduction of new technology brings with it a learning curve. Users may require time
to adapt to the automated system, especially if unfamiliar with such technologies.
Overcoming initial resistance and ensuring a smooth transition become crucial aspects of
implementation.
18
This comprehensive analysis tell us the nuanced aspects of both the traditional manual
system and the automated attendance system. Decision-makers can now navigate the trade-
offs, considering factors such as simplicity, cost-effectiveness, accuracy, real-time
capabilities, and the challenges associated with each approach.
19
CHAPTER FOUR
SYSTEM IMPLEMENTATION
1.2. INTRODUCTION
The journey from conceptualization to a tangible system begins with the system
design phase. In this pivotal stage, the agile methodology, known for its adaptability and
iterative approach, guides the translation of requirements into a detailed blueprint. The
proposed attendance system, conceived for efficient tracking and management, undergoes
meticulous design to ensure cohesion, scalability, and user-friendliness.
20
1.2.2. Alignment with Code Implementation
The design closely mirrors the code implementation, acknowledging the journey that
began with exploration in Jupyter Notebook and evolved into the more collaborative and
scalable environment of VS Code. This alignment ensures that the theoretical design is not
detached from the practical implementation, fostering a seamless transition from concept to
execution.
Responsibilities:
Capture user details during the registration process.
Validate and store user information securely.
Serve as the entry point for user-related data within the system.
Interconnectivity:
Initiates communication with the Real-time Face Recognition Module upon user
registration.
Facilitates the transfer of user data for real-time face recognition.
21
4.2.2 Real-time Face Recognition Module:
The Real-time Face Recognition Module is the technological powerhouse responsible for
processing live video streams, recognizing faces, and updating attendance records in real
time. Leveraging sophisticated facial recognition algorithms, this module ensures accurate
and prompt identification.
Responsibilities:
Process live video streams to detect and recognize faces.
Interface with the User Registration Module to update attendance records.
Utilize facial recognition algorithms for accurate identification.
Interconnectivity:
Receives user data from the User Registration Module for real-time recognition.
Communicates attendance updates back to the User Registration Module.
Responsibilities:
Generate detailed reports based on attendance data.
Access stored information from the User Registration and Face Recognition Modules.
Provide a user-friendly interface for report generation.
Interconnectivity:
Retrieves user and attendance data from the User Registration and Face Recognition
Modules.
Utilizes stored information to generate meaningful reports for administrators.
22
4.2.4 Interconnectivity Dynamics:
User Registration to Real-time Face Recognition:
1. User initiates registration, providing personal details.
2. User Registration Module securely stores the data.
3. Real-time Face Recognition Module is notified of new registrations.
4. Face recognition algorithms process live video streams, updating attendance records.
4.3.2 Frameworks
Streamlit:
Streamlit stands as the primary framework for web application development. Its simplicity
and rapid prototyping capabilities make it an ideal choice for creating interactive user
interfaces. The system's user-friendly registration forms, real-time face recognition display,
and report generation interfaces are all powered by Streamlit.
23
4.3.3 Tools and Libraries:
OpenCV:
OpenCV, a robust computer vision library, is strategically employed for image processing
tasks within the attendance system. From capturing video streams to implementing facial
recognition algorithms, OpenCV enhances the system's capabilities.
Redis:
The choice of Redis as the database solution stems from its fast data retrieval and storage
capabilities. Acting as the data repository, Redis efficiently manages user registrations and
attendance logs. The structured data storage within Redis aligns with the system's
requirements for quick and reliable access.
24
NOTE:
The technology stack's cohesive integration ensures a harmonious blend of languages,
frameworks, and tools, facilitating a development environment that is both effective and
efficient.
importstreamlitasst
import base64
from Home importface_rec
fromstreamlit_webrtcimportwebrtc_streamer
importav
import time
import threading
st.set_page_config(page_title='Predictions')
st.subheader('Real-Time Attendance System')
# time
waitTime=30# time in sec
setTime=time.time()
realtimepred=face_rec.RealTimePred() # real time prediction class
timenow=time.time()
difftime=timenow-setTime
ifdifftime>=waitTime:
setTime=time.time() # reset time
print('Save Data to redis database')
Fig 5.1 The integration of Python, Streamlit, OpenCV, and Redis within the VS Code development
environment.
25
4.3.4 Development Environment:
Jupyter Notebook to VS Code Transition:
The initial exploration and prototyping phase took place in Jupyter Notebook, providing a
dynamic and interactive environment for code experimentation. However, recognizing the
need for a more collaborative and scalable development approach, the transition to Visual
Studio Code (VS Code) was made. VS Code's versatility and extensive support for Python
development enhance the system's scalability and collaborative potential.
26
4.4 Database Design
A robust and efficient database design is integral to the seamless functioning of the
attendance system. This section delves into the structure of the chosen database, Redis, and
how it accommodates the storage and retrieval of user registrations and attendance logs.
27
Attendance Logs:
The 'attendance: logs' key stores a historical log of attendance records. Each log entry
includes the person's name, role, and the timestamp of the attendance update. The list
structure enables easy appending of new attendance records while maintaining a
chronological order.
r.lpush('attendance:logs', *encoded_data)
2. Scalability: Redis's ability to handle large datasets ensures the system's scalability. As
the number of user registrations and attendance records grows, Redis provides a reliable
foundation for accommodating increased data.
3. Simple Key-Value Structure: The simplicity of Redis's key-value structure aligns with
the straightforward storage requirements of user registrations and attendance logs. This
simplicity enhances both development and maintenance aspects.
28
4.4.4 Integration with Python
The interaction with Redis is seamlessly integrated into the Python codebase using the 'redis'
library. This library facilitates the connection, data manipulation, and retrieval operations
with the Redis database.
importredis
# insight face
frominsightface.appimportFaceAnalysis
fromsklearn.metricsimport pairwise
# time
import time
fromdatetimeimportdatetime
importos
r =redis.StrictRedis(host=hostname,
port=portnumber,
password=password)
defretrive_data(name):
retrive_dict=r.hgetall(name)
retrive_series=pd.Series(retrive_dict)
retrive_series=retrive_series.apply(
lambdax: np.frombuffer(x, dtype=np.float32))
index=retrive_series.index
index= list(map(lambdax: x.decode(), index))
retrive_series.index= index
retrive_df=retrive_series.to_frame().reset_index()
retrive_df.columns= ['name_role', 'facial_features']
retrive_df[['Name', 'Role']] =retrive_df['name_role'].apply(
lambdax: x.split('@')).apply(pd.Series)
returnretrive_df[['Name', 'Role', 'facial_features']]
29
This section elucidates the thoughtful design considerations behind the choice of
Redis as the database solution and outlines how the database schema supports the storage and
retrieval of critical data within the attendance system.
31
Fig 5.8 Reporting Interface (Register data)
This section outlines the design principles and components of the user interface within
the attendance system. The utilization of Streamlit, coupled with intuitive registration forms,
real-time face recognition displays, and a user-friendly reporting interface, ensures that users
can interact seamlessly with the system while enjoying a visually pleasing experience.
32
CHAPTER FIVE
SUMMARY, CONCLUSION AND RECOMMENDATIONS
5.1 SUMMARY
The Attendance System using Face Recognition is a robust solution designed to
revolutionize attendance tracking within educational institutions. This section provides a
comprehensive summary of the project, emphasizing key components, methodologies, and
expected outcomes.
33
5.1.5 System Outcome
The anticipated result is an Online Attendance System that processes student
submissions efficiently. The system will offer timely feedback and assignment reports to
teachers/lecturers for each student who submits an assignment.
5.2 CONCLUSION
The successful implementation of the Attendance System using Face Recognition
marks the culmination of an innovative approach to attendance tracking within educational
institutions. This section draws conclusions based on the objectives, methodologies, and
outcomes of the project.
Languages:
Python for the core logic and implementation.
Tools:
Streamlit framework for creating interactive web applications.
Redis database for efficient data storage and retrieval.
This pragmatic methodology, combined with the selected languages and tools, facilitated
rapid development, ensuring the system's adaptability to changing needs.
34
5.2.3 Technological Impact
The adoption of modern technologies, such as the Streamlit framework and Redis
database, significantly contributed to the system's effectiveness. These technologies
facilitated the rapid development of user interfaces and seamless integration with Python,
enhancing the overall user experience.
5.3 RECOMMENDATIONS
The culmination of the Attendance System using Face Recognition presents opportunities for
future enhancements and areas of consideration. The following recommendations aim to
guide further studies and improvements in the system:
1. Expand Scope: Future researchers are encouraged to expand the scope of the
attendance system by incorporating additional features or integrations that align with specific
35
institutional requirements. Exploring new functionalities can contribute to a more
comprehensive and adaptable system.
4. Security Review: While security was not a primary focus of this research, future
iterations should include a thorough security review. Assessing and enhancing data protection
measures will fortify the system against potential vulnerabilities and ensure the
confidentiality of sensitive information.
36
REFERENCES
1) Thales Group. (n.d.). Top facial recognition issues and concerns. Thales. Retrieved
from https://www.thalesgroup.com/en/markets/digital-identity-and-security/
government/inspired/facial-recognition-issues
1) Gawande, U., Joshi, P., Ghatwai, S., Nemade, S., Balkothe, S., Shrikhande, N. (2022).
Efficient Attendance Management System Based on Face Recognition. In: Tuba, M.,
Akashe, S., Joshi, A. (eds) ICT Systems and Sustainability. Lecture Notes in Networks
and Systems, vol 321. Springer, Singapore. https://doi.org/10.1007/978-981-16-5987-
4_12
3) Chetty, S., Sharma, N.A. (2023). Attendance Monitoring and Management Using
Facial Recognition. In: Hsu, CH., Xu, M., Cao, H., Baghban, H., Shawkat Ali, A.B.M.
(eds) Big Data Intelligence and Computing. DataCom 2022. Lecture Notes in
Computer Science, vol 13864. Springer, Singapore. https://doi.org/10.1007/978-981-
99-2233-8_27
37
APPENDIX A
Home.py
import base64
importstreamlitasst
add_logo("img/myimg.png")
38
APPENDIX B
“SOURCE CODE”
face_rec.py
importnumpyas np
import pandas aspd
import cv2
importredis
# insight face
frominsightface.appimportFaceAnalysis
fromsklearn.metricsimport pairwise
# time
import time
fromdatetimeimportdatetime
importos
r =redis.StrictRedis(host=hostname,
port=portnumber,
password=password)
defretrive_data(name):
retrive_dict=r.hgetall(name)
retrive_series=pd.Series(retrive_dict)
retrive_series=retrive_series.apply(
lambdax: np.frombuffer(x, dtype=np.float32))
index=retrive_series.index
index= list(map(lambdax: x.decode(), index))
retrive_series.index= index
retrive_df=retrive_series.to_frame().reset_index()
retrive_df.columns= ['name_role', 'facial_features']
retrive_df[['Name', 'Role']] =retrive_df['name_role'].apply(
lambdax: x.split('@')).apply(pd.Series)
returnretrive_df[['Name', 'Role', 'facial_features']]
39
# configure face analysis
faceapp=FaceAnalysis(name='buffalo_sc', root='insightface_model',
providers=[
'CPUExecutionProvider'])
faceapp.prepare(ctx_id=0, det_size=(640, 640), det_thresh=0.5)
# ML Search Algorithm
else:
person_name='Unknown'
person_role='Unknown'
returnperson_name, person_role
defreset_dict(self):
self.logs=dict(name=[], role=[], current_time=[])
defsaveLogs_redis(self):
# step-1: create a logs dataframe
dataframe=pd.DataFrame(self.logs)
# step-2: drop the duplicate information (distinct name)
dataframe.drop_duplicates('name', inplace=True)
# step-3: push data to redis database (list)
# encode the data
name_list=dataframe['name'].tolist()
role_list=dataframe['role'].tolist()
ctime_list=dataframe['current_time'].tolist()
encoded_data= []
for name, role, ctimeinzip(name_list, role_list,
ctime_list):
if name !='Unknown':
concat_string=f"{name}@{role}@{ctime}"
encoded_data.append(concat_string)
iflen(encoded_data) >0:
r.lpush('attendance:logs', *encoded_data)
self.reset_dict()
test_vector=embeddings,
41
name_role=name_role,
thresh=thresh)
ifperson_name=='Unknown':
color= (0, 0, 255) # bgr
else:
color= (0, 255, 0)
text_gen=person_name
cv2.putText(test_copy, text_gen, (x1, y1),
cv2.FONT_HERSHEY_DUPLEX, 0.7, color, 2)
cv2.putText(test_copy, current_time, (x1, y2+10),
cv2.FONT_HERSHEY_DUPLEX, 0.7, color, 2)
# save info in logs dict
self.logs['name'].append(person_name)
self.logs['role'].append(person_role)
self.logs['current_time'].append(current_time)
returntest_copy
# Registration Form
classRegistrationForm:
def__init__(self):
self.sample=0
defreset(self):
self.sample=0
defget_embedding(self, frame):
# get results from insightface model
results=faceapp.get(frame, max_num=1)
embeddings=None
for res in results:
self.sample+=1
x1, y1, x2, y2 = res['bbox'].astype(int)
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 1)
# put text samples info
text=f"samples = {self.sample}"
cv2.putText(frame, text, (x1, y1),
cv2.FONT_HERSHEY_DUPLEX, 0.6, (255, 255, 0),
42
2)
# facial features
embeddings= res['embedding']
# if face_embedding.txt exists
if'face_embedding.txt'notinos.listdir():
return'file_false'
#
os.remove('face_embedding.txt')
self.reset()
returnTrue
43