UNIVERSITY OF CALCUTTA
A Project Report on
[Face Recognition Attendance System]
A project submitted part of the fulfillment of BSc (Hons) in Computer Science, Semester
VI, 2025 in the department of Computer Science, Sir Gurudas Mahavidyalaya.
Under the supervision of
[Prof. Debasish Barman]
Department of computer science
Sir Gurudas Mahavidyalaya
Submitted by
Roll no:- 223314-21-0010
Registration no:- 314-1111-0270-22
Roll no:- 223314-11-0002
Registration no:- 314-1211-0262-22
Roll no:- 223314-21-0017
Registration no:- 314-1114-0267-22
CERTIFICATE
This is to certify that the project entitled " Face Recognition Attendance
System " submitted for the requirement of 6 Semester of BSc in Computer
Science(Honours), University of Calcutta, has been carried out by
Debraj Shaw(Roll no:- 223314-21-0010 and Registration no:- 314-1111-0270-22),
Shradha Mishra(Roll no:- 223314-11-0002 and Registration no:- 314-1211-0262-
22),
Amit Shaw(Roll no:- 223314-21-0017 and Registration no:- 314-1114-0267-22),
under the supervision of Prof. Debasish Barman.
SIR GURUDAS MAHAVIDYALAYA, University of Calcutta
Prof. Debasish Barman
Project Supervisor
Dept. of Computer Science
SIR GURUDAS MAHAVIDYALAYA
Prof. Debasish Barman
Department In-Charge
Dept. of Computer Science
SIR GURUDAS MAHAVIDYALAYA
External Examiner
Acknowledgement
We wish to express our profound sense of gratitude of our project supervisor Prof.
Debasish Barman , Sir Gurudas Mahavidyalaya, University of Calcutta for his
support, inspiration and guidance. Has showed us different ways to approach a
problem. We have also learned from him/her that an approach needs to be
persistent to accomplish our goal. We are immensely grateful to him for giving
his valuable time and constant advice for discussing various ideas related to our
project work.
We are also thankful to our department, Department of Computer Science,
Sir Gurudas Mahavidyalaya, University of Calcutta; for providing us with the
required resources for working on this project,
Lastly, we like to express our heartiest gratitude to our parents, seniors and
our friends; and to all who have directly or indirectly extended their valuable
guidance and advice during the preparation of this project, which will give us
the continuous flow of inspiration to complete the project.
Dated :- 12th July , 2025
Name(s) :-
1.Debraj Shaw
2.Amit Shaw
3.Shradha Mishra
Table of Content
1. System Overview
o Project Objective
o Functional Workflow
o Key Features
2. Technologies Used
o Python (OpenCV, face_recognition, pyttsx3)
o PHP (Server-side scripting)
o MySQL (Database management)
o PHPMailer (Email OTP handling)
o HTML/CSS (Frontend design)
3. System Architecture
o Component Diagram
o Module-level Overview
o ER Diagram
o Data Flow Diagram (DFD)
4. Face Recognition Module (Python)
o Student Image Collection & Storage
o Face Encoding with face_recognition
o Webcam Activation and Frame Capture
o Real-time Face Matching
o Attendance Logging in MySQL
o Voice Feedback Integration
o Timeout and Exit Handling
5. Admin Management System (PHP & MySQL)
o Admin Login with Session Management
o Admin Registration with Validation
o Admin Dashboard Interface
▪ View Student Records
▪ View Attendance Logs
▪ Logout Functionality
6. Password Recovery Workflow
o Forgot Password Form
o OTP Generation and Email Dispatch (PHPMailer)
o OTP Verification
o Secure Password Reset
7. Database Design
o Database Schema Overview
o Tables Description
▪ admin
▪ students
▪ attendance
o Sample Data Snapshots
8. Security Considerations
o Session Handling and Access Control
o Email OTP Validation
o Password Mismatch Checks
o Image and Data Integrity
9. User Interface Design
o Admin Login Page
o Registration and Reset Pages
o Dashboard (Tables & Layouts)
o Error and Success Redirection Pages
10. Testing and Validation
o Test Scenarios for Face Matching
o Admin Authentication Tests
o OTP Verification Testing
o Exception Handling
11. Limitations & Future Enhancements
o Current Constraints
o Suggestions for Accuracy Improvements
o Face Dataset Scaling
o Cloud or Mobile Integration
12. Conclusion
o Summary of Project Goals
o Key Learnings and Outcomes
o Real-world Applications
13. Appendix
o Full Source Code (Python, PHP)
o Screenshots of Interfaces
o External Libraries and References
Abstract
This project presents a Face Recognition-Based Attendance
System designed to automate and streamline the attendance process
using biometric verification. The system integrates Python, PHP,
and MySQL to deliver a real-time, contactless, and efficient
attendance solution.
In the frontend, Python is used with OpenCV and face_recognition
libraries to detect and recognize student faces through a webcam. Pre-
stored facial images are encoded and matched against live video
input. On successful recognition, the system records the student’s
attendance along with date and time in a MySQL database, and
provides audio feedback using pyttsx3.
The admin panel, built using PHP, includes secure login, student
and attendance management, and password recovery through OTP
verification via PHPMailer. Admins can register, log in, view
records, and reset passwords through a clean, responsive dashboard.
By eliminating manual attendance methods, this system increases
accuracy, prevents proxy attendance, and enhances user experience.
It demonstrates the practical use of facial recognition and
automation in academic and organizational environments, offering a
scalable and secure solution for attendance monitoring.
Chapter – 1
1. System Overview
Project Objective
The Face Recognition-Based Attendance System aims to modernize and
simplify the process of marking student attendance in educational institutions.
The traditional method of calling out names or using paper-based records is not
only time-consuming but also prone to errors and manipulation such as proxy
attendance.
This system leverages computer vision and biometric identification to
automatically recognize students based on facial features and record their
attendance. The key objective is to create a contactless, secure, and efficient
attendance process that saves time, minimizes manual labour, and ensures
accurate tracking of student presence. Additionally, the system integrates a user-
friendly admin portal to manage student records, monitor attendance logs, and
reset credentials via OTP-secured email.
Functional Workflow
The functional workflow of the system is divided into several sequential stages to
ensure smooth operation and data integrity:
1. Student Image Enrollment:
o Students’ photographs are collected and stored in a designated folder
(e.g., uploads/), with filenames corresponding to their unique student
IDs.
2. Face Encoding:
o The Python module reads these images and generates numerical
encodings using the face_recognition library. These encodings
represent unique facial features.
3. Real-Time Face Recognition:
o When a student appears in front of the webcam, the system captures
the live frame using OpenCV.
o The system detects faces in the frame, encodes them, and compares
the encodings with the stored list.
4. Face Matching & Attendance Marking:
o If a match is found, the corresponding student ID is recorded along with
the current date and time in the MySQL database.
o A voice message is generated using pyttsx3 to confirm successful
attendance.
5. Admin Management:
o Admins can log in through a secure PHP interface to view attendance
records, manage student data, and handle password recovery through
OTP sent via email using PHPMailer.
6. Password Recovery Workflow:
o If an admin forgets their password, they can enter their registered email
to receive an OTP.
o After verifying the OTP, they can securely reset their password.
7. Output and Redirection:
o If recognition is successful, the system redirects to a success page
(student.html). Otherwise, it redirects to an error page (not_found.html).
This workflow ensures automation from image acquisition to database logging
and administrative control.
Key Features
Below are the primary features that make the system efficient and practical:
1. Real-Time Face Recognition:
o Uses Python and the face_recognition library to compare facial
encodings in real time.
o Ensures high accuracy under varied lighting and angles.
2. Automated Attendance Logging:
o Automatically updates the attendance table in MySQL without any
manual intervention.
o Reduces chances of tampering or errors.
3. Voice Feedback System:
o Confirms attendance using pyttsx3, enhancing interactivity and making
it more accessible.
4. Webcam Integration:
o Utilizes OpenCV to capture and process video frames from the
system’s webcam.
5. Admin Dashboard:
o Built using PHP and MySQL.
o Displays student and attendance data in tabular form.
o Allows logout, registration, and account recovery features.
6. OTP-based Password Reset:
o PHPMailer is used to send OTP to the admin’s registered email.
o Ensures that only verified users can reset credentials.
7. Session-Based Security:
o Admin access is protected using PHP sessions to prevent
unauthorized logins.
8. Frontend User Interface:
o Clean and responsive pages built with HTML/CSS.
o Includes login, registration, reset, and dashboard views.
9. Scalable Design:
o Can be extended to multiple users or institutions.
o Easy to integrate with mobile apps or cloud-based databases in the
future.
10. Efficient Error Handling:
• Handles exceptions such as unrecognized faces, missing images, or
database errors gracefully with alerts and redirections.
Chapter – 2
2. Techniques used
This system uses a combination of scripting, database, and machine learning
technologies to implement real-time face-based attendance tracking and secure
admin functionalities.
Python (OpenCV, face_recognition, pyttsx3)
Python is the core language for facial recognition and attendance logic.
• OpenCV is used to access the webcam and process image frames:
python
cap = cv2.VideoCapture(0) success,
frame = cap.read()
img_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
• face_recognition encodes and compares faces:
python
encode = face_recognition.face_encodings(img_rgb)[0]
matches = face_recognition.compare_faces(known_encodings, encode)
• pyttsx3 gives voice feedback:
python
engine = pyttsx3.init()
engine.say("Attendance recorded")
engine.runAndWait()
PHP (Server-side scripting)
PHP handles backend operations for the admin panel, login system, and
dashboard.
• Example: Admin session protection
php
session_start();
if (!isset($_SESSION['admin']))
{ header("Location:
login.html"); exit();
}
• Used with HTML forms for login, registration, and password reset.
MySQL (Database Management)
MySQL stores structured data in three primary tables: admin, students, and
attendance.
Sample attendance insertion via Python: python
cursor.execute("INSERT INTO attendance (student_id, date, time) VALUES (%s,
%s, %s)", (id, date, time))
• Data retrieval using PHP:
php
$result = $conn->query("SELECT * FROM attendance WHERE student_id =
'1001'");
PHPMailer (Email OTP Handling)
Used to send OTPs securely during password recovery.
• Example:
php
$otp = rand(100000, 999999);
$mail->Body = "Your OTP is: $otp";
$mail->send();
• Ensures only verified admins can reset their passwords.
HTML/CSS (Frontend Design)
• HTML builds forms for admin login, OTP verification, and dashboards.
• CSS provides styling and responsiveness for modern user experience:
css
.form-box {
background-color: #1e3a8a;
padding: 20px;
border-radius: 10px;
}
This integrated tech stack ensures the system is efficient, interactive, and secure—
leveraging Python for face processing, PHP for web control, and MySQL for reliable
data storage.
Chapter – 3
3. System Architecture
ER - diagram
Chapter – 4
4. Face Recognition Module (Python)
This is the core module of the system, responsible for performing all operations related to
face detection, recognition, and attendance logging. Python is used due to its powerful
libraries like OpenCV, face_recognition, pyttsx3, and MySQL connector.
Student Image Collection & Storage
Student images are stored in a local directory, commonly named uploads/. Each image file is
named after the student's unique ID (e.g., 1001.jpg). This naming convention allows easy
mapping between the image and the student’s identity.
python
path = 'uploads'
images = []
student_ids = []
for filename in os.listdir(path):
if filename.endswith('.jpg') or filename.endswith('.png'): img =
cv2.imread(os.path.join(path, filename))
images.append(img)
student_ids.append(os.path.splitext(filename)[0])
Face Encoding with face_recognition
The face_recognition library encodes facial features into 128-dimensional face
embeddings using deep learning. These encodings are stored in a list for later
comparison with real-time frames.
python
def findEncodings(images):
encodeList = []
for img in images:
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
encodes = face_recognition.face_encodings(img_rgb)
if encodes:
encodeList.append(encodes[0])
return encodeList
encodeListKnown = findEncodings(images)
Webcam Activation and Frame Capture
The webcam is activated using cv2.VideoCapture(0). Frames are read continuously in
a loop and resized to 25% of the original size for faster processing.
python
cap = cv2.VideoCapture(0)
while True:
success, frame = cap.read()
img_small = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
img_rgb = cv2.cvtColor(img_small, cv2.COLOR_BGR2RGB)
Real-time Face Matching
The captured frame is scanned for faces using face_recognition.face_locations. For
each detected face, encodings are generated and compared with the known encodings
using compare_faces and face_distance.
python
faces_cur_frame = face_recognition.face_locations(img_rgb) encodes_cur_frame
= face_recognition.face_encodings(img_rgb,
faces_cur_frame)
for encodeFace in encodes_cur_frame:
matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
faceDis = face_recognition.face_distance(encodeListKnown, encodeFace)
if len(faceDis) > 0 and matches[np.argmin(faceDis)]:
matched_id = student_ids[np.argmin(faceDis)]
match_found =
True break
Attendance Logging in MySQL
If a face is matched, attendance is recorded in the attendance table using
MySQL connector. The student’s ID, current date, and time are inserted into the
database.
python
import mysql.connector
from datetime import datetime
conn = mysql.connector.connect(
host="localhost",
user="root",
password="",
database="attendance_system"
)
cursor = conn.cursor()
now = datetime.now()
date = now.date()
time_now = now.time()
cursor.execute("INSERT INTO attendance (student_id, date, time) VALUES (%s, %s,
%s)", (matched_id, date, time_now))
conn.commit()
conn.close()
Voice Feedback Integration
The system uses pyttsx3 to provide audible feedback to the user, confirming
whether attendance was recorded successfully or not.
Python
import pyttsx3
engine = pyttsx3.init()
def speak(text):
engine.say(text)
engine.runAndWait()
speak(f"Attendance recorded for student ID {matched_id}")
Timeout and Exit Handling
The face recognition loop is designed to terminate either upon successful
recognition or after a predefined timeout (e.g., 5–7 seconds). This prevents
indefinite looping and allows user-friendly fallback.
python
start_time = time.time()
while True:
...
if match_found or (time.time() - start_time > 7):
break
cap.release()
cv2.destroyAllWindows()
If no match is found, the system redirects the user to a fallback HTML page
and plays a voice message:
python
speak("Face not recognized. Please try again.")
os.system("start chrome http://localhost/attandance/not_found.html")
Chapter -5
5. Admin Management System (PHP & MySQL)
This module handles authentication, dashboard display, and data management
for system administrators.
Admin Login with Session Management
The login system validates admin credentials against the database and initiates a
PHP session to maintain access control. If credentials match, the admin is
redirected to the dashboard.
Code Snippet:
php
session_start();
include 'db_connect.php';
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM admin WHERE username = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("s", $username);
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {
if ($password === $row['password']) {
$_SESSION['admin'] = $username;
header("Location:
admin_dashboard.php");
} else {
echo "<script>alert('Incorrect password');</script>";
echo "<script>alert('Admin not found');</script>";
}
Admin Registration with Validation
A simple form allows new admin users to sign up. The backend validates for
duplicate usernames and password mismatch.
Key Validations:
• Check if username already exists.
• Confirm password match.
Code Snippet:
php
$checkQuery = "SELECT * FROM admin WHERE username='$username'";
$result = $conn->query($checkQuery);
if ($result->num_rows > 0) {
echo "<script>alert('Username already exists');</script>";
} elseif ($password !== $confirm_password) {
echo "<script>alert('Passwords do not match');</script>";
} else {
$insertQuery = "INSERT INTO admin (first_name, last_name, username, email, password)
VALUES ('$fname', '$lname', '$username', '$email', '$password')";
$conn->query($insertQuery);
}
Admin Dashboard Interface
After successful login, the dashboard (admin_dashboard.php) displays:
• All registered student records from the students table.
• All attendance logs from the attendance table.
Student Records Table:
php
$result = $conn->query("SELECT * FROM
students"); while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>{$row['student_id']}</td>
<td>{$row['name']}</td>
...
</tr>";
}
Attendance Logs Table:
php
$result = $conn->query("SELECT * FROM
attendance"); while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>{$row['student_id']}</td>
<td>{$row['date']}</td>
<td>{$row['time']}</td>
</tr>";
}
Logout Functionality
Clicking the "Logout" button ends the session and redirects the user to the login
page.
Code:
php
CopyEdit
session_start();
session_unset();
session_destroy()
;
header("Location: admin_login.html");
Chapter -6
6. Password Recovery Workflow
This module ensures that administrators can securely reset their password in case
they forget it, using an OTP-based email verification system powered by
PHPMailer.
Forgot Password Form
The admin enters their registered email address into a form
(forgot_password.html). This email is then validated on the server.
HTML Snippet:
html
<form action="send_otp.php" method="POST">
<input type="email" name="email" placeholder="Enter your registered email"
required>
<button type="submit">Send OTP</button>
</form>
📧 OTP Generation and Email Dispatch (PHPMailer)
When the form is submitted, a 6-digit OTP is generated using PHP's rand()
function and stored in the session. PHPMailer sends the OTP to the provided
email address.
Code Snippet (send_otp.php):
session_start();
$email = $_POST["email"];
$otp = rand(100000, 999999);
$_SESSION['otp'] = $otp;
$_SESSION['reset_email'] = $email;
// Send email using PHPMailer
use PHPMailer\PHPMailer\PHPMailer;
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'your_email@gmail.com';
$mail->Password = 'your_app_password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('your_email@gmail.com', 'Attendance System');
$mail->addAddress($email);
$mail->Subject = 'OTP for Password Reset';
$mail->Body = "Your OTP is: $otp";
$mail->send();
OTP Verification
After receiving the OTP, the admin is prompted to enter it in a separate form
(verify_otp.html). The entered OTP is then matched against the session value.
HTML Snippet:
html
<form action="verify_otp.php" method="POST">
<input type="text" name="otp" placeholder="Enter OTP" required>
<button type="submit">Verify</button>
</form>
Code Snippet (verify_otp.php):
php
session_start();
$entered_otp = $_POST['otp'];
if ($entered_otp == $_SESSION['otp']) {
header("Location:
reset_password.html");
} else {
echo "<script>alert('Invalid OTP'); window.history.back();</script>";
}
Secure Password Reset
Once the OTP is verified, the user is redirected to a password reset form where
they enter and confirm a new password. This is then updated in the admin
table.
HTML Snippet:
html
<form action="reset_password.php" method="POST">
<input type="password" name="new_password" placeholder="New
Password" required>
<input type="password" name="confirm_password" placeholder="Confirm
Password" required>
<button type="submit">Reset Password</button>
</form>
Code Snippet (reset_password.php):
session_start();
$new_password = $_POST['new_password'];
$confirm_password = $_POST['confirm_password'];
$email = $_SESSION['reset_email'];
if ($new_password === $confirm_password) {
$query = "UPDATE admin SET password='$new_password' WHERE
email='$email'";
$conn->query($query);
echo "<script>alert('Password updated successfully');
window.location.href='admin_login.html';</script>";
} else {
echo "<script>alert('Passwords do not match'); window.history.back();</script>";
}
Chapter -7
7. Database Design
The system uses MySQL as its backend to store and manage all relevant data
— including administrator credentials, student records, and attendance logs.
Database Schema Overview
The database is named:
sql
attendance_system
It consists of three primary tables:
1. admin – stores admin login details.
2. students – holds student profile data.
3. attendance – logs face-based attendance records.
These tables are interlinked through the student_id field (used as a foreign key
in attendance table).
Tables Description
1. admin Table
Stores admin registration and login details.
Field Type Description
id INT (PK) Auto-incremented admin ID
first_nam VARCHAR(50 Admin's first name
e )
last_name VARCHAR(50 Admin's last name
)
username VARCHAR(50 Unique username
)
email VARCHAR(10 Registered email
0)
password VARCHAR(10 Stored password (plaintext /
0) hashed)
2. students Table
Contains records of all students whose faces are used for recognition.
Field Type Description
student_id VARCHAR(20 Unique student ID (e.g.,
) 1001)
name VARCHAR(10 Full name
0)
course VARCHAR(10 Enrolled course
0)
semester VARCHAR(20 Semester
)
department VARCHAR(10 Department name
0)
email VARCHAR(10 Student email
0)
4. attendance Table
Records the timestamp each time a student is successfully recognized.
Field Type Description
id INT (PK) Auto-incremented log ID
student_i VARCHAR(2 Foreign key from students
d 0) table
date DATE Date of attendance
time TIME Time of recognition
Chapter -8
8. Security Considerations
Security is a critical aspect of this system since it deals with biometric data
(face images), login credentials, and attendance records. The system integrates
various techniques to protect against unauthorized access and data misuse.
Session Handling and Access Control
• PHP sessions are used to ensure that only authenticated administrators
can access the dashboard and sensitive pages.
• After successful login, a session variable ($_SESSION['admin']) is set.
• Pages like admin_dashboard.php check for this session before rendering.
Example:
php
session_start();
if (!isset($_SESSION['admin'])) {
header("Location: admin_login.html");
exit();
}
This ensures that even if someone directly enters the URL, they will be
redirected unless authenticated.
Email OTP Validation
• OTP (One-Time Password) is sent to the registered admin email for
password recovery.
• The OTP is randomly generated and stored securely in the
$_SESSION variable.
• During verification, the entered OTP must exactly match the stored value.
Example:
php
$otp = rand(100000, 999999);
$_SESSION['otp'] = $otp;
• If the OTP doesn't match, access to the reset form is denied,
preventing unauthorized resets.
Password Mismatch Checks
• During registration and password reset, the system checks whether the
new password and confirm password fields match before updating the
database.
• This avoids errors and ensures intentional password setup.
Example:
php
if ($new_password !== $confirm_password) {
echo "<script>alert('Passwords do not match');</script>";
}
• Additional checks can be added to enforce password strength
(length, symbols, numbers, etc.).
Image and Data Integrity
• Only valid image formats (.jpg, .png) are accepted and stored in the
uploads/ directory.
• Each image is named by the student's unique ID (e.g., 1001.jpg) to
avoid confusion and ensure mapping consistency.
• Face encoding is done immediately after loading to verify face
presence and validity.
Example (face encoding check):
python
encodes =
face_recognition.face_encodings(img_rgb) if
encodes:
encodeList.append(encodes[0])
• This prevents non-face or corrupted images from being included
in the system.
These security considerations make the system reliable, tamper-resistant, and
safer for handling sensitive academic data.
Chapter -9
9. User Interface Design
The system's frontend is designed using HTML, CSS, and a bit of JavaScript to
ensure a clean, intuitive, and responsive experience for administrators. Each page
is built to serve a specific purpose in the attendance workflow.
Admin Login Page
• A simple, centered form where the admin enters their username and
password.
• Styled with gradients and responsive layout for mobile access.
• Invalid login attempts are handled with alert popups and redirection.
Example Snippet:
html
<form action="admin_login.php" method="POST">
<input type="text" name="username" placeholder="Username" required />
<input type="password" name="password" placeholder="Password" required />
<button type="submit">Login</button>
</form>
Registration and Reset Pages
• Registration Form: Admins can sign up by entering name, username,
email, and passwords (with confirmation).
• Forgot Password Page: Prompts email input to receive OTP via PHPMailer.
• Reset Password Page: Lets the user set a new password after
OTP verification.
Each form includes:
• Input validation
• Styled buttons and labels
• Modern blur and glassmorphism effects
Dashboard (Tables & Layouts)
After login, the admin lands on the Dashboard (admin_dashboard.php), which
contains:
• Student Records Table: Displays student ID, name, course,
semester, department, and email.
• Attendance Logs Table: Shows logs of student IDs with date and time.
• Logout Button: Safely ends the session and redirects to login.
Tables are responsive, styled with transparent overlays, hover highlights, and
are easy to read.
Example Table Style:
cs
table
{
background-color:
rgba(255,255,255,0.06); border-radius:
8px;
color: white;
}
Error and Success Redirection Pages
• If login fails, the user is shown an alert and redirected to the login page.
• If face is not recognized during attendance, they are
redirected to not_found.html.
• If attendance is successful, the student is shown student.html.
Example PHP Logic:
php
CopyEdit
if (!$match_found) {
echo "<script>alert('Face not recognized');
window.location.href='not_found.html';</script>";
}
Chapter -10
10. Testing and Validation
Thorough testing was carried out to ensure that all core functionalities work
reliably under different conditions. Both manual testing and scenario-based
validation were performed to identify and resolve bugs and usability issues.
Test Scenarios for Face Matching
• Known Face Detection
➤ Uploaded images were used for successful face recognition.
➤ Expected Result: Attendance should be marked and feedback provided.
➤ Status: Passed
• Unknown Face Detection
➤ A face not in the uploads/ folder was shown to the webcam.
➤ Expected Result: Face should not be matched; redirected to
not_found.html.
➤ Status: Passed
• Multiple Faces in Frame
➤ Two people stood in front of the webcam.
➤ Expected Result: System should match the closest valid face.
➤ Status: Passed
• Lighting Variations
➤ Tested under different light conditions to check reliability.
➤ Result: Moderate success; accuracy decreased in poor lighting.
Admin Authentication Tests
• Correct Credentials
➤ Valid username and password used.
➤ Expected Result: Redirect to dashboard.
➤ Status: Passed
• Incorrect Credentials
➤ Incorrect password or non-existing username tested.
➤ Expected Result: Alert message and return to login page.
➤ Status: Passed
• Session Validation
➤ Tried accessing dashboard without login.
➤ Expected Result: Redirected to login page.
➤ Status: Passed
📧 OTP Verification Testing
• Valid OTP
➤ Correct OTP entered after receiving email.
➤ Expected Result: Redirected to reset password page.
➤ Status: Passed
• Invalid OTP
➤ Wrong OTP manually entered.
➤ Expected Result: Alert and return to OTP input.
➤ Status: Passed
• Expired Session
➤ After long delay, tried submitting OTP.
➤ Expected Result: Session expired, redirection to start over.
➤ Status: Needs improvement
Exception Handling
• Database Disconnection
➤ Simulated MySQL failure by changing credentials.
➤ Expected Result: Error caught, user not stuck.
➤ Status: Caught and reported
• Empty Image Folder
➤ Ran Python script with no images in uploads/.
➤ Expected Result: System should not crash.
➤ Status: Needs validation message
• Invalid Image File
➤ Uploaded a corrupted/non-face image.
➤ Expected Result: Should skip or report invalid image.
➤ Status: Face encoding skipped silently
Chapter -11
11. Limitations & Future Enhancements
Despite the system’s robust design and functioning, there are a few limitations that
can be addressed in future versions to enhance accuracy, scalability, and usability.
Current Constraints
• No Password Encryption
Passwords for admin login are currently stored and compared in plain text.
This poses a security risk in real-world deployments.
• Limited Face Accuracy in Varying Conditions
Face recognition accuracy can drop in low lighting, if the user is not directly
facing the camera, or if the face is partially covered.
• Single Webcam Input
The system currently supports only one camera feed. Large institutions with
multiple classrooms cannot use the system concurrently.
• Static Dataset Folder
Student images must be manually placed into the uploads/ folder, limiting real-
time user onboarding.
• No Facial Spoofing Detection
There is no mechanism to prevent spoofing using printed photos or digital
images.
Suggestions for Accuracy Improvements
• Lighting Normalization and Face Alignment
Using histogram equalization and image alignment before encoding can
improve face detection under poor lighting.
• Multiple Sample Images per Student
Allowing multiple images of each student (different angles, expressions)
would improve recognition accuracy.
• Face Anti-Spoofing Techniques
Implementing liveness detection using blink or head movement detection can
reduce the chance of impersonation.
• Dynamic Threshold Adjustment
Instead of using a fixed face distance threshold, adaptive methods can be used
based on average distances in real-time frames.
Face Dataset Scaling
• Automated Enrollment Portal
Future updates can include a student-side web or mobile form where they
can upload their images, which are validated and encoded server-side.
• Database-Based Storage of Encodings
Store face encodings in a dedicated MySQL table or a serialized file (e.g.,
.pkl using pickle) for faster lookup and easier scaling.
• Image Compression & Preprocessing
Add background cropping and face detection before storing images to
reduce dataset size and improve processing time.
Cloud or Mobile Integration
• Cloud-Based Attendance Logging
Shift the database to cloud platforms like Firebase or AWS RDS for
centralized, scalable, and secure attendance storage.
• Mobile Face Recognition App
Develop an Android/iOS app where students can check in using their
phone camera and location verification.
• Webcam Streams Over Network
Allow IP-based streaming for remote classrooms to capture student faces
via networked cameras.
• Admin Cloud Panel
Replace the local PHP dashboard with a cloud-hosted React or Django
admin panel with real-time data access and analytics.
Chapter -12
12. Conclusion
Summary of Project Goals
The Face Recognition-Based Attendance System was designed to replace
traditional, error-prone attendance methods with a biometric, automated
solution. By integrating Python-based facial recognition, MySQL database
logging, and a web-based admin interface, the system ensures accuracy,
security, and ease of access for institutions managing attendance records.
Key Learnings and Outcomes
Throughout this project, several technologies and concepts were practically
implemented:
• Computer Vision using face_recognition and OpenCV for real-time
detection and matching.
• Python Scripting for automated workflows, webcam handling, and
MySQL integration.
• Web Development using PHP, MySQL, and HTML/CSS for admin
dashboard and user management.
• Security Techniques such as OTP-based password reset and
session handling.
• Error Handling & Testing to ensure robustness in real-world scenarios.
The system is fully functional with integrated voice feedback, OTP password
recovery, and dashboard visualization—showing a complete end-to-end
solution.
Real-world Applications
This system can be effectively deployed in:
• Colleges and Universities for automating daily class attendance.
• Schools with biometric check-in for students or staff.
• Offices or Corporate Workplaces for logging employee entry times.
• Training Institutes or Coaching Centers to track student presence.
• Conference or Seminar Management for registration and
attendance tracking.
Its modular design also makes it adaptable for future upgrades like mobile
apps, cloud hosting, or multi-classroom integration.
Chapter -13
13. Appendix
Full Source Code (Python, PHP)
• Python Scripts
o main.py: Facial recognition, webcam handling, and MySQL
attendance update.
o Libraries used: cv2, face_recognition, pyttsx3, mysql.connector.
• PHP Files
o admin_login.php, dashboard.php, reset_password.php, etc.
o Handles session management, form validation, and data fetching.
References
1. OpenCV – Open Source Computer Vision Library
Website: https://opencv.org
Description: Used for capturing and processing video frames from the
webcam for real-time face detection.
2. face_recognition Python Library by Adam Geitgey
GitHub: https://github.com/ageitgey/face_recognition
Description: Built on dlib’s state-of-the-art face recognition, this library
is used for encoding and comparing face images.
3. pyttsx3 – Text-to-Speech Conversion Library in Python
PyPI: https://pypi.org/project/pyttsx3
Description: Provides voice feedback to confirm attendance status using
TTS (text-to-speech).
4. MySQL – Open Source Relational Database
Website: https://www.mysql.com
Description: Used for storing admin credentials, student details, and
attendance logs.
5. PHPMailer – A Full-Featured Email Creation and Transport Class for PHP
GitHub: https://github.com/PHPMailer/PHPMailer
Description: Sends OTP to admin email accounts securely during
password reset.
6. W3Schools – Web Development Tutorials
Website: https://www.w3schools.com
Description: Reference for HTML, CSS, PHP, and MySQL syntax during
frontend and backend development.
7. PHP Manual – Official Documentation
Website: https://www.php.net/manual/en/
Descripiton: Used for session handling,form processing, and SQL
queries in PHP.
8. Python Official Documentation
Website: https://docs.python.org/3/
Description: Referenced for Python syntax, modules, and error handling
practices.
9. Stack Overflow
Website: https://stackoverflow.com
Description: Community resource for debugging, troubleshooting code,
and implementation ideas.
10. GeeksforGeeks – Programming & Development Tutorials
Website: https://www.geeksforgeeks.org
Description: Used to understand database operations, PHP integration,
and Python scripts.