MSBTE Diploma Project Report Viraj and Tanmay
MSBTE Diploma Project Report Viraj and Tanmay
DIPLOMA IN
COMPUTER ENGINEERING
SUBMITTED TO
CERTIFICATE
This is to Certify that the project report entitled “ FACE RECOGNITION ATTENDANCE
SYSTEM” Was successfully completed by Student of sixth semester Diploma in ( Computer
Engineering ) .
Guide HOD
ACKNOWLEDGEMENT
1
I would like to express my special thanks of gratitude to my project guide
Jenishkumar . K . Soni as well as our principal Dr. Ganesh Mali who gave me
the golden opportunity to do this wonderful project on the topic FACE
RECOGNITION ATTENDANCE SYSTEM, which also helped me in doing a lot of
research and i came to know about so many new things I am really thankful to
them.
Secondly I would also like to thank my parents and friends who helped me a
lot in finalizing this project within the limited time frame.
TABLE OF CONTENTS
CONTENTS PAGE
NO.
1 ABSTRACT 4
2 INTRODUCTION 5
3 LITERATURE SURVEY 6
4 SCOPE OF PROJECT 7
5 METHODOLOGY 8
2
Chapter Name Month &
Year
7 SOURCE CODE 14
8 OUTPUT 28
# APPENDIX 33
# REFERENCES 34
1. ABSTRACT
System Overview:
Enrollment Phase: Individuals (e.g., students or employees) are enrolled into the system by
capturing multiple facial images under varying conditions. These images are stored in a database
alongside unique identifiers such as names and identification numbers.
Attendance Recording: During attendance sessions, real-time images are captured and
processed. The system employs face detection algorithms, such as Haar Cascade Classifiers, to
identify and locate facial features within the captured images. Subsequently, face recognition
algorithms, like Local Binary Patterns Histogram (LBPH), analyze the facial features and
3
compare them against the stored database to find matches. A match leads to automatic marking
of attendance, recording details like the individual's name, ID, date, and time.
Advantages:
Efficiency: Automates the attendance process, reducing the time required compared to manual
methods.
Accuracy: Minimizes errors associated with manual entry and prevents proxy attendance.
Convenience: Simplifies attendance tracking for administrators and provides accessible records
for review.
2. INTRODUCTION
Key Features:
1. Face Detection: Detects faces in images captured by a camera.
2. Face Recognition: Identifies detected faces using facial recognition algorithms.
3. Attendance Marking: Marks attendance for recognized individuals in a database.
4. Real-time Reporting: Provides real-time attendance reports.
System Requirements:
1. Python: Version 3.6 or higher.
2. OpenCV: Version 4.0 or higher.
3. face_recognition: Version 1.3 or higher.
4. Camera: A webcam or external camera.
4
Chapter Name Month &
Year
Implementation:
The Face Recognition Attendance System can be implemented in various settings, including:
3. LITERATURE SURVEY
Introduction:
Face recognition attendance systems have gained popularity in recent years due to their accuracy
and efficiency. Python, with its extensive libraries and tools, has become a preferred choice for
developing such systems. This literature survey aims to provide an overview of existing face
recognition attendance systems using Python.
Background:
Face recognition technology uses algorithms to identify and verify individuals based on their
facial features. The process involves face detection, feature extraction, and matching. Python
libraries such as OpenCV, face_recognition, and deep learning frameworks like TensorFlow and
Keras have made it easier to develop face recognition systems.
Existing Systems:
1. Face Recognition Attendance System using OpenCV and Python: This system uses
OpenCV for face detection and recognition. It captures images, detects faces, and recognizes
individuals using the Eigenfaces algorithm.
2. Deep Learning-based Face Recognition Attendance System: This system utilizes a
convolutional neural network (CNN) to recognize faces. It uses the Keras deep learning
framework and achieves high accuracy.
3. Face Recognition Attendance System using face_recognition Library: This system uses
the face_recognition library to recognize faces. It captures images, detects faces, and
recognizes individuals using the HOG+SVM algorithm.
5
Challenges and Limitations:
1. Variability in Lighting Conditions: Face recognition systems can be affected by changes in
lighting conditions.
2. Pose and Orientation: Faces can be difficult to recognize when they are not in a frontal
pose or are oriented at an angle.
3. Facial Expressions and Occlusions: Facial expressions and occlusions can affect the
accuracy of face recognition systems.
Future Directions:
1. Improving Robustness to Variability: Developing systems that can handle variations in lighting
conditions, pose, and orientation.
2. Increasing Accuracy: Exploring new algorithms and techniques to improve the accuracy of
face recognition systems.
3. Real-time Processing: Developing systems that can process faces in real-time.
4. SCOPE OF PROJECT
Functional Requirements:
1. Face Detection Algorithm: Implementing a face detection algorithm to detect faces in
images.
2. Face Recognition Algorithm: Implementing a face recognition algorithm to recognize
detected faces.
3. Attendance Marking System: Developing a system to mark attendance for recognized
individuals.
4. User Authentication: Implementing user authentication to ensure only authorized
personnel can access the system.
5. Data Backup: Implementing a data backup system to prevent loss of attendance
records.
Non-Functional Requirements:
1. Performance: Ensuring the system can detect and recognize faces in real-time.
2. Accuracy: Ensuring the system can accurately recognize faces and mark attendance.
3. Security: Ensuring the system is secure and protects sensitive data.
6
Chapter Name Month &
Year
4. Usability: Ensuring the system is user-friendly and easy to navigate.
Deliverables:
1. Face Recognition Attendance System: A fully functional face recognition attendance
system.
2. User Manual: A user manual outlining the system's features and usage.
3. Technical Documentation: Technical documentation outlining the system's architecture
and implementation.
4. Testing and Quality Assurance: Testing and quality assurance to ensure the system
meets the required standards.
5. METHODOLOGY
7
Phase 4: Testing and Quality Assurance:-
1. Unit Testing: Perform unit testing to ensure that each component of the system is working
correctly.
2. Integration Testing: Perform integration testing to ensure that the components of the
system are working together correctly.
3. System Testing: Perform system testing to ensure that the system is working correctly.
8
Chapter Name Month &
Year
Key Components:
1. Face Detection Module: Uses OpenCV to detect faces in images.
3. Attendance Marking Module: Marks attendance for recognized individuals and stores
records.
5. User Interface: Provides GUI or CLI for administrators to manage attendance records.
8. System Requirements: Requires Python, compatible OS, sufficient RAM, and storage.
Design Process:
9
- Define project scope and objectives
10
Chapter Name Month &
Year
- Implement user authentication and authorization
3. Detect Face: Use OpenCV's Haar Cascade Classifier to detect faces in the image.
1. Extract Face Features: Extract face features from the detected face using
face_recognition.
2. Compare with Database: Compare the extracted face features with the faces stored in
the database.
11
Step 4: Data Storage and Retrieval:-
2. Retrieve Attendance Records: Retrieve attendance records for individuals from the
database.
12
Chapter Name Month &
Year
1. Generate Attendance Reports: Generate attendance reports for individuals and
classes. 2. Send Reports: Send attendance reports to administrators and
parents.
# engine = pyttsx3.init()
# engine.say("Welcome!")
# engine.say("Please browse through your options..")
# engine.runAndWait()
def text_to_speech(user_text):
engine = pyttsx3.init()
engine.say(user_text)
engine.runAndWait()
13
trainimage_path = "/TrainingImage"
if not
os.path.exists(trainimage_path):
os.makedirs(trainimage_path)
studentdetail_path = (
"./StudentDetails/studentdetails.csv"
)
attendance_path = "Attendance"
# to destroy screen
def del_sc1():
sc1.destroy()
14
Chapter Name Month &
Year
def testVal(inStr, acttyp):
if acttyp == "1": # insert
if not inStr.isdigit():
return False return True
titl = tk.Label(
window, text="CLASS VISION", bg="#1c1c1c", fg="yellow", font=("Verdana", 27, "bold"),
)
titl.place(x=525, y=12)
a=
tk.Label( window,
text="Welcome to CLASS VISION",
bg="#1c1c1c", # Dark background for the main
text fg="yellow", # Bright yellow text color
bd=10,
font=("Verdana", 35, "bold"),
)
a.pack()
ri = Image.open("UI_Image/register.png")
r = ImageTk.PhotoImage(ri) label1 =
Label(window, image=r)
label1.image = r
label1.place(x=100, y=270)
ai =
Image.open("UI_Image/attendance.png") a =
ImageTk.PhotoImage(ai) label2 =
Label(window, image=a)
label2.image = a
label2.place(x=980, y=270)
15
vi = Image.open("UI_Image/verifyy.png")
v = ImageTk.PhotoImage(vi) label3 =
Label(window, image=v)
label3.image = v
label3.place(x=600, y=270)
def TakeImageUI():
ImageUI = Tk()
ImageUI.title("Take Student Image..")
ImageUI.geometry("780x480")
ImageUI.configure(background="#1c1c1c") # Dark background for the image window
ImageUI.resizable(0, 0)
titl = tk.Label(ImageUI, bg="#1c1c1c", relief=RIDGE, bd=10, font=("Verdana", 30, "bold"))
titl.pack(fill=X) # image and title titl = tk.Label(
ImageUI, text="Register Your Face", bg="#1c1c1c", fg="green", font=("Verdana", 30,
"bold"),
)
titl.place(x=270, y=12)
# heading
a = tk.Label(
ImageUI,
text="Enter the details",
bg="#1c1c1c", # Dark background for the details label
fg="yellow", # Bright yellow text color bd=10,
font=("Verdana", 24, "bold"),
)
a.place(x=280, y=75)
# ER no lbl1 =
tk.Label( ImageUI,
text="Enrollment No",
width=10,
height=2,
bg="#1c1c1c",
fg="yellow", bd=5,
relief=RIDGE,
font=("Verdana", 14),
)
lbl1.place(x=120, y=130)
txt1 = tk.Entry(
ImageUI,
width=17, bd=5,
validate="key",
bg="#333333", #
Dark input
16
Chapter Name Month &
Year
background
fg="yellow", #
Bright text color for
input
relief=RIDGE,
font=("Verdana", 18, "bold"),
)
txt1.place(x=250, y=130)
txt1["validatecommand"] = (txt1.register(testVal), "%P", "%d")
# name lbl2 =
tk.Label( Imag
eUI,
text="Name",
width=10,
height=2,
bg="#1c1c1c",
fg="yellow",
bd=5,
relief=RIDGE,
font=("Verdana", 14),
)
lbl2.place(x=120, y=200)
txt2 =
tk.Entry( ImageUI,
width=17,
bd=5,
bg="#333333", # Dark input background
fg="yellow", # Bright text color for input
relief=RIDGE,
font=("Verdana", 18, "bold"),
)
txt2.place(x=250, y=200)
lbl3 =
tk.Label( ImageUI,
text="Notification",
width=10,
height=2,
bg="#1c1c1c",
fg="yellow", bd=5,
relief=RIDGE,
font=("Verdana", 14),
)
lbl3.place(x=120, y=270)
17
message = tk.Label(
ImageUI,
text="",
width=32,
height=2, bd=5,
bg="#333333", # Dark background for messages
fg="yellow", # Bright text color for messages
relief=RIDGE, font=("Verdana", 14, "bold"),
)
message.place(x=250, y=270)
def take_image():
l1 = txt1.get()
l2 = txt2.get()
takeImage.TakeImage(
l1,
l2,
haarcasecade_path,
trainimage_path,
message,
err_screen,
text_to_speech,
)
txt1.delete(0, "end")
txt2.delete(0, "end")
def train_image():
trainImage.TrainImage( haarcasecade
18
Chapter Name Month &
Year
_path, trainimage_path,
trainimagelabel_path, message,
text_to_speech,
)
r = tk.Button( window,
text="Register a new student",
command=TakeImageUI,
bd=10, font=("Verdana", 16),
bg="black", fg="yellow",
height=2, width=17,
)
r.place(x=100, y=520)
def automatic_attedance():
automaticAttedance.subjectChoose(text_to_speech)
r = tk.Button( window,
text="Take Attendance",
command=automatic_attedance,
bd=10,
font=("Verdana", 16),
bg="black",
fg="yellow", height=2,
width=17,
)
r.place(x=600, y=520)
def view_attendance():
19
show_attendance.subjectchoose(text_to_speech)
r = tk.Button( window,
text="View Attendance",
command=view_attendance,
bd=10, font=("Verdana",
16), bg="black",
fg="yellow", height=2,
width=17,
)
r.place(x=1000, y=520)
r =
tk.Button( window,
text="EXIT", bd=10,
command=quit,
font=("Verdana", 16),
bg="black",
fg="yellow",
height=2,
width=17,
)
r.place(x=600, y=660)
window.mainloop()
# automiticAttendance.py
import tkinter as tk
from tkinter import *
import os, cv2
import shutil import csv import
numpy as np from PIL import
ImageTk, Image import pandas
as pd import datetime import
time import tkinter.ttk as tkk
import tkinter.font as font
haarcasecade_path = "haarcascade_frontalface_default.xml"
trainimagelabel_path = ( "TrainingImageLabel\\
Trainner.yml"
)
20
Chapter Name Month &
Year
trainimage_path = "TrainingImage" studentdetail_path
=(
"StudentDetails\\studentdetails.csv"
)
attendance_path = "Attendance" # for
choose subject and fill attendance def
subjectChoose(text_to_speech): def
FillAttendance(): sub = tx.get()
now = time.time() future = now + 20
print(now) print(future) if sub ==
"": t = "Please enter the subject
name!!!" text_to_speech(t) else:
try:
recognizer = cv2.face.LBPHFaceRecognizer_create()
try:
recognizer.read(trainimagelabel_path)
except:
e = "Model not found,please train model"
Notifica.configure(
text=e, bg="black",
fg="yellow",
width=33,
font=("times", 15, "bold"),
)
Notifica.place(x=20, y=250)
text_to_speech(e) facecasCade =
cv2.CascadeClassifier(haarcasecade_path)
df = pd.read_csv(studentdetail_path)
cam = cv2.VideoCapture(0) font =
cv2.FONT_HERSHEY_SIMPLEX col_names =
["Enrollment", "Name"] attendance =
pd.DataFrame(columns=col_names) while True:
___, im = cam.read()
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
faces = facecasCade.detectMultiScale(gray, 1.2, 5)
for (x, y, w, h) in faces: global Id
21
timeStamp = datetime.datetime.fromtimestamp(ts).strftime(
"%H:%M:%S"
)
aa = df.loc[df["Enrollment"] == Id]["Name"].values
global tt
tt = str(Id) + "-" + aa
# En='1604501160'+str(Id)
attendance.loc[len(attendance)] = [
Id,
aa,
]
cv2.rectangle(im, (x, y), (x + w, y + h), (0, 260, 0), 4)
cv2.putText(
im, str(tt), (x + h, y), font, 1, (255, 255, 0,), 4
)
else:
Id = "Unknown"
tt = str(Id)
cv2.rectangle(im, (x, y), (x + w, y + h), (0, 25, 255), 7)
cv2.putText(
im, str(tt), (x + h, y), font, 1, (0, 25, 255), 4
) if
time.time() > future:
break
attendance = attendance.drop_duplicates(
["Enrollment"], keep="first"
)
cv2.imshow("Filling Attendance...", im)
key = cv2.waitKey(30) & 0xFF if key
== 27:
break
ts = time.time()
print(aa)
# attendance["date"] = date
# attendance["Attendance"] = "P"
attendance[date] = 1
date = datetime.datetime.fromtimestamp(ts).strftime("%Y-%m-%d")
timeStamp = datetime.datetime.fromtimestamp(ts).strftime("%H:%M:%S")
Hour, Minute, Second = timeStamp.split(":")
# fileName = "Attendance/" + Subject + ".csv"
path = os.path.join(attendance_path, Subject)
if not os.path.exists(path):
22
Chapter Name Month &
Year
os.makedirs(path)
fileName =
( f"{path}/"
+ Subject
+ "_"
+ date
+ "_"
+ Hour
+ "-"
+ Minute
+ "-"
+ Second
+ ".csv"
)
attendance = attendance.drop_duplicates(["Enrollment"], keep="first")
print(attendance)
attendance.to_csv(fileName, index=False)
Notifica.place(x=20, y=250)
cam.release()
cv2.destroyAllWindows()
import csv
import tkinter
root = tkinter.Tk()
root.title("Attendance of " + Subject)
root.configure(background="black")
cs = os.path.join(path, fileName)
print(cs) with open(cs, newline="")
as file:
23
reader = csv.reader(file)
r=0
for col in
reader:
c=0
for row in col:
label = tkinter.Label(
root,
width=10, height=1,
fg="yellow", font=("times",
15, " bold "), bg="black",
text=row,
relief=tkinter.RIDGE,
)
label.grid(row=r, column=c)
c += 1
r += 1
root.mainloop()
print(attendance) except:
f = "No Face found for attendance"
text_to_speech(f) cv2.destroyAllWindows()
24
Chapter Name Month &
Year
titl.place(x=160, y=12)
Notifica = tk.Label(
subject,
text="Attendance filled Successfully",
bg="yellow", fg="black",
width=33, height=2,
font=("times", 15, "bold"),
)
def Attf():
sub = tx.get() if sub == "":
t = "Please enter the subject name!!!"
text_to_speech(t) else:
os.startfile(
f"Attendance\\{sub}"
)
attf =
tk.Button( subject,
text="Check Sheets",
command=Attf,
bd=7, font=("times
new roman", 15),
bg="black",
fg="yellow",
height=2, width=10,
relief=RIDGE,
)
attf.place(x=360, y=170)
sub =
tk.Label( subject,
text="Enter Subject",
width=10, height=2,
bg="black",
fg="yellow", bd=5,
relief=RIDGE,
font=("times new roman", 15),
)
sub.place(x=50, y=100)
tx =
tk.Entry( subject,
width=15, bd=5,
bg="black",
fg="yellow",
relief=RIDGE,
font=("times", 30, "bold"),
25
)
tx.place(x=190, y=100)
fill_a =
tk.Button( subject,
text="Fill Attendance",
command=FillAttendance,
bd=7, font=("times new
roman", 15), bg="black",
fg="yellow", height=2,
width=12, relief=RIDGE,
)
fill_a.place(x=195, y=170)
subject.mainloop()
8. OUTPUT
26
Chapter Name Month &
Year
27
28
Chapter Name Month &
Year
9. RESULTS AND APPLICATIONS
Results:
2. Increased Efficiency: Automated attendance marking saves time and effort for
administrators and teachers.
Applications:
1. Educational Institutions: Schools, colleges, and universities can use the system to
automate attendance marking.
2. Corporate Offices: Companies can use the system to track employee attendance and
monitor workforce productivity.
3. Government Institutions: Government agencies can use the system to track attendance
of employees and citizens.
4. Event Management: Event organizers can use the system to track attendee attendance
and manage event
29
10.Conclusion and Future
The Face Recognition Attendance System using Python is a robust and efficient attendance
tracking mechanism. The system utilizes face recognition technology to identify individuals and
mark their attendance. The system consists of various components, including face detection, face
recognition, attendance marking, and data storage
Key Findings:
1. Accuracy: The system demonstrates high accuracy in face recognition and attendance marking.
2. Efficiency: The system automates attendance marking, reducing administrative tasks and
increasing productivity.
3. Security: The system provides a secure and tamper-proof attendance recording mechanism.
4. Scalability: The system can be easily scaled up or down to accommodate changing attendance
requirements.
Implications:
1. Educational Institutions: The system can be used to track student attendance, reducing
absenteeism and improving academic performance.
2. Corporate Offices: The system can be used to track employee attendance, improving
workforce productivity and reducing absenteeism.
3. Government Institutions: The system can be used to track attendance of employees and
citizens, improving transparency and accountability.
Future Directions:
1. Integration with Other Systems: Integrating the system with other systems, such as student
information systems or HR management systems.
30
Chapter Name Month &
Year
Recommendations:
2. Conducting Further Research: Conducting further research to improve the accuracy and
efficiency of the system.
3. Developing Advanced Features: Developing advanced features, such as facial expression
analysis and sentiment analysis, to enhance the system's functionality
1. Advanced Analytics:
- Develop advanced analytics to provide insights into attendance patterns and trends.
- Use machine learning algorithms to identify correlations and anomalies.
3. Security Enhancements:
- Implement advanced security measures to prevent data breaches and unauthorized access.
- Use encryption, secure authentication, and access controls.
4. Cloud-Based Deployment:
- Deploy the system on cloud-based platforms for scalability and flexibility. -
Enable easy access and management of attendance data.
5. Continuous Improvement:
- Continuously update and improve the system based on user feedback and technological
advancements.
- Ensure the system remains accurate, efficient, and secure.
31
11.APPENDIX
A: System Codebase:-
- Detailed listings of the source code used in the system, including face detection.
- Explanation of code modules and functions.
- References to external libraries and dependencies utilized.
B: Installation Guide:-
- Step-by-step instructions for setting up the system environment.
- Installation procedures for required software and libraries. - Configuration settings
and troubleshooting tips.
C: User Manual:-
- Instructions on how to operate the attendance system.
- Guidelines for enrolling new users and managing attendance records.
- Screenshots and user interface walkthroughs.
D: System Evaluation:-
- Performance metrics and accuracy rates of the face recognition system.
- Comparison with traditional attendance methods.
- User feedback and system usability analysis.
32
Chapter Name Month &
Year
12. REFERENCES
A. Scholarly Articles:
- Research papers that provide insights into face recognition algorithms and their applications in
attendance systems.
- User manuals for software and tools integrated into the system.
C. Online Resources:
- Documentation and tutorials from official websites of technologies used (e.g., OpenCV, Python
libraries).
- Community forums and discussion boards for troubleshooting and best practices.
33