0% found this document useful (0 votes)
374 views

Project Report On Attendance System Using Face Recognition

Uploaded by

Mohammed Yaseen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
374 views

Project Report On Attendance System Using Face Recognition

Uploaded by

Mohammed Yaseen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

CHAPTER 1.

INTRODUCTION

1.1 Introduction

In an era marked by technological advancements, the automation of


mundane tasks is becoming increasingly prevalent across various
domains. Among these, the automation of attendance tracking holds
immense significance for educational institutions, workplaces, and
other organizations. Traditional methods of attendance monitoring
often prove to be time-consuming, error-prone, and susceptible to
manipulation. To address these challenges and streamline the
attendance management process, the development of a face
recognition attendance system presents itself as a compelling
solution.

The face recognition attendance system aims to leverage the power of


computer vision and machine learning techniques to accurately and
efficiently record attendance. By harnessing the capabilities of face
detection and recognition algorithms, the system eliminates the need
for manual attendance marking, thereby saving time and resources
while enhancing data accuracy and security. Additionally, the
incorporation of a graphical user interface (GUI) facilitates user
interaction, making the system accessible and intuitive for
administrators and users alike.

This project report outlines the development and implementation of a


face recognition attendance system using Python programming
language, OpenCV library for image processing, Tkinter library for
GUI development, and various face detection and recognition

1
algorithms. The report encompasses a detailed description of the
system architecture, functionalities, methodologies, testing
procedures, and performance evaluation.

Through this project, we endeavor to demonstrate the feasibility and


effectiveness of employing face recognition technology in attendance
management systems. By providing a comprehensive overview of the
project's design, development, and testing processes, this report aims
to serve as a valuable resource for understanding the intricacies
involved in building and deploying face recognition-based solutions
for attendance tracking purposes.

1.2 Problem Definition:

 Problem Statement

Traditional methods of attendance tracking, relying on manual data


entry or physical methods such as paper-based sign-in sheets or
biometric scanners, often suffer from inefficiencies, inaccuracies,
and vulnerabilities.

 These outdated approaches result in significant time and


resource overheads for educational institutions, workplaces,
and organizations, leading to administrative burdens and
potential errors in attendance records. Moreover, manual
attendance marking is susceptible to manipulation and
impersonation, compromising the integrity and reliability of
attendance data.

 In light of these challenges, there is a pressing need for a


more efficient, accurate, and secure solution for attendance

2
management. The face recognition attendance system seeks
to address these shortcomings by harnessing the capabilities
of computer vision and machine learning technologies. By
automating the attendance tracking process through facial
recognition algorithms, the system aims to streamline
operations, eliminate manual intervention, and enhance the
integrity and security of attendance records.

1.3 Proposed Solution:

The proposed solution aims to develop an Attendance System using


Face Recognition leveraging Python and a variety of associated
libraries and tools. The system will offer a user-friendly graphical
interface built with Tkinter, allowing users to interact seamlessly
with the application. Utilizing OpenCV, specifically Haar Cascade
Classifier for face detection and the LBPH (Local Binary Patterns
Histograms) algorithm for face recognition, the system will
accurately identify individuals. The captured facial data will be
securely stored in a SQLite database, enabling efficient management
of user information and attendance records. Additionally, NumPy
will facilitate the handling of image data for processing and analysis
purposes. The Matplotlib library will enable the display of images
and visualizations within the GUI, enhancing user experience. The
implementation will involve integrating pre-trained deep learning
models from the face recognition library to ensure robust and
accurate recognition of individuals. Furthermore, the system will
incorporate features for user registration, attendance tracking,
viewing, and managing attendance records, offering a comprehensive
solution for organizations or institutions seeking an automated and
reliable attendance management system

3
1.4 Need of Project

The need for the Attendance System using Face Recognition arises
from the limitations and inefficiencies of traditional attendance
tracking methods. Here are the primary needs driving the
development of this project:

1. Accuracy and Reliability: Traditional methods such as manual


attendance marking or swipe cards are prone to errors and
manipulation. Face recognition technology offers a highly accurate
and reliable method for identifying individuals, minimizing the risk
of attendance fraud or errors.

2. Efficiency and Time-saving: Automating the attendance process


through face recognition eliminates the need for manual entry or
verification, saving time for both students and staff. This efficiency
translates into increased productivity and smoother operations within
organizations or educational institutions.

3. Enhanced Security: Face recognition provides an additional layer of


security by ensuring that only authorized individuals can mark their
attendance. This helps prevent unauthorized access to restricted areas
or sensitive information, improving overall security measures.

4. Data Integrity and Management: Storing attendance records in a


centralized database ensures data integrity and facilitates easy access
and management of attendance data. This centralized approach
streamlines administrative tasks related to attendance monitoring,
reporting, and analysis.

5. Adaptability to COVID-19 Measures: In the context of the


COVID-19 pandemic, contactless solutions like face recognition
become crucial for minimizing physical contact and adhering to

4
social distancing guidelines. The system enables attendance tracking
without the need for physical contact or shared surfaces, contributing
to a safer environment.

6. Scalability and Flexibility: The proposed system can be easily


scaled to accommodate varying numbers of users and locations,
making it suitable for small classrooms, large lecture halls, or
corporate environments. Additionally, the flexibility of the system
allows for customization and integration with existing infrastructure
or applications.

7. Modernization and Technological Advancement: Adopting


innovative technologies such as face recognition demonstrates an
organization's commitment to modernization and technological
advancement. It enhances the institution's reputation and
competitiveness while keeping pace with evolving industry standards
and expectations.

1.5 Scope:

The scope of the proposed attendance system using Haar Cascade and
LBPH face recognition algorithms encompasses several key
components. Firstly, the project will involve the development and
implementation of software capable of capturing, processing, and
recognizing faces in real-time using the Haar Cascade and LBPH
algorithms. This software will be designed to integrate seamlessly
with existing attendance management systems or operate as a
standalone solution. Additionally, the project will include the design
and deployment of a user-friendly interface for administrators to
manage attendance records, view reports, and configure system
settings. The system will be tested rigorously to evaluate its accuracy,
efficiency, and reliability under various environmental conditions and
with diverse user demographics. Furthermore, the scope extends to

5
documentation encompassing user manuals, technical specifications,
and guidelines for system maintenance and troubleshooting. Lastly,
the project will consider scalability and potential future
enhancements, such as incorporating advanced machine learning
techniques or integrating with biometric authentication systems for
enhanced security.

1.6 Objectives:

Enhance security with Attendance system that uses face recognition

 To Mark Attendance after detecting face

 To provide attendance report

 Provide security

 Increasing productivity i.e. elimination manual efforts

Automated Attendance Marking: The primary objective of the


system is to automate the attendance marking process by
leveraging face recognition technology. By detecting faces of
registered users within a given environment, the system aims to
mark attendance automatically without requiring manual
intervention. This eliminates the need for traditional methods
such as paper-based sign-in sheets or manual data entry, saving
time and resources for administrators and users.

Attendance Reporting: Another objective is to provide


comprehensive attendance reports and insights to administrators.
By capturing attendance data in real-time and storing it in a
structured format, the system enables administrators to generate
attendance reports for individual users, groups, or specified time

6
periods. This facilitates data analysis, trend identification, and
decision-making related to resource allocation, scheduling, and
performance evaluation.

Enhanced Security: Security is a crucial objective of the face


recognition attendance system. By employing biometric
authentication through facial recognition, the system enhances
security by ensuring that only authorized individuals can mark their
attendance. This reduces the risk of identity theft, buddy punching, or
unauthorized access, thereby safeguarding the integrity and reliability
of attendance records.

Productivity Improvement: The system aims to increase


productivity by eliminating manual effort associated with attendance
tracking. By automating repetitive tasks such as attendance marking,
data entry, and report generation, the system frees up valuable time
and resources that can be redirected towards more strategic and
value-added activities. This enhances overall organizational
productivity and efficiency.

7
CHAPTER 2. LITERATURE SURVEY

In this project, the proposed project aims to develop an attendance system


utilizing face recognition algorithms, specifically Haar Cascade and Local
Binary Patterns Histograms (LBPH). Haar Cascade is a robust method for
object detection, widely applied in facial recognition due to its ability to detect
features efficiently. LBPH, on the other hand, is renowned for its
effectiveness in recognizing patterns and textures within images, making it
suitable for identifying faces based on their unique characteristics. Previous
studies have demonstrated the effectiveness of both algorithms individually in
various applications, including attendance systems. However, limited research
has explored the integration of these two techniques within an attendance
system context. By conducting a literature review, this study seeks to
consolidate existing knowledge on Haar Cascade and LBPH algorithms, their
applications in face recognition systems, and potential synergies when
combined. Furthermore, the literature review will also explore previous
research on attendance systems employing similar methodologies, providing
insights into best practices, challenges, and opportunities for further
improvement in the proposed project.

2.1 Existing system:

Existing attendance systems often rely on manual methods such as paper-


based registers or electronic methods like swipe cards or PIN codes, each
presenting their own limitations. Paper-based systems are prone to errors,
time-consuming to manage, and lack real-time monitoring capabilities.
Electronic systems, while more efficient, may still face issues such as
card sharing or forgotten PINs. Overall, existing systems often lack the
accuracy, convenience, and security offered by advanced face recognition

8
technology, highlighting the need for a more sophisticated solution like
the proposed attendance system utilizing Haar Cascade&lbph.

 Limitations

• Accuracy and Reliability: While face recognition technology


has advanced significantly, it may still encounter challenges in
accurately identifying individuals under certain conditions such
as poor lighting, occlusions (e.g., wearing masks or
accessories), or variations in facial expressions.

• Hardware Requirements: Effective deployment of face


recognition systems often requires high-quality cameras and
sufficient computing power, which may pose constraints in
terms of cost and infrastructure, especially for organizations
with limited resources.

• Privacy Concerns: Face recognition technology raises


concerns regarding privacy and data security, particularly
regarding the collection and storage of individuals' biometric
data. Strict adherence to data protection regulations and ethical
considerations is crucial to mitigate privacy risks.

• User Acceptance and Adoption: Some users may express


concerns or reluctance towards the adoption of face recognition
technology due to perceived intrusiveness, surveillance
implications, or cultural sensitivities. Ensuring transparent
communication, addressing privacy concerns, and providing
opt-in/opt-out mechanisms can help foster user acceptance and
mitigate resistance to the system.

9
• Environmental Factors: Environmental factors such as
ambient lighting, background clutter, and crowd density can
impact the performance of face detection and recognition
algorithms, potentially leading to decreased accuracy or
reliability in crowded or poorly lit environments. Organizations
may need to optimize environmental conditions or implement
supplementary measures to mitigate these challenges.

• Scalability and Maintenance: As the number of users and


attendance records grows, the scalability and maintenance of
the system become critical considerations. Ensuring scalability
requires robust database management, efficient resource
utilization, and regular maintenance to address performance
bottlenecks, data integrity issues, and software updates.

10
CHAPTER 3. SYSTEM DEVELOPMENT

3.1 PROPOSED SYSTEM

To overcome all the problems in the existing system, we develop an


"Attendance system using Face recognition" to ease the operation. A
system is required which is being capable of elimination all the problems
and become useful to users and thus the new system is derived. It provides
security and enhance the accuracy by eliminating the proxy attendance
scenario. For Attendance there is no need for manual Attendance by just
scanning your face attendance will be mark with the exact time and date
We overcome the drawbacks of manual systems in proposed system by
adding feature like security and ease of procedure i.e. marking attendance
and avoiding the proxy attendance scenario.

3.2 Benefits:

1. Improved Accuracy: Utilizing advanced face recognition algorithms


like Haar Cascade and LBPH ensures higher accuracy in identifying
individuals, minimizing errors associated with traditional attendance
systems.

2. Improved Efficiency: The automated nature of the system reduces the


time and effort required for attendance tracking, both for administrators
and employees/students, leading to increased productivity.

3. Enhanced Security: Face recognition offers a secure authentication


method, reducing the risks associated with lost or stolen ID cards or
forgotten PINs. This helps prevent unauthorized access and ensures the
integrity of attendance data.

11
CHAPTER 4. PROJECT REQUIREMENTS.

System requirements specification

Software Requirements Specification (SRS) is the starting point of the


software development activity. Little importance was given to this phase in
the early days of software development. The emphasis was first on coding
and then shifted to design. As systems grew more complex. it become
evident that the goal of the entire system cannot be easily comprehended.
Hence need for the requirements analysis phase arose. Now, for large
software systems, requirements analysis is perhaps the most difficult
activity and also the most error prone. Some of the difficulty is due to the
scope of this phase. The software project is imitated by the client needs. In
the beginning these needs are in the minds of various people in the client
organization. The requirement analyst has to identify the requirements by
tacking to these people and understanding their needs. In situations where
the software is to automated a currently manuals process, most of the needs
can be understood by observing the current practice. The SRS is a means of
translating the ideas in the minds of the clients (the output) into formal
document (the output of the requirements phase).

4.1 Hardware Requirements:

1. Computer or server: A desktop computer or server capable of running


the face recognition software and handling the processing
requirements.

2. Camera: A high-resolution webcam or camera capable of capturing


clear images for facial recognition.

12
3. Memory (RAM): Minimum 4GB RAM for efficient processing,
though higher RAM capacity may be beneficial for handling larger
datasets and multiple concurrent users.

4. Processor: Multi-core processor (e.g., Intel Core i5 or higher) to


ensure smooth operation and real-time performance.

5. Storage: Adequate storage space to store the face recognition


software, datasets, and attendance records.

4.2 Software Requirements:

1. Operating System: Supported operating systems include Windows.

2. Development Environment: here we use Python programming


language and Visual Studio Code as an Development environment.

3. Face Recognition Libraries: Integration of face recognition libraries


such as OpenCV for Python, Dlib, or other similar libraries to
implement the Haar Cascade and LBPH algorithms.

4. Database Management System: Integration with a database


management system (e.g., MySQL, SQLite) for storing and managing
attendance records, user profiles, and system configurations.

5. User Interface Framework: Utilization of user interface frameworks


like Tkinter (for Python)

6. Additional Dependencies: Installation of additional dependencies and


libraries required for image processing, data manipulation, and
system integration as per the chosen development stack.

13
4.2.1 Tools &Technologies

1. Python:

 Python is a high-level, interpreted programming language


known for its simplicity and readability.

 It provides extensive libraries and frameworks suitable for


various tasks, including image processing, machine learning,
and GUI development.

 Python's syntax is concise and easy to understand, making it


ideal for rapid development.

2. OpenCV (Open Source Computer Vision Library):

 OpenCV is a widely-used open-source library for computer


vision and image processing tasks.

 It offers a comprehensive set of functionalities for image


manipulation, object detection, feature extraction, and more.

 Haar Cascade Classifier: A machine learning-based approach


utilized for object detection, including faces in images.

 LBPH (Local Binary Patterns Histograms) Algorithm: A


technique for face recognition, which extracts local binary
patterns from facial images and creates histograms for
recognition.

3. SQLite Database:

 SQLite is a lightweight, serverless, self-contained SQL


database engine.

 It's suitable for embedded systems and small to medium-scale


applications.

14
 SQLite databases are stored in a single file, making them easy
to manage and transfer.

 In the attendance system, SQLite is used for storing user


information, such as names and associated data.

4. GUI Development:

 Tkinter:

 Tkinter is Python's de facto standard GUI (Graphical


User Interface) toolkit.

 It provides a set of built-in GUI components, such as


buttons, labels, and entry fields, for creating
interactive applications.

 Tkinter is easy to use and suitable for developing


simple to moderately complex GUIs.

 Pillow (Python Imaging Library):

 Pillow is a fork of the Python Imaging Library (PIL),


providing support for opening, manipulating, and
saving many image file formats.

 It's used within the Tkinter GUI to display images and


perform basic image processing tasks.

5. NumPy:

 NumPy is a fundamental package for scientific computing in


Python.

 It provides support for large, multi-dimensional arrays and


matrices, along with a collection of mathematical functions to
operate on these arrays efficiently.

15
 NumPy is utilized for handling image data as arrays, enabling
efficient manipulation and processing.

6. Matplotlib:

 Matplotlib is a plotting library for Python.

 While primarily used for creating static, interactive, and


animated visualizations, it can also be employed for
displaying images and graphs within GUI applications.

 Matplotlib integrates seamlessly with Tkinter for embedding


plots and figures within GUI windows.

7. Face Recognition Library:

 The face recognition library in Python provides pre-trained


deep learning models for face detection, recognition, and
encoding.

 It simplifies the implementation of facial recognition


functionality in Python projects by providing a high-level
interface for performing these tasks.

 This library is crucial for accurately recognizing and


identifying faces within the attendance system.

8. Cascade Classifier Training:

 The project might involve training custom Haar Cascade


classifiers for specific objects or features.

 Tools such as OpenCV's Cascade Classifier Training tool can


be utilized for collecting positive and negative images,
training the classifier, and fine-tuning its parameters for
accurate detection.

16
CHAPTER 5. SYSTEM DESIGN
5.1 System Architecture
In this system user interact with system using GUI (graphical user
interface) from their system. User will enter details like name and number
and then click on capture then system will capture images of the user using
webcam and then captured images will be processed using OpenCV and
then it will be stored in the Training image folder in local system then the
model is trained on the images stored in Training image folder. If training
get successful then then user details will be stored in SQLite database.
When user mark attendance then image of user is captured using webcam
and then it is compared with all the faces trained the model if user is present
then it will fetch user details from the database and mark the user
attendance in Attendance.csv in local system with date and time which will
be processed using pandas and then user will be given a successful
notification when attendance is marked. If in case an unknown user tries to
mark attendance then system will capture the images and store it in Images
unknown folder.

5.1.1 system Architecture diagram

17
Fig 5.1.1 system Architecture diagram.

5.2 Implementation Plan:

1. Start the Project:

After starting the project, the GUI will appear on the screen and it
will show the buttons/options like take attendance, Register new
student, view attendance, etc.

2. Registration:

Initially, the user has to register his details with the application for
the first time. This is a one- time registration. The user has to enter
details like Enrollment no, student name to register its face with the
enrollment no and ID.

3. Face Registration:

Once the user registers, the details like student name & enrollment
no. now the system will take the picture of the student to make
variations and store it.

4. Taking attendance:

Now it’s time to take attendance the camera will detect the face of
student and will display its ID and name with which we have
registered the student.

5. Mark Attendance:

After detecting the face with the right name and ID we can mark the
attendance by pressing the ‘Q’ key. It will mark the attendance with
the exact time.

18
6. View Attendance:

To make sure that the attendance is marked successfully we can see


it by clicking on view attendance button

5.2.1 Workflow of the system

19
Fig 5.2.1 Workflow of the system

CHAPTER 6. SAMPLE CODE

 Captures images using the computer's webcam and saving them


along with some user details for training the facial recognition
model

def TakeImages():
global alphaerror, numerror, trained, done, invalidentry
Id = (entry0.get())
name = (entry1.get())
if (is_number(Id) and name.replace(" ", "").isalpha()):
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
harcascadePath = "haarcascade_frontalface_default.xml"
detector = cv2.CascadeClassifier(harcascadePath)
sampleNum = 0
while (True):
ret, img = cam.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = detector.detectMultiScale(gray, 1.3, 5)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0),
sampleNum = sampleNum + 1
cv2.imwrite("TrainingImage\\" + name + "." + Id + '.'
+ str(sampleNum) + ".jpg", gray[y:y + h, x:x + w])
cv2.imshow('frame', img)
if cv2.waitKey(100) & 0xFF == ord('q'):

20
break
elif sampleNum > 100:
break
cam.release()
cv2.destroyAllWindows()
conn = sqlite3.connect('Face.db')
c = conn.cursor()
c.execute("INSERT INTO StudentDetails (Id, Name)
VALUES (?, ?)", (Id, name))
conn.commit()
conn.close()
c5 = canvas.create_image(293.0, 485.5,
image=imagesaved)
canvas.after(6000, lambda: canvas.itemconfig(c5,
state='hidden'))
TrainImages()
else:
if (is_number(Id)):
c1 = canvas.create_image(293.0, 485.5,
image=alphaerror)
canvas.after(6000, lambda: canvas.itemconfig(c1,
state='hidden'))
if (name.replace(" ", "").isalpha()):
c2 = canvas.create_image(293.0, 485.5,
image=numerror)
canvas.after(6000, lambda: canvas.itemconfig(c2,
state='hidden'))
if (name.strip() == "" and Id.strip() == ""):

21
c3 = canvas.create_image(293.0, 485.5,
image=invalidentry)
canvas.after(6000, lambda: canvas.itemconfig(c3,
state='hidden'))
if (is_number(name) and Id.replace(" ", "").isalpha()):
c4 = canvas.create_image(293.0, 485.5,
image=invalidentry)
canvas.after(6000, lambda: canvas.itemconfig(c4,
state='hidden'))

def TrainImages():
recognizer = cv2.face.LBPHFaceRecognizer_create()
harcascadePath = "haarcascade_frontalface_default.xml"
detector = cv2.CascadeClassifier(harcascadePath)
faces, Id = getImagesAndLabels("TrainingImage")
recognizer.train(faces, np.array(Id))
recognizer.save("TrainingImageLabel\Trainner.yml")

conn = sqlite3.connect('Face.db')
c = conn.cursor()
c.execute("INSERT INTO TrainingDetails (ModelPath,
Date) VALUES (?, ?)", ("TrainingImageLabel\
Trainner.yml", datetime.datetime.now()))
conn.commit()
conn.close()

c4 = canvas.create_image(293.0, 485.5, image=trained)

22
canvas.after(6000, lambda: canvas.itemconfig(c4,
state='hidden'))

 Mark Attendance Using A Trained Model

def markattendance():

extra_window2 = tk.Toplevel()
WIN_WIDTH = 416
WIN_HEIGHT = 500
extra_window2.geometry(
f"{WIN_WIDTH}x{WIN_HEIGHT}+{(get_monitors()
[0].width - WIN_WIDTH) // 2}+{(get_monitors()[0].height -
WIN_HEIGHT) // 2}")
extra_window2.configure(bg="#FFFFFF")
extra_window2.title("Mark Attendance")

#performs real-time face recognition and attendance tracking


using a trained model
def TrackImages():
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read("TrainingImageLabel\Trainner.yml")
harcascadePath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(harcascadePath)

conn = sqlite3.connect('Face.db')
c = conn.cursor()
c.execute("SELECT * FROM StudentDetails")
df = pd.DataFrame(c.fetchall(), columns=['Id', 'Name'])

23
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
font = cv2.FONT_HERSHEY_SIMPLEX
col_names = ['Id', 'Name', 'Date', 'Time']
attendance = pd.DataFrame(columns=col_names)

ts = time.time()
date = datetime.datetime.fromtimestamp(ts).strftime('%Y-
%m-%d')
custom_name = entrycustomname.get().strip() # Get custom
name from entrycustomname
if custom_name != "":
fileName = f"Attendance\
Attendance_{date}_{custom_name}.csv"
else:
fileName = f"Attendance\Attendance_{date}.csv"

while True:
ret, im = cam.read()
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray, 1.2, 5)
for (x, y, w, h) in faces:
cv2.rectangle(im, (x, y), (x + w, y + h), (225, 0, 0), 2)
Id, conf = recognizer.predict(gray[y:y + h, x:x + w])
if conf < 50:
timeStamp =
datetime.datetime.fromtimestamp(ts).strftime('%I:%M:%S %p')
# Include AM/PM in the timestamp
aa = df.loc[df['Id'] == Id]['Name'].values

24
tt = str(Id) + "-" + aa[0] # Assuming aa is an array,
select the first element which is the name
attendance.loc[len(attendance)] = [Id, aa[0], date,
timeStamp] # Use aa[0] to get the name without brackets
else:
Id = ' '
tt = str(Id)
if conf > 75:
noOfFile = len(os.listdir("ImagesUnknown")) + 1
cv2.imwrite(f"ImagesUnknown\
Image{noOfFile}.jpg", im[y:y + h, x:x + w])
cv2.putText(im, str(tt), (x, y + h), font, 1, (255, 255,
255), 2)

attendance = attendance.drop_duplicates(subset=['Id'],
keep='first')
cv2.imshow('Face Recognition Window (Press q to
close)', im) # Set the name of the window
key = cv2.waitKey(1)
if key == ord('q') or key == ord('Q'): # Close the window
if 'q' or 'Q' is pressed
break

attendance.to_csv(fileName, mode='a', header=not


os.path.exists(fileName), index=False)
c.execute("INSERT INTO AttendanceDetails (FileName,
Date) VALUES (?, ?)", (fileName, date)) # Insert file path into
AttendanceDetails table
cam.release()
cv2.destroyAllWindows()

25
c6 = canvas.create_image(207, 368, image=done)
canvas.after(6000, lambda: canvas.itemconfig(c6,
state='hidden'))
conn.close()
To remove Face from the system
def removeface():
global removed, deleteinvalid
def btn_clicked():
student_id = entry0.get()
if is_number(student_id):
conn = sqlite3.connect('Face.db')
c = conn.cursor()
c.execute("DELETE FROM StudentDetails WHERE Id=?",
(student_id,))
conn.commit()
conn.close()
images = glob.glob(f"TrainingImage\\.{student_id}..jpg")
for image in images:
os.remove(image)
print(f"User with ID {student_id} deleted successfully.")
c6 = canvas.create_image(209,380, image=removed)
canvas.after(6000, lambda: canvas.itemconfig(c6, state='hidden'))
TrainImages()
else:
c6 = canvas.create_image(211,380, image=deleteinvalid)
canvas.after(6000, lambda: canvas.itemconfig(c6, state='hidden'))
print("Invalid input. Please enter a valid ID.")

26
CHAPTER 7. IMPLEMENTATION

1. Graphical Interface

The Graphical interface is where all the functionalities are present:

 Such as mark user registration

 Attendance marking system

 View attendance

 View registered users

 Delete users

 View info

 View attendance on local system in csv

27
2. User Registeration

To Register User:

 Enter Roll No and Name on the Graphical interface.

 Click on add face button a new window will popup

28
 The new window will capture the images of person whom we want to
register.

 After clicking 75 images the window will closed and then model will
be trained on captured images

3. Mark and View Attendance

 Click on Mark Attendance button on GUI and then a new window


will popup.

 If you want to give custom name to the file just enter the name in
custom name format or it will be saved as default in date format

 And then click on start a new window will appear in which it will
detect the face and show the name and no of registered user

 After it is detected, you must click “Q” on the keyboard to mark


attendance

29
View Attendance

 Click on view attendance button on the GUI to view


attendance.

 It will show attendance in the table format.

 The table includes Id, Name, Date, & Time.

4. View and Delete registered users

30
 Click on View registered button to view registered user

 It will show registered users in table which include Id, Name

Delete users

 Click on remove face button to GUI to delete user

 After you click on remove face button a new window will pop up.

 Then enter the ID of the user whom you want to remove from the
system and then click on the remove button to remove user it will
delete every record like details, images, attendance.

 To remove all user from at once just click on clear all and everything
like user, images and everything will be deleted

31
CHAPTER 8. PERFORMANCE ANALYSIS

8.1 Testing

Software testing is a critical element of software quality assurance and


represents the ultimate review of specification, design and coding. In fact,
testing is the one step in the software engineering process that could be
viewed as destructive rather than constructive.

A strategy for software testing integrates software test case design methods
into a well- planned series of steps that result in the successful construction
of software. Testing is the set of activities that can be planned in advance
and conducted systematically. The underlying motivation of program
testing is to affirm software quality with methods that can economically and
effectively apply to both strategic to both large and small-scale systems

A strategy for software testing may also be viewed in the context of the
spiral. Unit testing begins at the vertex of the spiral and concentrates on
each unit of the software as implemented in source code. Testing progress
by moving outward along the spiral to integration testing, where the focus is
on the design and the construction of the software architecture. Talking
another turn on outward on the spiral we encounter validation testing where
requirements established as part of software requirements analysis are
validated against the software that has been constructed. Finally, we arrive
at system testing, where the software and other system elements are tested
as a whole.

8.2 TYPES OF TESTING:

8.2.1 WHITE BOX TESTING

White box testing, on the other hand, delves into the internal structure
and code of the system to evaluate its logic, algorithms, and data flow.

32
Testers analyze the source code and design tests based on the system's
implementation details, aiming to achieve thorough coverage of code
paths and functionalities. In the case of the face recognition attendance
system, white box testing would involve examining the algorithms used
for face detection and recognition, verifying the accuracy of database
operations, and assessing error handling mechanisms within the code.
Testers would write test cases targeting specific functions, methods, and
branches of the code to ensure they execute correctly and handle edge
cases appropriately. White box testing helps uncover bugs, logical errors,
and performance bottlenecks that may not be apparent through black box
testing alone, thus improving the overall quality and reliability of the
system.

8.2.2 BLACK BOX TESTING

Black box testing focuses on examining the functionality of the system


without considering its internal structure or code implementation details.
Testers interact with the system's user interface and input various data to
evaluate its responses and outputs. In the context of the face recognition
attendance system, black box testing would involve scenarios such as
registering new users, marking attendance, viewing attendance records,
and managing user data. Testers would verify that the system accurately
detects and recognizes faces, correctly records attendance, and displays
information as expected. They would also validate error handling
mechanisms by providing invalid inputs and ensuring appropriate error
messages are displayed. Black box testing ensures that the system meets
its functional requirements and behaves as intended from the user's
perspective

33
8.2.3 PERFORMANCE TESTING

In Software engineering, performance testing is testing that is performed


to determine how fast different purposes. It can demonstrate that the
system meets performance criteria. It can compare two systems to find
which performs better. Or it can measure what parts of the system or
workload cause the system to perform badly. In the diagnostic case,
software engineers use tool such as profilers to measure what parts of a
device or software contribute most to the poor performance or to
establish throughput levels for maintained acceptable response time and
check overall performance of our system.

34
8.3 Test cases

Case Test Input Expected


ID Cases output

Case1 Registra Provid Verify


tion of e ID that the
New and system
User Name captures
for a the user's
new image and
user. saves it
with
variations.

Case2 Taking Initiate Ensure


Attenda the that the
nce attenda system
nce- detects
taking faces
process present in
. the
environme
nt. Check
that it
matches
them with
the
registered
users'
faces.

Case3 View Reques Check that


Attenda t to the system
nce view retrieves
attenda and
nce displays
records the
for a attendance

35
specifi records
c date correctly.
or time
range.

Case4 Delete Select Verify


User a user that the
for system
deletio removes
n. the
selected
user's
details
from the
database.

36
CHAPTER 9. CONCLUSION

The development of the face recognition attendance system marks a


significant advancement in attendance management, leveraging state-
of-the-art technologies to streamline processes and enhance
efficiency. By integrating Haar cascade and LBPH algorithms within
a Python framework and implementing a user-friendly GUI using
Tkinter, the system offers a seamless experience for users and
administrators alike.

With features such as user registration, attendance tracking, viewing


attendance records, and user management, the system provides
comprehensive functionality to meet the diverse needs of educational
institutions, workplaces, and organizations. By capturing user images
during registration and creating variations for robust recognition, the
system ensures accuracy and reliability in attendance marking.

The adoption of face recognition technology not only eliminates


manual intervention and reduces the likelihood of errors but also
enhances security by leveraging biometric authentication. The
intuitive interface and easy navigation make it accessible to users of
all levels, contributing to widespread acceptance and adoption.

While the project demonstrates significant progress in attendance


management, there are opportunities for further enhancement and
refinement.
In conclusion, the face recognition attendance system represents a
transformative solution that addresses the challenges of traditional
system.

37
CHAPTER 10. FUTURE SCOPE

The face recognition attendance system presents a promising avenue


for further enhancement and expansion, offering numerous
opportunities for future development and refinement. Some potential
areas of future scope for this project include:

1. Enhanced Recognition Algorithms: Continued research and


development in the field of computer vision and machine learning can
lead to the adoption of more advanced facial recognition algorithms.
Integration of deep learning techniques such as convolutional neural
networks (CNNs) and recurrent neural networks (RNNs) could
further improve the accuracy and reliability of face detection and
recognition, especially in challenging environments with varying
lighting conditions and occlusions.

2. Multi-modal Biometric Integration: In addition to facial


recognition, the system could be extended to support multi-modal
biometric authentication, incorporating other biometric modalities
such as fingerprint recognition, iris recognition, or voice recognition.
This would provide additional layers of security and flexibility in
attendance verification, catering to diverse user preferences and
requirements.

3. Real-time Analytics and Insights: Integration of analytics and


reporting functionalities can enable administrators to gain valuable
insights into attendance trends, patterns, and anomalies.
Implementing real-time monitoring and reporting capabilities would
facilitate proactive decision-making, resource allocation, and
intervention strategies based on attendance data analysis.

38
4. Mobile and Cloud Integration: Expanding the system's
accessibility and flexibility by developing mobile applications and
cloud-based solutions would allow users to mark attendance remotely
and access attendance records from any device or location.
Leveraging cloud infrastructure can also enhance scalability, data
redundancy, and disaster recovery capabilities, ensuring uninterrupted
service availability.

5. Integration with Student Information Systems (SIS) and


Human Resource Management Systems (HRMS): Seamless
integration with existing SIS and HRMS platforms can streamline
data synchronization, automate administrative tasks, and provide a
unified platform for managing student or employee information,
schedules, and attendance records. This integration would enhance
efficiency, accuracy, and data integrity across organizational
workflows.

6. Adoption of Emerging Technologies: Exploring emerging


technologies such as edge computing, blockchain, and edge AI for
decentralized, secure, and efficient attendance management solutions
could offer novel approaches to addressing scalability, privacy, and
security concerns. These technologies have the potential to
revolutionize the way attendance data is captured, stored, and
verified, opening up new possibilities for innovation and disruption in
the field.

In conclusion, the future scope of the face recognition attendance


system is vast and diverse, encompassing technological
advancements, user experience enhancements, and integration with
existing systems. By embracing innovation and staying abreast of
evolving trends and technologies, the system can continue to evolve

39
and adapt to meet the evolving needs and challenges of attendance
management in diverse settings.

CHAPTER 11. REFERENCES

1. Attendance system using face recognition –


https://youtu.be/iY2z3FIRWQQ?si=CmcG9HYmuY4Mmjon
2. OpenCV Documentation:
https://docs.opencv.org/4.x/index.html
3. Tkinter Documentation:
https://docs.python.org/3/library/tkinter.html
4. Study of Implementing Automated Attendance System Using Face Recognition
Technique –
International Journal of Computer and Communication Engineering, Vol. 1, No. 2,
July 2012
5.

40

You might also like