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

Automated Attendance System

The document presents a Mini Project Report on an Automated Attendance System developed by Yash Mahesh Kosumbkar, Paras Dhaneshwar Dhande, and Nehal Dhanraj Talele as part of their Bachelor of Information Technology Engineering program. The system utilizes face recognition technology to automate attendance tracking, ensuring accurate and efficient management of attendance records stored in an Excel file. The project aims to modernize attendance processes in educational institutions, addressing issues of manual tracking and data integrity.

Uploaded by

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

Automated Attendance System

The document presents a Mini Project Report on an Automated Attendance System developed by Yash Mahesh Kosumbkar, Paras Dhaneshwar Dhande, and Nehal Dhanraj Talele as part of their Bachelor of Information Technology Engineering program. The system utilizes face recognition technology to automate attendance tracking, ensuring accurate and efficient management of attendance records stored in an Excel file. The project aims to modernize attendance processes in educational institutions, addressing issues of manual tracking and data integrity.

Uploaded by

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

I

A Mini Project Report on

AUTOMATED ATTENDANCE
SYSTEM
submitted in partial fulfillment of the requirements of the Second Year of Bachelor of
Information Technology Engineering
By:

Yash Mahesh kosumbkar 2301624


Paras Dhaneshwar Dhande 2301611
Nehal Dhanraj Talele 2301644

Guide
Prof. A. D. Palsodkar

Department of Information Technology


Konkan Gyanpeeth College of Engineering
Karjat, Raigad – 410201

University of Mumbai (AY 2024-25)


II

CERTIFICATE

This is to certify that the Mini Project entitled “Automated Attendance


System” is a bonafide work of,

Yash Mahesh Kosumbkar (2301624)


Paras Dhaneshwar Dhande (2301611)
Nehal Dhanraj Talele (2301644)

submitted to the University of Mumbai in partial fulfillment of the


requirement for the award of the degree of “Second Year Of
Engineering”
in “Information Technology”.

( Prof. A. D. Palsodkar ) (Prof. Anup Kunte)

Guide Head of Department


III

Mini Project Approval

This Mini Project entitled “Automated Attendance System” by

Yash Mahesh Kosumbkar (2301624)


Paras Dhaneshwar Dhande (2301611)
Nehal Dhanraj Talele (2301644)

is approved for the degree of Second Year Engineering


in Information Technology.

` Examiners

1.............................................
(Internal Examiner Name & Sign)

2................................................
(External Examiner name & Sign)

Date:

Place:
IV

Declaration

I/We declare that this written submission represents my/our ideas in my/our own words
and where others' ideas or words have been included, I/We have adequately cited and
referenced the original sources. I/We also declare that I/We have adhered to all principles of
academic honesty and integrity and have not misrepresented or fabricated or falsified any
idea/data/fact/source in my/our submission. I/We understand that any violation of the above
will be cause for disciplinary action by the Institute and can also evoke penal action from the
sources which have thus not been properly cited or from whom proper permission has not
been taken when needed

Paras Dhaneshwar Dhande (2301611) -----------------------------

Yash Mahesh Kosumbkar (2301624) -----------------------------

Nehal Dhanraj Talele (2301644) -----------------------------

Date :-
V

CONTENT Page no.

Abstract 1
Acknowledgement 2
3
CHAPTER 1:OVERVIEW OF THE PROJECT

1.1 Introduction 4

1.2 Problem Statement 5


1.3 Objective 6
1.4 Hardware and Software Requirement 6
7
CHAPTER 2 :SYSTEM DESIGN

2.1 Modules for Administrator 8

2.2 Purpose of The System 9

2.3 Functionalities 10

2.4. Block Diagrams 11-12

13
CHAPTER 3 : IMPLEMENTATION

3.1 Registration Process 14-18

3.2 Attendance Monitor 19-26

3.3 GUI OF SYSTEM 27

CHAPTER 4 :CONCLUSION & 28


LIMITATIONS
4.1 Limitation of Project 29

4.2 Conclusion 30

4.3 Refrences 31
1

ABSTRACT
The Automated Attendance System is a Python-based application designed to automate
the process of attendance tracking using face recognition technology. This system is a
desktop application that can be accessed within an organization to streamline
attendance management. The project has been developed with a modular architecture,
ensuring centralized storage of attendance records in an Excel file. The application
leverages Python libraries such as face_recognition, OpenCV, and pandas for real-
time face detection, recognition, and data management.

The system captures live video feed from a webcam, detects faces, and matches them
with pre-registered student images to mark attendance. Attendance records are stored
with details such as the student's name, date, and time, ensuring accuracy and
reliability. The system has been designed to prevent duplicate entries during a session
and provides a user-friendly interface for administrators.

The entire project has been developed with a focus on real-time processing and data
consistency. The system architecture ensures scalability and reliability, with the
potential for future enhancements such as database integration and multi-camera
support. High care has been taken to ensure that the system adheres to proper validation
rules and maintains data integrity. The application provides a robust and efficient
solution for automating attendance processes in educational institutions and
organizations.
2

ACKNOWLEDGEMENT
It is with immense satisfaction and a sense of accomplishment that we have
successfully completed our project, Automated Attendance System Using Face
Recognition. We take this opportunity to express our heartfelt gratitude to everyone
who contributed to the successful completion of this work.
We extend our sincere gratitude to Prof. A.S.Kunte, Head of the Department of
INFORMATION TECHNOLOGY , for their invaluable guidance and constant support
throughout the project. Their encouragement and insights have been instrumental in
shaping this project.

We are deeply thankful to our Project Coordinator and Guide , Prof


A.D.Palsodkar , for their valuable suggestions, continuous support, and expert
guidance during every phase of the project. Their constructive feedback and
encouragement have been a source of motivation for us.We also wish to convey our
gratitude to all the members of the Project Panel and everyone who has directly or
indirectly contributed to the successful completion of this project. Their support and
cooperation have been invaluable.Finally, we thank our peers, friends, and family for
their encouragement and assistance,which have been a constant source of inspiration
throughout this journey.

.
3

CHAPTER 1

OVERVIEW OF THE PROJECT


4

1.1 Introduction:
The Automated Attendance System is a comprehensive solution designed to
automate the process of attendance tracking using advanced face recognition
technology. This system provides educational institutions and organizations with an
efficient and accurate way to manage attendance records. By leveraging real-time video
processing, the system captures live video from a webcam, detects faces, and matches
them with pre-registered student images to mark attendance.

The system is fast, reliable, and user-friendly, allowing administrators to track


attendance seamlessly. It eliminates the need for manual attendance tracking, reducing
errors and preventing proxy attendance. Attendance records are stored in an Excel file,
which can be accessed and analyzed easily. The system also ensures data consistency
by preventing duplicate entries during a session.

This attendance system is developed using Python programming language and


utilizes libraries such as face_recognition, OpenCV, and pandas for face detection,
recognition, and data management. It is designed as a desktop application, making it
accessible and easy to use. The primary aim of this system is to modernize the
attendance process, making it more efficient and accessible from anywhere. With the
use of this software, institutions can save time, improve accuracy, and enhance the
overall attendance management process.
5

1.2 Problem Statement :


Right now, taking attendance is done by hand using paper sheets. This old-
school method causes a bunch of headaches:

 Time-Consuming & Annoying: Teachers waste time calling names,


writing things down, and flipping through pages.
 Paper Records Are Risky: Attendance sheets can easily get lost, spilled
on, or even damaged in a fire or accident. Poof—data gone forever!
 Pandemic Problems: During health crises (like COVID), students and
teachers shouldn’t have to meet in person just to mark attendance.
 Searching Sucks: Need to check if a student was present last month?
Good luck digging through piles of paper—it’s slow and mistakes
happen.

So we need an upgrade from the manual system to computerized system


which keeps record of the Student information easily.
6

1.3 Objective :
 To allow only authorized administrators to access and manage the system.

 Automate the process of attendance tracking using face recognition technology.

 Reduce manual effort and clerical work by automating attendance recording and
management.

 Provide greater speed and efficiency in attendance tracking, reducing time consumption.

 Ensure accurate and reliable attendance records, preventing proxy attendance.

 Maintain a centralized record of attendance data for easy access and analysis.

 Provide a user-friendly interface so that even a beginner can operate the system and
manage attendance effortlessly.

 Enable real-time face recognition and attendance marking, ensuring seamless operation
during sessions.

 The project aims to modernize and automate the attendance process, making it more
efficient and accessible for educational institutions and organizations.

1.4 Hardware and Software Requirement

Processor 11th Gen Intel(R) Core(TM) i5-


1135G7 @ 2.40GHz 2.42 GHz
RAM 8.00 GB
Operating Windows 10
System
IDE Visual Studio Code
Database XAMPP Control Panel
7

CHAPTER 2

SYSTEM DESIGN
8

2.1 MODULES FOR ADMINISTRATOR

1. Attendance Report Module:


Description: The administrator can view the attendance report through the
application by logging into the system. The administrator must enter their username
and password on the login page and click on the "Login" button. Once logged in,
various services will appear on the screen. The administrator must click on the
"Attendance Report" button, and the attendance history, including student names,
dates, and times, will be displayed.

2. Student Registration Module:


Description: The administrator can register new students into the system by
uploading their images. After logging into the system with valid credentials, the
administrator must click on the "Student Registration" button. A new page will
appear where the administrator can upload the student's image and enter their details.
The system will encode the student's face and store it for future recognition.

3. Update Attendance Records Module:


Description: The administrator can update attendance records manually if required.
After logging into the system, the administrator must click on the "Update
Attendance" button. A new page will appear where the administrator can modify or
add attendance entries in the Excel file.

4. Delete Attendance Records Module:


Description: The administrator can delete attendance records if necessary. After
logging into the system, the administrator must click on the "Delete Attendance"
button. A new page will appear where the administrator can select and remove
specific attendance entries from the Excel file.

5. Live Monitoring Module:


Description: The administrator can monitor the live video feed from the webcam to
view real-time face recognition. After logging into the system, the administrator
must click on the "Live Monitoring" button. The system will display the live video
feed with the names of recognized students overlaid on the screen.
9

2.2 PURPOSE OF THE SYSTEM

i. SECURITY: The Automated Attendance System ensures a high level of data security.
Only authorized users can access the system, as it requires a valid username and
password to operate. This prevents unauthorized access and ensures the integrity of
attendance records

ii. DATA CONSISTENCY: The system maintains data consistency by preventing


duplicate entries during a session. Attendance is recorded only once per session for each
individual, ensuring accurate and reliable records.

iii. EASY RETRIEVAL OF DATA: Attendance data is stored in an Excel file, making it
easy to retrieve and analyze. Administrators can quickly access attendance records
using tools like Microsoft Excel or Python-based data analysis libraries.

iv. AUTOMATION OF PROCESS: The system automates key processes such as face
detection, recognition, and attendance recording. This reduces manual effort and
ensures that attendance is recorded accurately and efficiently in real-time
10

2.3 Functionalities provided by Automated


Attendance System :

 Provides the ability to recognize and identify students based on their pre-registered
facial data.

 The Automated Attendance System manages attendance records, including student


names, dates, and times, and stores them in an Excel file for easy access and analysis.

 Tracks all the information related to attendance, including the real-time detection of
faces and their recognition.

 Displays the name of the recognized student on the live video feed, providing
immediate feedback to the administrator.

 Ensures data consistency by preventing duplicate attendance entries during the same
session.

 Increases the efficiency of managing attendance by automating the process, reducing


manual effort, and saving time.

 Monitors and records attendance in real-time, ensuring accuracy and reliability.

 Manages the information of students, including their facial encodings and associated
names, for future recognition.
11

2.4.1 BLOCK DIAGRAM

ug
Application

Page 1 (Entry)
Webcam live preview
Face detection
(OpenCV)
Image capture button
Progress bar (5
images)
Student fields Back to entry button
(Name, DOB,
Gender, etc.)
Age validation
Start button
View records

ValidateInput& CalculateAge

GenerateUniqueStudentID

Saveto ExcelFile (Pandas)

Create Folder & Save Faces


(Organized by Student ID
12

2.4.2 BLOCK DIAGRAM

Generate Monthly Report


Button
13

CHAPTER 3

IMPLEMENTATION
14

3.1 Registration Process :


import cv2
import os
import pandas as pd
import tkinter as tk
from tkinter import Label, Entry, Button, ttk, messagebox
from tkcalendar import DateEntry
from datetime import datetime
from PIL import Image, ImageTk
import subprocess

# Create folder for storing face images


folder_path = "students_faces"
os.makedirs(folder_path, exist_ok=True)

# Excel file to store student data


excel_file = "students_data.xlsx"
if not os.path.exists(excel_file):
df = pd.DataFrame(columns=["Name", "Gender", "DOB", "Age"])
df.to_excel(excel_file, index=False)

# Load OpenCV face detector


face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades +
"haarcascade_frontalface_default.xml")

# Global Variables
cap = None
student_name = ""
gender = ""
dob = ""
age = 0
count = 0

# Initialize Tkinter
root = tk.Tk()
root.title("Student Face Registration")
root.geometry("900x600")

# Load images
15

try:
bg_image = Image.open("BGM.jpg").resize((900, 600), Image.LANCZOS)
bg_photo = ImageTk.PhotoImage(bg_image)
except:
bg_photo = None

try:
logo_image = Image.open("logokgce.png").resize((100, 100),
Image.LANCZOS)
logo_photo = ImageTk.PhotoImage(logo_image)
except:
logo_photo = None

# Page 1 - Student Details Entry


page1_frame = tk.Frame(root)
page1_frame.pack(fill="both", expand=True)

# Background
canvas = tk.Canvas(page1_frame, width=900, height=600)
canvas.pack(fill="both", expand=True)
if bg_photo:
canvas.create_image(0, 0, anchor="nw", image=bg_photo)
if logo_photo:
canvas.create_image(10, 10, anchor="nw", image=logo_photo)

# College Info
canvas.create_text(750, 30, text="Headmaster: Dr. VJ Pillewan",
font=("Arial", 12, "bold"), fill="black", anchor="e")
canvas.create_text(750, 50, text="Staff: Prof. Kunte, Mr. A. Palsodkar",
font=("Arial", 12), fill="black", anchor="e")

# Labels & Inputs


canvas.create_text(450, 150, text="Student Registration", font=("Arial", 20,
"bold"), fill="black")

name_label = Label(page1_frame, text="Name:", font=("Arial", 14),


bg="white")
name_entry = Entry(page1_frame, font=("Arial", 14))

gender_label = Label(page1_frame, text="Gender:", font=("Arial", 14),


bg="white")
gender_var = tk.StringVar()
16

gender_menu = ttk.Combobox(page1_frame, textvariable=gender_var,


font=("Arial", 14), values=["Male", "Female", "Other"], state="readonly")

dob_label = Label(page1_frame, text="Date of Birth:", font=("Arial", 14),


bg="white")
dob_entry = DateEntry(page1_frame, font=("Arial", 14), date_pattern="yyyy-
MM-dd", width=12)

# Place widgets
canvas.create_window(450, 200, window=name_label)
canvas.create_window(450, 230, window=name_entry)
canvas.create_window(450, 270, window=gender_label)
canvas.create_window(450, 300, window=gender_menu)
canvas.create_window(450, 340, window=dob_label)
canvas.create_window(450, 370, window=dob_entry)

# Function to proceed to face capture


def open_capture_page(event=None): # Add event parameter for Enter key
global student_name, gender, dob, age

student_name = name_entry.get().strip().title()
gender = gender_var.get()
dob = dob_entry.get()

if not student_name or not gender or not dob:


messagebox.showerror("Error", "Please fill all fields!")
return

# Calculate Age
age = datetime.today().year - datetime.strptime(dob, "%Y-%m-%d").year

# Check for duplicate entries


df = pd.read_excel(excel_file)
if student_name in df["Name"].values:
messagebox.showwarning("Duplicate Entry", "Student already
registered!")
Return

# Save details in Excel


new_entry = pd.DataFrame({"Name": [student_name], "Gender": [gender],
"DOB": [dob], "Age": [age]})
df = pd.concat([df, new_entry], ignore_index=True)
17

df.to_excel(excel_file, index=False)
# Proceed to face capture
show_capture_page()

# Buttons
next_button = Button(page1_frame, text="Next ➜", font=("Arial", 14),
command=open_capture_page, bg="#4CAF50", fg="white", padx=20)
canvas.create_window(450, 420, window=next_button)

# Bind Enter key to proceed to next page


root.bind("<Return>", open_capture_page)

# Page 2 - Face Capture


page2_frame = tk.Frame(root, bg="#f0f8ff")
video_label = Label(page2_frame, bg="#f0f8ff")
video_label.pack()

status_label_capture = Label(page2_frame, text="Capturing Face...",


font=("Arial", 14), fg="blue", bg="#f0f8ff")
status_label_capture.pack(pady=10)

Button(page2_frame, text="⬅ Back", font=("Arial", 14), command=lambda:


return_to_entry_page(), bg="red", fg="white").pack(pady=10)

# Function to start face capture


def show_capture_page():
global cap, count
count = 0
cap = cv2.VideoCapture(0)
page1_frame.pack_forget()
page2_frame.pack(fill="both", expand=True)
capture_faces()

def capture_faces():
global cap, count
if cap is None or not cap.isOpened():
return
ret, frame = cap.read()
if not ret:
return

gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)


18

faces = face_cascade.detectMultiScale(gray, scaleFactor=1.3,


minNeighbors=5, minSize=(100, 100))

for (x, y, w, h) in faces:


face = frame[y:y+h, x:x+w]
face_path = os.path.join(folder_path, f"{student_name}_{count}.jpg")
cv2.imwrite(face_path, face)
count += 1

cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)


status_label_capture.config(text=f"Captured {count}/5 images for
{student_name}", fg="blue")

if count >= 5:
status_label_capture.config(text=f"✅ {student_name} registered
successfully!", fg="green")
cap.release()
subprocess.run(["python", "n:\\project\\Mini Project\\Mini Project\\
Student_attendence Python-Project\\code\\01_facial updated.py"],
check=True)
return_to_entry_page()
return

frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)


img = Image.fromarray(frame)
img = ImageTk.PhotoImage(img)
video_label.img = img
video_label.config(image=img)
root.after(10, capture_faces)

def return_to_entry_page():
global cap
if cap:
cap.release()
page2_frame.pack_forget()
page1_frame.pack(fill="both", expand=True)

# Start Tkinter event loop


root.mainloop()
19

3.2 Attendance Monitor :


import face_recognition
import cv2
import numpy as np
import os
import pandas as pd
from datetime import datetime
import tkinter as tk
from tkinter import Label, Frame
from PIL import Image, ImageTk
import threading
import random
import time

# Load student images & encode them


path = "students_faces"
known_face_encodings = []
known_face_names = []

for filename in os.listdir(path):


img_path = os.path.join(path, filename)
img = face_recognition.load_image_file(img_path)
encoding = face_recognition.face_encodings(img)

if encoding:
known_face_encodings.append(encoding[0])
name = filename.split("_")[0] # Extract student name
known_face_names.append(name)

# Initialize attendance file


file_path = "attendance_records.xlsx"
if not os.path.exists(file_path):
df = pd.DataFrame(columns=["Name", "Date", "Time", "Month", "Year"])
df.to_excel(file_path, index=False)

# Predefined unique greetings


greetings_dict = {
"Alice": "Hey Alice! Hope you're having a great day! 😊",
"Bob": "Welcome back, Bob! Keep up the great work! 🚀",
"Charlie": "Good to see you, Charlie! Stay awesome! 🌟",
20

"David": "Hello David! Let's make today amazing! 💪",


"Eve": "Hi Eve! You’re looking great today! 😃",
}

# Default greetings for new names


default_greetings = [
"Hello, {}! Have a fantastic day! 🎉",
"Welcome, {}! Keep shining bright! ✨",
"Nice to see you, {}! Stay positive! 🌈",
"Hey {}, let's make today productive! 🚀",
]

# Initialize Tkinter GUI


root = tk.Tk()
root.title("Face Recognition Attendance System")
root.geometry("900x700") # Increased height for better spacing

# Function to close the application


def close_app(event=None):
if cap.isOpened():
cap.release()
cv2.destroyAllWindows()
root.quit()

# Bind the Esc key to close the application


root.bind("<Escape>", close_app)

# Load Background Image


try:
bg_image = Image.open("bgi.jpg")
bg_image = bg_image.resize((900, 700), Image.LANCZOS)
bg_photo = ImageTk.PhotoImage(bg_image)
except:
bg_photo = None # If background image is missing, use default color

# Load College Logo (Optional)


try:
logo_image = Image.open("logokgce.png")
logo_image = logo_image.resize((100, 100), Image.LANCZOS)
logo_photo = ImageTk.PhotoImage(logo_image)
except:
logo_photo = None # If logo is missing, leave it empty
21

# Create a Canvas for Background


canvas = tk.Canvas(root, width=900, height=700)
canvas.pack(fill="both", expand=True)

if bg_photo:
canvas.create_image(0, 0, anchor="nw", image=bg_photo) # Background
Image

# College Logo at Top Left (Optional)


if logo_photo:
canvas.create_image(10, 10, anchor="nw", image=logo_photo)

# ======= Camera Frame with Border =======


camera_frame = Frame(root, bg="black", width=500, height=350)
canvas.create_window(450, 200, window=camera_frame)

# Video Label Inside Camera Frame


video_label = Label(camera_frame, bg="white")
video_label.place(relx=0.5, rely=0.5, anchor="center") # Centered inside the
frame

# Recognized Name Label (Below Camera)


name_label = Label(root, text="", font=("Arial", 16, "bold"), fg="blue",
bg="white")
canvas.create_window(450, 400, window=name_label)

# Confirmation Message Label (Below Name Label)


confirmation_label = Label(root, text="", font=("Arial", 12), fg="green",
bg="white")
canvas.create_window(450, 430, window=confirmation_label)

# Greeting Message Label (Below Confirmation Message)


greeting_label = Label(root, text="", font=("Arial", 14, "bold"), fg="purple",
bg="white")
canvas.create_window(450, 460, window=greeting_label)

# Quit Button (Below Everything)


exit_button = tk.Button(root, text="Exit", font=("Arial", 14),
command=close_app, bg="red", fg="white", padx=10, pady=5)
canvas.create_window(450, 520, window=exit_button) # Positioned at the
bottom center
22

# Initialize Camera
cap = cv2.VideoCapture(0)
recorded_names = set()
greeted_names = {} # Dictionary to store greetings per session
last_detected_time = time.time() # Track the last time a face was detected
camera_active = True # Track whether the camera is currently active

# Function to turn off the camera


def turn_off_camera():
global cap, camera_active
if cap.isOpened():
cap.release()
camera_active = False
print("Camera turned off due to inactivity.")

# Display a black screen


black_image = np.zeros((350, 500, 3), dtype=np.uint8) # Black image of
the same size as the camera frame
black_image = Image.fromarray(black_image)
black_image = ImageTk.PhotoImage(black_image)
video_label.img = black_image
video_label.config(image=black_image)

# Function to turn on the camera


def turn_on_camera():
global cap, camera_active
if not camera_active:
cap = cv2.VideoCapture(0)
camera_active = True
print("Camera turned on due to activity.")

# Function to update confirmation message


def show_confirmation_message(name):
now = datetime.now().strftime("%H:%M:%S")
confirmation_label.config(text=f"✔ Entry Recorded: {name} at {now}")
root.after(2000, lambda: confirmation_label.config(text="")) # Auto-hide
after 2 sec

# Function to get a unique greeting for each person


def get_greeting(name):
if name in greetings_dict:
23

return greetings_dict[name]
else:
return random.choice(default_greetings).format(name)

# Function to save attendance once per day


def save_attendance(name):
# Load the existing attendance records
df = pd.read_excel(file_path)
now = datetime.now()
current_date = now.strftime("%Y-%m-%d")
current_time = now.strftime("%H:%M:%S")
current_month = now.strftime("%B") # Get full month name
current_year = now.strftime("%Y")

# Check if the entry for this person already exists today


existing_entry = df[(df["Name"] == name) & (df["Date"] == current_date)]

if existing_entry.empty:
# Add a new entry if it doesn't exist for today
new_entry = pd.DataFrame({
"Name": [name],
"Date": [current_date],
"Time": [current_time],
"Month": [current_month],
"Year": [current_year]
})
df = pd.concat([df, new_entry], ignore_index=True)

# Save the updated DataFrame back to the Excel file


df.to_excel(file_path, index=False)

# Handle repeated attendance logic


handle_repeated_attendance(name, current_date, current_time)

# Function to handle repeated attendance logic


def handle_repeated_attendance(name, current_date, current_time):
repeated_file_path = "repeated_attendance_records.xlsx"

# Check if the repeated attendance file exists


if not os.path.exists(repeated_file_path):
repeated_df = pd.DataFrame(columns=["Name", "Date", "Time"])
repeated_df.to_excel(repeated_file_path, index=False)
24

else:
repeated_df = pd.read_excel(repeated_file_path)

# Add or update the repeated attendance record


existing_repeated_entry = repeated_df[(repeated_df["Name"] == name) &
(repeated_df["Date"] == current_date)]

if not existing_repeated_entry.empty:
# Update the time for the repeated entry
repeated_df.loc[(repeated_df["Name"] == name) & (repeated_df["Date"]
== current_date), "Time"] = current_time
else:
# Add a new entry if it doesn't exist
new_repeated_entry = pd.DataFrame({
"Name": [name],
"Date": [current_date],
"Time": [current_time]
})
repeated_df = pd.concat([repeated_df, new_repeated_entry],
ignore_index=True)

# Save the updated repeated attendance DataFrame back to the Excel file
repeated_df.to_excel(repeated_file_path, index=False)

# Function to process video and detect faces


def process_video():
global cap, greeted_names, last_detected_time, camera_active

# Check if the camera is active


if not camera_active:
root.after(100, process_video) # Check again after 100ms
return

ret, frame = cap.read()


if not ret:
return

# Resize frame for faster processing


small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)

# Detect faces
25

face_locations = face_recognition.face_locations(rgb_small_frame)
face_encodings = face_recognition.face_encodings(rgb_small_frame,
face_locations)

recognized_name = "Unknown"
is_person_present = False

for face_encoding in face_encodings:


matches = face_recognition.compare_faces(known_face_encodings,
face_encoding)
face_distances = face_recognition.face_distance(known_face_encodings,
face_encoding)
best_match_index = np.argmin(face_distances)
if matches[best_match_index]:
recognized_name = known_face_names[best_match_index]
is_person_present = True

# Update attendance only if it's a new entry for today


if recognized_name not in recorded_names:
recorded_names.add(recognized_name)
# Save attendance with filtering (only once per day)
save_attendance(recognized_name)

# Show confirmation message


show_confirmation_message(recognized_name)

# Assign and display a unique greeting message per person


if recognized_name not in greeted_names:
greeted_names[recognized_name] = get_greeting(recognized_name)
greeting_label.config(text=greeted_names[recognized_name])

# If no person is detected, remove the greeting message


if not is_person_present:
greeting_label.config(text="")

# Display name below camera feed


name_label.config(text=f"Recognized: {recognized_name}")
# Convert OpenCV frame to ImageTk format
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
img = Image.fromarray(frame)
img = ImageTk.PhotoImage(img)
video_label.img = img
26

video_label.config(image=img)

# Update the last detected time if a person is present


if is_person_present:
last_detected_time = time.time()
else:
# Check if 10 seconds have passed since the last detection
if time.time() - last_detected_time > 10: # Reduced from 15 to 10
seconds
turn_off_camera()

# Repeat function
root.after(10, process_video)

# Function to monitor for motion and turn on the camera


def monitor_motion():
global cap, camera_active

if not camera_active:
# Try to detect motion (e.g., check if the camera can detect any frame)
temp_cap = cv2.VideoCapture(0)
ret, _ = temp_cap.read()
temp_cap.release()

if ret: # If a frame is detected, turn on the camera


turn_on_camera()

# Repeat function
root.after(1000, monitor_motion) # Check every second

# Start the motion monitoring function


monitor_motion()

# Run video processing in a separate thread to avoid freezing UI


video_thread = threading.Thread(target=process_video)
video_thread.daemon = True
video_thread.start()
# Start the Tkinter GUI event loop
root.mainloop()

3.3 GUI OF SYSTEM :


27
28

CHAPTER 4

CONCLUSION & LIMITATIONS


29

4.1 Limitation of Project

Although significant efforts have been made to make the Automated Attendance
System efficient, user-friendly, and reliable, certain limitations cannot be overlooked.
While the system provides a wide range of functionalities, some intricate features could
not be incorporated due to logistical constraints and the lack of advanced resources. The
limited time available for development also posed a major challenge, preventing the
implementation of certain dynamic and foolproof features.
The system is designed to be easy to operate, even for users with minimal
technical expertise. However, first-time users may find it slightly challenging to
understand the workflow initially. Additionally, the system currently lacks advanced
features such as database integration for long-term storage of attendance records, multi-
camera support for larger environments, and enhanced recognition capabilities under
varying lighting conditions.
Despite these limitations, considerable efforts have been made to ensure that the
system is intuitive and provides help at each step to guide the user. Future
enhancements and additional development time can address these limitations to make
the system more robust and dynamic.
30

4.2 Conclusion

This project was successfully completed within the allotted time frame. The
Automated Attendance System has been developed using Python and incorporates
advanced face recognition technology. All the modules were tested individually and
then integrated to form the complete system. Finally, the system was tested with real
data, and all functionalities worked successfully. Thus, the system has fulfilled all the
objectives identified during the planning phase.
The system has been designed with a user-friendly interface, ensuring that even
users with minimal technical knowledge can operate it with ease. It provides seamless
interactions between administrators and the attendance management process. The
system maintains speed and accuracy in real-time face recognition and attendance
recording, ensuring reliability and efficiency. This project successfully automates the
attendance process, reducing manual effort and improving overall productivity.
31

4.3 REFERENCES

 https://www.python.org/

 https://opencv.org/

 https://pandas.pydata.org/

 https://github.com/ageitgey/face_recognition

 https://www.geeksforgeeks.org/python/

 https://www.w3schools.com/python/

 https://en.wikipedia.org/wiki/Face_recognition

You might also like