Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

A

Project Report
On
“Face Recognition Based Attendance System”
By
Shubham Anand
Under the Guidance of
Mr. R.S. Kohli & Mr. Youddha Beer Singh

Session 2022-23
Department of Computer Science and Engineering
Galgotias College of Engineering &
Technology, Greater Noida

Table of Content
Topic Page No.
1. Declaration
2. Acknowledgement
3. Abstract
4. Introduction
• Advantages
5. Purpose, scope and applicability
6. Requirement and Analysis
 Problem Definition
 Imported libraries and modules
 Feasibility Study
 Requirement Specification
 Software and Hardware Requirement
7.System Design
 ER Diagram
 Activity Diagram
 Class Diagram
 Use Case Diagram
 Sequence Diagram
 Data Flow Diagram
 Component Diagram
 Deployment Diagram
 Flow Chart
8.Working
9.Program Code
10. Reference and Bibliography
Declaration

We hereby declare that the project entitled "Face Recognition Based Attendance
System", which is being submitted as Project of 3rd semester in Computer Science
and Engineering department to Galgotias college of engineering and Technology,
Greater Noida is an authentic record of our genuine work done under the guidance of
Mr Narendra Singh Patel, Assistant professor, Galgotias college of engineering and
Technology, Greater Noida.

Date: 23/06/2023

Name: Shubham Anand


Roll: 2100970100110
Acknowledgement

The completion of this project could have been possible with continued & dedicated efforts &
guidance of large number of faculty & staff members of the institute. I acknowledge our
gratitude to all of them. All that we have done is only due to such supervision and assistance
and we would not forget to thank them.

We are thankful to them for the encouragement, support and guidance from all teaching staffs
of computer science department which helped us in successfully completing our project. We
would like to extend our sincere esteem to all staffs in laboratory for their timely support.

Lastly, we would like to express our deep apperception towards our classmates and our
independency to our parents for providing us the moral support and encouragement.

Internal Examiner: External Examiner:


Abstract

We are living in a world where everything is automated and linked online. The internet of
things, image processing, and machine learning are evolving day by day. Many systems have
been completely changed due to this evolve to achieve more accurate results. The attendance
system is a typical example of this transition, starting from the traditional signature on a
paper sheet to face recognition. This Project proposes a method of developing a
comprehensive embedded class attendance system using facial recognition with showing
whether the face of the person is the student for that specified class or not. The system is
based on the machine learning algorithm which is to be implemented on python language and
using computer/laptop camera for the input image of the students or a normal outer camera
can also be used which has to be connected to the system which is programmed to handle the
face recognition by implementing the Local Binary Patterns algorithm LBPs.
Introduction

To maintain the attendance record with day-to-day activities is a challenging task. The
conventional method of calling name of each student is time consuming and there is
always a chance of proxy attendance. The following system is based on face recognition
to maintain the attendance record of students. The daily attendance of students is
recorded subject wise which is stored already by the administrator. As the time for
corresponding subject arrives the system automatically starts taking snaps and then
apply face detection and recognition technique to the given image and the recognize
students are marked as present and their attendance update with corresponding time and
subject id. We have used deep learning techniques to develop this system, histogram of
oriented gradient method is used to detect faces in images and deep learning method is
used to compute and compare feature facial of students to recognize them. Our system
is capable to identify multiple faces in real time. The main objective of this project is to
develop face recognition based automated student attendance system. In order to
achieve better performance, the test images and training images of this proposed
approach are limited to frontal and upright facial images that consist of a single face
only. The test images and training images have to be captured by using the same device
to ensure no quality difference. In addition, the students have to register in the database
to be recognized. The enrolment can be done on the spot through the user-friendly
interface.
Advantages

Face recognition-based attendance systems have become increasingly popular in recent years.
Here are some advantages of using such a system:

Accuracy: Face recognition technology can accurately identify and authenticate individuals
with a high degree of accuracy. This ensures that the attendance records are accurate, and
there is no room for human error or manipulation.

Convenience: Face recognition systems are easy to use and convenient for both students and
teachers. They eliminate the need for physical attendance registers and reduce the time and
effort required to record attendance.

Security: Face recognition systems can help ensure that only authorized individuals are
allowed to enter the premises. This can help prevent unauthorized access and enhance the
overall security of the school or institution.

Time-saving: With the use of face recognition technology, the time required to take
attendance is significantly reduced. This can help save time for both students and teachers,
and allow for more time to be spent on teaching and learning.

Cost-effective: Face recognition systems are cost-effective in the long run, as they eliminate
the need for physical attendance registers and the associated costs of maintaining them.

Contactless: With the ongoing COVID-19 pandemic, contactless attendance systems have
become a necessity. Face recognition systems are contactless and can help reduce the risk of
virus transmission.

Overall, face recognition-based attendance systems are a reliable and efficient way to manage
attendance in schools and institutions.
PURPOSE, SCOPE AND APPILCABILITY

Purpose:
The purpose of a face recognition attendance system project is to develop a system that can
automate the process of taking attendance in various settings such as schools, colleges, and
businesses. The system uses facial recognition technology to identify and verify the identity
of individuals, and record their attendance automatically. The project aims to provide a more
accurate and efficient way of recording attendance, eliminating the need for traditional
manual methods like sign-in sheets or swipe cards. Overall, the purpose of a face recognition
attendance system project is to develop a reliable and efficient system that can help schools,
colleges, and businesses manage attendance records accurately and securely, while also
saving time and effort.
Scope:
The first step in the project is to develop a face recognition algorithm that can accurately
identify and authenticate individuals. This involves gathering training data, developing the
algorithm, and testing it to ensure it meets the accuracy and reliability requirements. The next
step is to design the hardware components that will be used to capture and process the facial
images. This can include cameras, microcontrollers, and other components required for the
system to function properly. The software component of the system includes the user
interface, the database for storing attendance records, and the code that integrates the
hardware and facial recognition algorithm.
The scope of the project can also include additional features such as real-time monitoring,
integration with access control systems, and integration with other software applications. The
scope can be tailored to meet the specific needs and requirements of the organization or
institution.
Applicability:
The face recognition attendance system project is applicable in a wide range of settings where
attendance tracking is required. The system can be used in schools and universities to
automate the process of taking attendance for students and staff. This can save time and effort
for teachers and administrators and provide accurate attendance records.It can be used in
businesses to track the attendance of employees, particularly in large organizations with
many staff members.
Overall, the face recognition attendance system project has a wide range of applicability in
various settings where attendance tracking is required. The system can help improve
accuracy, efficiency, and security in attendance management, making it a valuable tool for
organizations and institutions of all types.
Technology Used

Python:
Python is an interpreted, high-level and general-purpose programming language. Python's
design philosophy emphasizes code readability with its notable use of significant indentation.
Its language constructs and object-oriented approach aim to help programmers write clear,
logical code for small and large-scale projects.
Python is dynamically-typed and garbage-collected. It supports multiple programming
paradigms, including structured (particularly, procedural), object-oriented and functional
programming. Python is an interpreted, object-oriented, high-level programming language
with dynamic semantics. Its high-level built in data structures, combined with dynamic
typing and dynamic binding, make it very attractive for Rapid Application Development, as
well as for use as a scripting or glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of
program maintenance.
Python supports modules and packages, which encourages program modularity and code
reuse. The Python interpreter and the extensive standard library are available in source or
binary form without charge for all major platforms, and can be freely distributed. Python was
designed for readability, and has some similarities to the English language with influence
from mathematics. Python uses new lines to complete a command, as opposed to other
programming languages which often use semicolons or parentheses. Python relies on
indentation, using whitespace, to define scope; such as the scope of loops, functions and
classes. Other programming languages often use curly-brackets for this purpose.
Problem definition

To develop an automated attendance system using face recognition. Concept In a classroom


with large number of students, it is a very tedious and time-consuming task to take the
attendance manually. Therefore, we can implement an effective system which will mark the
attendance of students automatically by recognizing their faces. The process of this face
recognition system is divided into various steps, but the important steps are detection of face
and recognition of face. Firstly, to mark the attendance of students, the image of students’
faces will be required. This image can be snapped from the camera device, which will be
placed in the classroom at a suitable location from where the whole classroom can be
covered. This image will act as input to the system. For the effective face detection, the
image needs to be enhanced by using some image processing techniques like grayscale
conversion of image and histogram equalization. To identify the students sitting on the last
rows neatly, the histogram equalization of image needs to be done. Hence, there is a need to
develop a real time operating student attendance system which means the identification
process must be done within defined time constraints to prevent omission. The extracted
features from facial images which represent the identity of the students have to be consistent
towards a change in background, illumination, pose and expression. High accuracy and fast
computation time will be the evaluation points of the performance.
Imported libraries and modules

 OpenCV Library: -
OpenCV (Open-Source Computer Vision Library) is an open-source computer vision
and machine learning software library. OpenCV was built to provide a common
infrastructure for computer vision applications and to accelerate the use of machine
perception in the commercial products. Being a BSD-licensed product, OpenCV
makes it easy for businesses to utilize and modify the code.

 NumPy package: -
NumPy is a Python package which stands for 'Numerical Python'. It is the core library
for scientific computing, which contains a powerful n-dimensional array object,
provide tools for integrating C, C++ etc. It is also useful in linear algebra, random
number capability etc.

 Pandas Library: -
Pandas is a high-level data manipulation tool developed by Wes McKinney. It is built
on the NumPy package and its key data structure is called the Data Frame. Data
Frames allow you to store and manipulate tabular data in rows of observations and
columns of variables.

 Tkinter Module: -
Tkinter is the standard GUI library for Python. Python when combined with Tkinter
provides a fast and easy way to create GUI applications. Tkinter provides a powerful
object-oriented interface to the Tk GUI toolkit

 Time Module: -
Python has a module named time to handle time related task. To use functions defined
in the module, we need to import the module first.

 Date Time Module: -


A date in python is not a date type of its own, but we can import a module named date
time work with dates as a date objects.
Feasibility Study

A feasibility study for a face recognition attendance system project is an important step in
determining the viability and potential success of the project. The study can help identify
potential obstacles and risks, as well as assess the economic, technical, operational, and legal
aspects of the project. Here are some key factors that should be considered in a feasibility
study for a face recognition attendance system project:

 Economic feasibility: This involves assessing the financial viability of the project,
including the cost of developing, implementing, and maintaining the system, as well
as the potential return on investment. It is essential to determine if the system is
financially viable, and if the benefits outweigh the costs.

 Technical feasibility: This involves evaluating the technical aspects of the project,
including the availability of hardware and software, the scalability of the system, and
the complexity of the algorithms and database management. It is essential to ensure
that the technology is available and suitable for the project.

 Operational feasibility: This involves evaluating how well the system can be
integrated into the existing workflow, and how well users can adapt to the new
system. It is essential to determine if the system can be implemented and operated
effectively in the organization.

 Legal feasibility: This involves evaluating the legal requirements and regulations
related to the project, including privacy and data protection laws. It is essential to
ensure that the project complies with legal requirements and regulations.

 Social feasibility: This involves assessing the acceptance and support of the project
among the stakeholders, including staff, students, and other users. It is essential to
ensure that the system is socially acceptable and has the support of the users.

Overall, a feasibility study for a face recognition attendance system project is a crucial step in
determining the viability and potential success of the project. By evaluating the economic,
technical, operational, legal, and social aspects of the project, stakeholders can make
informed decisions about whether to proceed with the project, modify the project scope, or
cancel the project.
REQUIREMENT SPECIFICATION

Requirement specification for a face recognition attendance system project is a crucial step in
defining the system's functionality, performance, and usability. It involves identifying and
documenting the system's features, functions, and capabilities based on the organization's or
institution's needs and requirements. Here are some key aspects to consider in the
requirement specification for a face recognition attendance system project:

 Functional requirements: This includes defining the system's core functions, such as
capturing and processing facial images, recognizing and authenticating individuals,
recording attendance data, generating reports, and integrating with other attendance
management systems.
 Performance requirements: This includes defining the system's performance
expectations, such as processing speed, accuracy, reliability, and scalability. It is
essential to ensure that the system can meet the organization's or institution's
attendance tracking needs.
 Usability requirements: This includes defining the system's usability features, such
as the user interface, accessibility, ease of use, and user training. It is essential to
ensure that the system is user-friendly and can be easily integrated into the existing
workflow.
 Security and privacy requirements: This includes defining the system's security and
privacy features, such as data encryption, access control, and compliance with data
protection laws. It is essential to ensure that the system meets the organization's or
institution's security and privacy requirements.
 Integration requirements: This includes defining the system's integration
capabilities, such as integrating with other attendance management systems, access
control systems, and HR systems. It is essential to ensure that the system can be
seamlessly integrated into the organization's or institution's existing infrastructure.
 Maintenance and support requirements: This includes defining the system's
maintenance and support requirements, such as software updates, bug fixes, and user
support. It is essential to ensure that the system can be maintained and supported
efficiently and effectively.

Overall, requirement specification for a face recognition attendance system project is an


important step in defining the system's features, functions, and capabilities. It can help ensure
that the system meets the organization's or institution's needs and requirements and can be
implemented and operated effectively.
HARDWARE AND SOFTWARE REQUIREMENTS

All the students of the class must register themselves by entering the required details and then
their images will be captured and stored in the dataset. During each session, faces will be
detected from live streaming video of classroom. The faces detected will be compared with
images present in the dataset. If match found, attendance will be marked for the respective
student. The task of the proposed system is to capture the face of each student and to store it
in the database for their attendance. The face of the student needs to be captured in such a
manner that all the feature of the students' face needs to be detected, even the seating and the
posture of the student need to be recognized. There is no need for the teacher to manually
take attendance in the class because the system records a video and through further
processing steps the face is being recognized and the attendance database is updated.
Software and hardware requirements for a face recognition attendance system project will
depend on the specific implementation and functionality required. However, here are some
general requirements that should be considered:
Software Requirements:
1. Operating system: Windows, Linux, or MacOS
2. Programming language: Python or Java
3. Integrated Development Environment (IDE): PyCharm, Eclipse, or Visual Studio
4. Libraries for face recognition: OpenCV, Dlib, or TensorFlow
5. Database management system: MySQL, PostgreSQL, or MongoDB
6. Web development framework: Django or Flask
7. Image processing software: Adobe Photoshop or GIMP

Hardware Requirements:

1. Computer with a processor of at least 2.5 GHz or above and 8GB of RAM or more.
2. Camera with high resolution and suitable lens for capturing images of faces from a
reasonable distance.
3. Network devices for communication purposes such as switches, routers and wireless
access points.
It is important to note that the above requirements are general, and the actual software and
hardware requirements for the project will depend on the specific implementation and
functionality required. It is recommended to consult with an experienced software developer
and system administrator to determine the appropriate software and hardware requirements
for the project.
ER DIAGRAM

In this ER diagram, there are two entities: "Students" and "Attendance". The
"Students" entity represents the information about the students, including their
unique ID, first and last name, and the enrolled face image for each student. The
"Attendance" entity represents the information about the attendance, including a
unique attendance ID, the student ID for the student who attended, the
timestamp of the attendance, and the status (i.e., present or absent).

The relationship between the "Students" and "Attendance" entities is one-to-


many, as each student may have multiple attendance records. The student ID
serves as a foreign key in the "Attendance" entity, referencing the
corresponding student's ID in the "Students" entity.

This ER diagram represents a basic structure of a face recognition attendance


system's database, and the actual implementation may involve additional entities
and relationships depending on the system's specific requirement.
ACTIVITY DIAGRAM
COMPONENT DIAGRAM
Working

The working of a face recognition attendance system project involves the following steps:

 Enrolment: The system captures the face images of the students and stores them in a
database along with their personal information such as name and ID number. The
system then extracts the unique facial features of each student and creates a template
for each face image.

 Face Detection and Recognition: When a student approaches the camera, the system
captures the image of the student's face. The system then detects the face in the image
and extracts its facial features. The system compares the extracted facial features with
the templates stored in the database to identify the student.

 Attendance Marking: If the system identifies the student, it marks the student as
present and records the attendance with a timestamp in the attendance database. If the
system cannot identify the student, it marks the student as absent and generates an
error message.

 Reporting: The system generates reports on attendance records that can be viewed
and analysed by teachers or administrators. These reports can help identify students
who are frequently absent or who have poor attendance.
Analysis / Framework / Algorithm:
Haar cascade Algorithm: -
It is a machine learning based approach where a cascade function is trained from a lot of
positive and negative images (where positive images are those where the object to be
detected is present, negative are those where it is not). It is then used to detect objects in other
images. Luckily, OpenCV offers pre-trained Haar cascade algorithms, organized into
categories (faces, eyes and so forth), depending on the images they have been trained on.
LBPH Algorithm: -

Local Binary Pattern (LBP) is a simple yet very efficient texture operator which
labels the pixels of an image by thresholding the neighbourhood of each pixel and
considers the result as a binary number. It has further been determined that when
LBP is combined with histograms of oriented gradients (HOG) descriptor, it
improves the detection performance considerably on some datasets.
Program Code
import cv2
import numpy as np
import face_recognition as face_rec
import os
import pyttsx3 as textSpeach
from datetime import datetime

engine = textSpeach.init()

def resize(img, size) :


width = int(img.shape[1]*size)
height = int(img.shape[0] * size)
dimension = (width, height)
return cv2.resize(img, dimension, interpolation= cv2.INTER_AREA)

path = 'student_images'
studentImg = []
studentName = []
myList = os.listdir(path)
for cl in myList :
curimg = cv2.imread(f'{path}/{cl}')
studentImg.append(curimg)
studentName.append(os.path.splitext(cl)[0])

def findEncoding(images) :
imgEncodings = []
for img in images :
img = resize(img, 0.50)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
encodeimg = face_rec.face_encodings(img)[0]
imgEncodings.append(encodeimg)
return imgEncodings
def MarkAttendence(name):
with open('attendence.csv', 'r+') as f:
myDatalist = f.readlines()
nameList = []
for line in myDatalist :
entry = line.split(',')
nameList.append(entry[0])

if name not in nameList:


now = datetime.now()
timestr = now.strftime('%H:%M')
f.writelines(f'\n{name}, {timestr}')
statment = str('welcome to class' + name)
engine.say(statment)
engine.runAndWait()

EncodeList = findEncoding(studentImg)

vid = cv2.VideoCapture(0)
while True :
success, frame = vid.read()
Smaller_frames = cv2.resize(frame, (0,0), None, 0.25, 0.25)

facesInFrame = face_rec.face_locations(Smaller_frames)
encodeFacesInFrame = face_rec.face_encodings(Smaller_frames,
facesInFrame)

for encodeFace, faceloc in zip(encodeFacesInFrame, facesInFrame)


:
matches = face_rec.compare_faces(EncodeList, encodeFace)
facedis = face_rec.face_distance(EncodeList, encodeFace)
print(facedis)
matchIndex = np.argmin(facedis)

if matches[matchIndex] :
name = studentName[matchIndex].upper()
y1, x2, y2, x1 = faceloc
y1, x2, y2, x1 = y1*4, x2*4, y2*4, x1*4
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 3)
cv2.rectangle(frame, (x1, y2-25), (x2, y2), (0, 255, 0),
cv2.FILLED)
cv2.putText(frame, name, (x1+6, y2-6),
cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
MarkAttendence(name)

cv2.imshow('video',frame)
cv2.waitKey(1)

REFERENCES AND BIBLIOGRAPHY


To make this project I have taken references from the following sources:
• Websites referred
 www.pythonprogramming.net
 www.codecademy.com
 www.tutorialspoint.com
 www.google.co.in

• YouTube Channels referred


 Codewithharry
 edureka!

You might also like