Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Black Book

Download as pdf or txt
Download as pdf or txt
You are on page 1of 51

PROFORMA FOR THE APPROVAL PROJECT PROPOSAL

PNR No.: …………………… Roll No: ___________

1. Name of the Student


Mandhotra Asmit OnkarChand

2. Title of the Project


FACE RECOGNITION ATTENDANCE SYSTEM

3. Name of the Guide

Vaishali Parsewar

4. Teaching experience of the Guide

5. Is this your first submission?

Yes No

Signature of the Student Signature of the Guide

Date: Date:

Signature of the Coordinator

Date:

1
“FACE RECOGNITION ATTENDANCE SYSTEM”

A Project Report
Submitted in partial fulfilment of the
Requirements for the award of the Degree of

BACHELOR OF SCIENCE (COMPUTER SCIENCE)

BY
Asmit Mandhotra
Seat No ( )

Under the esteemed guidance of


Mrs. VAISHALI PARSEWAR

DEPARTMENT OF COMPUTER SCIENCE

Yashwantrao Chavan College Of


Art-Commerce & Science

(Affiliated to University of Mumbai))


PLOT NO.23, SECTOR-15, KOPARKHAIRNE, NAVI MUMBAI-400709
MUMBAI UNIVERSITY ( 2024-2025 )
2
Yashwantrao Chavan College Of Art-Commerce & Science

(Affiliated to University of Mumbai))


KOPARKHAIRNE, NAVI MUMBAI-400709

DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify that the project entitled, "FACE RECOGNITION ATTENDANCE


SYSTEM", is bonafied work of Asmit Mandhotra bearing Seat. No: ( ) submitted
in partial fulfilment of the requirements for the award of degree of BACHELOR OF
SCIENCE in COMPUTER SCIENCE from University of Mumbai.

Internal Guide
Coordinator

External Examiner

Date:
College Seal

3
ACKNOWLEDGEMENTS

I extend my heartfelt gratitude to Mumbai University for incorporating the project on


“Face Detection” into the curriculum of the Computer Science program, fostering a
culture of research and innovation among students like myself I would like to thank
everyone who had contributed to the successful completion of this project. First, I
would like to express my sincere appreciation to Prof. VAISHALI PARSEWAR, who
in spite of being extraordinary busy with her duties, took time to give invaluable advice
and guidance throughout development of the research and for providing me with the
opportunity to undertake this project.

I am deeply thankful to Dr.Laxman Talinkar , Principal of Yashwantrao Chavan college


of arts, commerce and science for generously granting access to the necessary
laboratory facilities at Yashwantrao Chavan college of arts, commerce and science,
which were instrumental in the successful completion of this project.

In addition, I would also like to express my deepest appreciation to my loving parents


and family members for their constant support and encouragement. Their guidance
and belief in my abilities have been invaluable.

I am also grateful to my classmates for their camaraderie and assistance during the
course of this project. Their insights and feedback have been instrumental in shaping
the development process.

Lastly, I would like to express my gratitude to all the individuals who directly or
indirectly contributed to the completion of this project. Their encouragement and
support have been instrumental in this journey of learning and discovery.

4
ABSTRACT

Face detection is a critical technology within computer vision that identifies human
faces in digital images and video streams. It serves as a foundational step for various
applications, including facial recognition, emotion detection, and biometric
identification. The objective of this system is to present an automated system for human
face recognition for an organization or institute to mark the attendance of their students
or employees. This paper introduces face detection method using the Voila and Jones
algorithm and recognition using correlation technique. The system will record the
attendance of the students in class room environment. The above system is fully
automated and easily deployable. User gets an authentication to upload the image
containing file and also to view the attendance.

5
DECLARATION

I hereby declare that the project entitled, "FACE RECOGNITION ATTENDANCE


SYSTEM" conducted at KOPARKHAIRANE, has not been duplicated or submitted to
any other university for the purpose of obtaining any degree. To the best of my
knowledge, no other individual besides myself has submitted a similar project to any
other institution. This project is undertaken in partial fulfillment of the requirements
for the degree of Bachelor of Science in (COMPUTER SCIENCE) and is to be
submitted as the final semester project as per the curriculum.

Asmit Mandhotra
(Signature of the Student)

6
INDEX

1.Premilinary Investigation
Project Overview
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.2 Advantages Over Current System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.1.3 Proposed System Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Activity Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4 Gantt Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2 Literature Review
2.1 Automated Attendance System Using Face Recognition Through Video
Surveillance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
2.1.1 Weaknesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.2 How to Overcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2 Study of Implementing Automated Attendance System Using Face Recognition . ..
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2.1 Weaknesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.2 How to Overcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3 Algorithm for Efficient Attendance Management: Face Recognition . . . . 21
2.3.1 Weaknesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.3.2 How to Overcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3 Requirement Analysis
3.1 Platform Requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1.1 Supportive Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

7
3.2 Software Requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
3.3 Hardware Requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25

4 Project Design
4.1 Design Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
4.2 Software Architectural Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
4.2.1 Component Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
4.2.2 Deployment Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
4.3 Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
4.3.1 E-R Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30

5 Implementation Details
5.1 Assumptions and Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31
5.1.1 Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.1.2 Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.2 Implementation Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3 Competitive Advantages of Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
5.4 Use Case Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
5.5 Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35

6 Coding

7 Results and Discussion


7.1 Test cases and Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.1.1 Unit testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
7.1.2 Functionality testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48

8
8. Conclusion and Future Scope
8.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.2 Future Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49

Reference

9
Chapter 1
Introduction

1.1 Introduction
In many Institution and Organization the attendance is a very important factor to maintain the
record of lectures, salary and work hours etc. Most of the institutes and organizations follow
the manual method using old paper and file method and some of them have shifted to
biometric technique. The current method that colleges use is that the professor passes a sheet
or make roll calls and mark the attendance of the students and this sheet further goes to the
admin department with updates the final excel sheet. This process is quite hectic and time
consuming. Also, for professors or employees at institutes or organizations the biometric
system serves one at a time. So, why not shift to an automated attendance system which works
on face recognition technique? Be it a class room or entry gates it will mark the attendance of
the students, professors, employees, etc. This system uses Viola and Jones algorithm for
detecting and recognizing the faces. The main elements of this technology are as follows:
a) Face Detection
b) Face Recognition
a) Face Detection:
Face detection is a computer technology being used in a variety of applications that identifies
human faces in digital images. Face detection also refers to the psychological process by
which humans locate and attend to faces in a visual scene. Face detection can be regarded as
a specific case of object-class detection. In object-class detection, the task is to find the
locations and sizes of all objects in an image that belong to a given class. Examples include
upper torsos, pedestrians, and cars. Face-detection algorithms focus on the detection of frontal
human faces. It is analogous to image detection in which the image of a person is matched bit
by bit. Image matches with the image stores in database.
Any facial feature changes in the database will invalidate the matching process. A reliable
face-detection approach based on the genetic algorithm and the eigen-face technique: Firstly,
the possible human eye regions are detected by testing all the valley regions in the gray-level
image. Then the genetic algorithm is used to generate all the possible face regions which
include the eyebrows, the iris, the nostril and the mouth corners. Each possible face candidates
is normalized to reduce lightning effect caused due to uneven illumination and the shirring
effect due to head movement. The fitness value of each candidate is measured based on its
projection on the eigen-faces. After a number of iterations, all the face candidates with a high
fitness value are selected for further verification. At this stage, the face symmetry is measured
and the existence of the different facial features is verified for each face 1 candidate.
b) Face Recognition:

10
A facial recognition system is a computer application capable of identifying or verifying a
person from a digital image or a video frame from a video source. One of the ways to do this
is by comparing selected facial features from the image and a facial database. It is typically
used in security systems
and can be compared to other biometrics such as fingerprint or eye iris recognition systems.
Some facial recognition algorithms identify facial features by extracting landmarks, or
features, from an image of the subject’s face. For example, an algorithm may analyze the
relative position, size, and/or shape of the eyes, nose, cheekbones, and jaw. These features are
then used to search for other images with matching features. Other algorithms normalize a
gallery of face images and then compress the face data, only saving the data in the image that
is useful for face recognition. A probe image is then compared with the face data. One of the
earliest successful systems is based on template matching techniques applied to a set of salient
facial features, providing a sort of compressed face representation. Recognition algorithms
can be divided into two main approaches, geometric, which looks at distinguishing features,
or photometric, which is a statistical approach that distills an image into values and compares
the values with templates to eliminate variances. Popular recognition algorithms include
Principal Component Analysis using eigenfaces, Linear Discriminate Analysis, Elastic Bunch
Graph Matching using the Fisher face algorithm, the Hidden Markov model, the Multilinear
9 Subspace Learning using tensor representation, and the neuronal motivated dynamic link
matching

1.1.1 Motivation
The main motivation for us to go for this project was the slow and inefficient traditional
manual attendance system. This made us to think why not make it automated fast and mush
efficient. Also, such face detection techniques are in use by department like crime
investigation where they use cctv footages and detect the faces from the crime scene and
compare those with criminal database to recognize them. Also Facebook, it uses an algorithm
called deep face whose accuracy to recognize is 97.25% which is as close as what humans
have that is 97.53%.

1.1.2 Advantages Over Current System


The previous approach in which manually taking and maintains the attendance records was
very inconvenient task. Traditionally, student’s attendances are taken manually by using
attendance sheet given by the faculty members in class, which is a time-consuming event.
Moreover, it is very difficult to verify one by one student in a large classroom environment
with distributed branches whether the authenticated students are actually responding or not.
The ability to compute the attendance percentage becomes a major task as manual
computation produces errors, and also wastes a lot of time. This method could easily allow
for impersonation and the attendance sheet could be stolen or lost. An automatic attendance
management system using biometrics would provide the needed solution. The results showed
improved performance over manual attendance management system. Biometric-based 1
11
1.1.3 Proposed System Architecture
The System Architecture Consists of basically three layers that is, the Application Layer, the
System Layer and the Databases layer.

1.1.3.1 Application Layer


There is the capturing phase in this the user captures the frames and using a web app that runs
on almost all platforms upload the file to the server. Authentication is provided to the users.
This web app is used to upload captured frames as well as to view the attendance.

1.1.3.2 System Layer


This is the layer where the processing is done that is the detection and recognition part at the
server side. Viola and Jones algorithm is used to detect images from the frames. Initially an
integral image is generated from the frame which simply assigns numbers to the pixels
generated by summing up the values. Further to detect the objects from the frames the haar-
like feature is generated and as millions of features being generated adaboost(boosting
algorithm) is used to enhance the performance. The extracted features are passed through a
trained classifier which detects the faces from the objects. These detected faces are cropped
and passed through the recognition module which by applying correlation to the cropped
images and the images in the databases recognizes the faces.

1.1.3.3 Database Layer


The Database layer is a centralized database system which consists of student database and
their attendance. The student database is formed by initial feeding of the frames from which
system detects faces crops them and stores it to the database and these stored images are hence
forth used for the recognition part. The results of the face recognition 11 module are compared
with the images from the student database and after the successful comparison the attendance
is updated to the database. The sheet is generated and uploaded to the web app.

12
Yashwantrao Chavan College Of Art-Commerce & Science
PLOT NO.23, SECTOR-15, KOPARKHAIRNE, NAVI MUMBAI-400709

DEPARTMENT OF COMPUTER SCIENCE

ACTIVITY CHART
Student Name :-
Project Name :- Face recognition based attendance system

Sr. Activity Start Date End Date Days to


No. Complete

Preliminary 01-07-2024 12-07-2024 13


1. Investigation

System Study and 12-07-2024 17-07-2024 6


2. Analysis

System
3. Design 18-07-2024 21-07-2024 6

System Coding 22-07-2024 03-08-2024 13


4.

Maintenance & 04-08-2024 09-08-2024 6


5. Evaluation

Project/Black
Book 10-08-2024 15-08-2024 4
6. Submission

13
1.4 GANTT CHART

7-Jun 17-Jun 27-Jun 7-Jul 17-Jul 27-Jul 6-Aug 16-Aug

preliminary Investigation

System Study and Analysis

System Design

System Coding

Maintenance & Evaluation

Project/Black Book
Submission

14
Chapter 2
LITERATURE REVIEW

2.1 Student Attendance System

Arun Katara et al. (2017) mentioned disadvantages of RFID (Radio Frequency Identification)
card system, fingerprint system and iris recognition system. RFID card system is implemented
due to its simplicity. However, the user tends to help their friends to check in as long as they
have their friend’s ID card. The fingerprint system is indeed effective but not efficient because
it takes time for the verification process so the user has to line up and perform the verification
one by one. However, for face recognition, the human face is always exposed and contain less
information compared to iris. Iris recognition system which contains more detail might invade
the privacy of the user. Voice recognition is available, but it is less accurate compared to other
methods. Hence, face recognition system is suggested to be implemented in the student
attendance system.

2.2 Face Detection

Difference between face detection and face recognition are often misunderstood. Face
detection is to determine only the face segment or face region from image, whereas face
recognition is to identify the owner of the facial image. S.Aanjanadevi et al. (2017) and Wei-
Lun Chao (2007) presented a few factors which cause face detection and face recognition to
encounter difficulties. These factors consist of background, illumination, pose, expression,
occlusion, rotation, scaling and translation. The definition of each factor is tabulated in Table
2.1

15
Table 2.1 Factors Causing Face Detection Difficulties
Background Variation of background and environment
around people in the image which affect the
efficiency of face recognition.

Illumination Illumination is the variation caused by


various lighting environments which degrade
the facial feature detection.

Pose Pose variation means different angle of the


acquired the facial image which cause
distortion to recognition process, especially
for Eigen face and Fisher face recognition
method.
Expression Different facial expressions are used to
express feelings and emotions. The
expression variation causes spatial relation
change and the facial-feature shape change.
Occlusion Occlusion means part of the human face is
unobserved. This will diminish the
performance of face recognition algorithms
due to deficiency information.
Rotation, scaling and translation Transformation of images which might cause
distortion of the original information about
the images.

2.2 Automated Attendance System Using Face Recognition Through


Video Surveillance

2.2.0.1 Abstract
The objective of this system is to present an automated system for human face recognition in
a real time background for an organization to mark the attendance of their employees or
student. So automated attendance using real time face recognition is a real-world solution
which comes with day-to-day activities of handling employees or student. The task is very
difficult as the real time background subtraction in an image is still a challenge. In the past
two decades, face detection and recognition has proven to be very interesting research field
of image processing. The work carried out describes an automated attendance system using
video surveillance. The proposed algorithm is automatic and efficient in intelligent
surveillance applications. Video surveillance is used to detect the object movement thereby
16
the captured image undergoes face detection and recognition process and searches the student
database and enters the attendance if it is valid in the list [1].

2.1.0.2 Proposed Algorithms

This paper uses Viola and Jones algorithm for face detection and correlations formulas for
face recognition. Viola and Jones algorithm is used for face detection. Where it is used in both
creating database and face recognition process. Where in case creating database, it takes input
image through a web camera continuously. Captured image undergoes face detection.
Detected face will be cropped and stored in database. Where in case of face recognition if
there is any movement video surveillance will be used to detect the moving object. The
captured image undergoes face detection and further processed later by face recognition. 8
Cross-Correlation and Normalized-Correlation are used to extract the Coordinates of peak
with the RIO and target images. The peak of the cross-correlation matrix occurs where the
sub images are best correlated. Find the total offset between the images. The total offset or
translation between images depends on the location of the peak in the cross-correlation matrix,
and on the size and position of the sub images. Check if the face is extracted from the target
Image. Figure out where face exactly matches inside of target image.

17
2.1.1 Weaknesses
• In Viola and Jones, the result depends on the data and weak classifiers. The quality of the
final detection depends highly on the consistence of the training set. Both the size of the sets
and the interclass variability are important factors to take in account.
• The System overview does not provide the clear idea about components of the overall
process.
• The analysis shows very bad results when in case of multiple persons with different
sequence.

2.1.2 How to Overcome


• The training of the data should be done in correct manner so that the quality final detection
will increase.
• System overview should contain the overall architecture that will give the clear and
comprehensive information of the project [4].

18
2.3 Study of Implementing Automated Attendance System Using Face Recognition

2.3.0.1 Abstract

Authentication is a significant issue in system control in computer-based communication.


Human face recognition is an important branch of biometric verification and has been widely
used in many applications, such as video monitor system, human-computer interaction, and
door control system and network security. This paper describes a method for Student’s
Attendance System which will integrate with the face recognition technology using Personal
Component Analysis (PCA) algorithm. The system will record the attendance of the students
in class room environment automatically and it will provide the facilities to the faculty to
access the information of the students easily by maintaining a log for clock-in and clock-out
time [2].

2.2.0.2 Proposed Algorithms

This paper is uses PCA (Principal Component Analysis) technique for face recognition and
image compression. The implementation of this project is done using OpenCV libraries for
face detection and further processes. PCA method has been widely used in applications such
as face recognition and image compression. PCA is a common technique for finding patterns
in data, and expressing the data as eigenvector to highlight the similarities and differences
between different data. Then the system implementation is divided in three major part Face
Detection and Extract, Learn and Train Face Images, Recognize and Identification.
Implementation is done using OpenCV libraries which is open source and cross platform.

19
2.2.1 Weaknesses
This paper uses PCA which have two major disadvantages.
• The covariance matrix is difficult to be evaluated in an accurate manner
• Even the simplest invariance could not be captured by the PCA unless the training data
explicitly provides this information This paper is not giving the clear idea about face detection
and recognition algorithm. Author explains the code of OpenCV instead of explaining the
techniques and methods.

2.2.2 How to Overcome


• The training data should provide the information explicitly.
• Author should explain working of the algorithm which he/she going to use instead of
explaining the functions of OpenCV libraries [5].

20
2.4 Algorithm for Efficient Attendance Management: Face Recognition

2.4.0.1 Abstract

Students’ attendance in the classroom is very important task and if taken manually wastes a
lot of time. There are many automatic methods available for this purpose i.e. biometric
attendance. All these methods also waste time because students have to make a queue to touch
their thumb on the scanning device. This work describes the efficient algorithm that
automatically marks the attendance without human intervention. This attendance is recorded
by using a camera attached in front of classroom that is continuously capturing images of
students, detect the faces in images and compare the detected faces with the database and
mark the attendance. The paper reviews the related work in the field of attendance system
then describes the system architecture, software algorithm and results [3]

2.3.0.2 Proposed Algorithm

This paper uses Viola and Jones algorithm for face detection and correlations formulas for
face recognition. Viola and Jones algorithm is used for face detection. Where it is used in both
creating database and face recognition process. Where in case creating database, it takes input
image through a web camera continuously. Captured image undergoes face detection.
Detected face will be cropped and stored in database. Where in case of face recognition if
there is any movement video surveillance will be used to detect the moving object. The
captured image undergoes face detection and further processed later by face recognition.

21
2.3.1 Weaknesses
• It uses hardware like camera and button which is makes it costly as these are to be
installed in every classroom.
• Histograms fails if there are grey values that are physically apart from each other.

2.3.2 How to Overcome


• Make connectivity through server using web application or android application to capture
and upload from mobile/tab/web cam [6].

22
Chapter 3

Requirement Analysis

To be used efficiently, all computer software needs certain hardware components or other
software resources to be present on a computer. These prerequisites are known as (computer)
system requirements and are often used as a guideline as opposed to an absolute rule. Most
software defines two sets of system requirements: minimum and recommended.
3.1 Platform Requirement

3.1.1 Supportive Operating Systems


The supported operating systems for client include :
• Windows XP/7/8/10
• Mac OS
• Linux Ubuntu/Mint etc.

Software requirements deal with defining software resource requirements and prerequisites
that need to be installed on a computer to provide optimal functioning of an application. These
requirements or prerequisites are generally not included in the software installation package
and need to be installed separately before the software is installed.

Web Browser
• Google Chrome
• Mozilla Firefox
• Internet Explorer/Edge
• Opera

23
3.2 Software Requirement

• OpenCV 2.4.11 with gtk+


• noddeJS
• python 3.7.3
• Visual Studio 2013(Community Edition)
• mysql

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. The library has more than 2500 optimized algorithms, which
includes a comprehensive set of both classic and state-of-the-art computer vision and machine
learning algorithms.
These algorithms can be used to detect and recognize faces, identify objects, classify human
actions in videos, track camera movements, track moving objects, extract 3D models of
objects, produce 3D point clouds from stereo cameras, stitch images together to produce a
high resolution image of an entire scene, find similar images from an image database, remove
red eyes from images taken using flash, follow eye movements, recognize scenery and
establish markers to overlay it with augmented reality, etc. OpenCV has more than 47
thousand people of user community and estimated number of downloads exceeding 7 million.
The library is used extensively in companies, research groups and by governmental bodies.
As an asynchronous event driven framework, Node.js is designed to build scalable network
applications. In the following "hello world" example, many connections can be handled
concurrently. Upon each connection the callback is fired, but if there is no work to be done
Node is sleeping. MySQL is the world’s most popular open-source database.
With its proven performance, reliability and ease-of-use, MySQL has become the leading
database choice for web-based applications, used by high profile web properties. Oracle
drives MySQL innovation, delivering new capabilities to power next generation web, cloud,
mobile and embedded applications.

24
3.3 Hardware Requirement

The most common set of requirements defined by any operating system or software
application is the physical computer resources, also known as hardware, A hardware
requirements list is often accompanied by a hardware compatibility list (HCL), especially in
case of operating systems. An HCL lists tested, compatible, and sometimes incompatible
hardware devices for a particular operating system or application.

25
Chapter 4

Project Design

4.1 Design Approach

Design is the first step in the development phase for any techniques and principles for the
purpose of defining a device, a process or system in sufficient detail to permit its physical
realization. Once the software requirements have been analyzed and specified the software
design involves three technical activities design, coding, implementation and testing that are
required to build and verify the software. The design activities are of main importance in this
phase, because in this activity, decisions ultimately affecting the success of the software
implementation and its ease of maintenance are made. These decisions have the final bearing
upon reliability and maintainability of the system. Design is the only way to accurately
translate the customer requirements into finished software or a system. Design is the place
where quality is fostered in development. Software design is a process through which
requirements are translated into a representation of software. Software design is conducted in
two steps. Preliminary design is concerned with the transformation of requirements into data.

4.2 Software Architectural Designs

Our system follows the three-tier architecture. First tier consists of GUI, Recognition tier and
the Database.
1. GUI: The GUI (Graphical User Interface) in our project deals with the interface for the
user where the user enters the name of the product, he/she wants to search. The GUI
provides a platform for the user to communicate with the database.

2. At initial level the system is trained by providing 5-10 images of an individual. The
images are given in grey scale for mind further its histogram is made to enhance the
recognition accuracy.

Detection:
Whenever any image is uploaded all the face in it are cropped and stored for further
comparison.

26
Face Recognition:
Here the detected cropped face sare compared with the trained images from the data base
using correlation. If any of the cropped image is recognized then that id would be marked
present in the attendance data sheet.
3. Database:

We have a centralized database with all the details of student and staff. the database is
constructed using MySQL. Every cropped or detected image compares itself with the
trained images in this database i.e retrieval is done and also the attendance sheet is
generated using this database i.e. updating is done.

27
28
29
30
Chapter 5

Implementation Details

5.1 Assumptions and Dependencies

5.1.1 Assumptions

The following Assumption was taken into consideration:


• The detector module should crop every human face from the input image and not to crop
other areas. So, it was assumed that the detect or will be very accurate in cropping just and
all the human faces from the uploaded image and save it for further recognition.
• The recognition module has to be very accurate in recognizing that is comparing the
detected image with the images fetched from the database. So, it was assumed that the
recognition module will correctly recognize all the faces from the uploaded image so that a
correct attendance sheet is produced.

5.1.2 Dependencies

The dependencies are as follows:


• Our scripts use OpenCV. OpenCV provides libraries which has functions like LBP which
are the core part of detection and recognition module.

• Ee have used packages of nodejs like npm which is the strongest package manager
available. The start or run time environment is provided by nodejs. It also shows the actual
background working like confidence level, recognition accuracy, etc.

5.2 Implementation Methodology


The proposed system introduces an automated attendance system which integrates a web app
and face recognition algorithms. Any device with a camera can capture an image or a video
and upload to the server using web app. The received file undergoes face detection and face
recognition so the detected faces are extracted from the image. The extracted faces are then
compared with the saved faces of the data base and on the successful recognition the data base
is updated with the attendance and a sheet is generated and displayed on the web app.

31
This work is being carried out in five stages:

Step 1: Generating Data for Training Initially the system is trained that is the cropped
images are saved to the database and they undergo detection and recognition. Further
this data will be used to compare the detected images in all the uploaded files and mark
the attendance.

32
Step 2: Capturing In this the capturing of the video or image will be done using a device
and the captured file is uploaded to the server using web app.
Step 3: Face Detection The file uploaded to the server undergoes face detection using
Viola and Jones algorithm. The frames received are checked for the faces and those are
cropped for further recognition.
Step 4: Face Recognition The detected images undergo correlation with the trained
images of the databases. By this the detected images are now recognized.
Step5: Attendance Marking After the recognition process the students recognized are
searched in the database and their attendance is marked.

5.3 Competitive Advantages of Project


• Currently either manual or biometric attendance system are being used in which
manual is hectic and time consuming. The biometric serves one at a time, so there is a
need of such system which could automatically mark the attendance of many persons
at the same time.
• This system is cost efficient, no extra hardware required just a daily mobile or tablet,
etc. Hence it is easily deployable.
• The work of administration department to enter the attendance is reduced and also
stationary cost so every institute or organization will opt for such time and money
saving system.
• Not only in institutes or organizations, it can also be use data any public places or
entry-exit gates for advance surveillance.
• One of the big benefits of using facial biometric systems in any organization is that
you won’t have to worry about time fraud. It will be impossible for buddy punching to
occur, since everyone has to have go through face scanning biometrics devices to clock
in.
• It provides better security with a face biometrics system. Not only can you track
student through biometrics time attendance tracking, but any visitors can be added to
the system and tracked throughout the area too. Anyone that is not in the system will
not be given access.
• Many companies like the fact that biometric imaging systems are automated. You
won’t have to worry about having someone there to monitor the system 24 hours a
day.

33
• Integrated Biometric facial systems are also easy to program into any organization
computer system. Usually, they will work with existing software that they have in
place.
• Facial biometrics technology to day has a high success rate, especially with the
emergence of 3D face recognition technologies. It is extremely difficult to fool the
system.

34
35
Chapter 6

Coding

1. Setup
Pip install OpenCV
pip install face recognition
pip install numpy
pip install tkinter

2. Face Detection
import cv2
import face recognition
import numpy as np
import os
from datetime import datetime
import mysql.connector
from mysql.connector import Error

# MySQL Database Configuration


DB_HOST = 'localhost'
DB_NAME = 'attendance_db'
DB_USER = 'root'
DB_PASS = 'root'

# Initialize MySQL database connection

36
def create_db_connection():
try:
connection = mysql.connector.connect(
host=DB_HOST,
database=DB_NAME,
user=DB_USER,
password=DB_PASS
)
if connection.is_connected():
return connection
except Error as e:
print(f"Error while connecting to MySQL: {e}")
return None

# Create table if not exists


def create_table(connection):
try:
cursor = connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS attendance
(id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
date DATE,
time TIME,
UNIQUE KEY unique_attendance (name, date))''')
connection.commit()
except Error as e:
print(f"Error creating table: {e}")

37
# Load known faces
known_face_encodings = []
known_face_names = []

# Directory containing the known faces


known_faces_dir = 'C:\\Users\\Asmit\\Python.2\\known_faces'

# Load known faces from the directory


for filename in os.listdir(known_faces_dir):
if filename.endswith(".jpg") or filename.endswith(".png"):
image = face_recognition.load_image_file(os.path.join(known_faces_dir,
filename))
encoding = face_recognition.face_encodings(image)[0]
known_face_encodings.append(encoding)
known_face_names.append(os.path.splitext(filename)[0])

# Initialize webcam
video_capture = cv2.VideoCapture(0)

# Function to mark attendance


def mark_attendance(name, connection):
try:
cursor = connection.cursor()
now = datetime.now()
date_string = now.strftime('%Y-%m-%d')
time_string = now.strftime('%H:%M:%S')

# Check if attendance already marked

38
cursor.execute("SELECT * FROM attendance WHERE name=%s AND
date=%s", (name, date_string))
result = cursor.fetchone()

if result is None:
# Insert new attendance record
cursor.execute("INSERT INTO attendance (name, date, time) VALUES (%s,
%s, %s)",
(name, date_string, time_string))
connection.commit()
print(f"Attendance marked for {name}")
return "Marked"
else:
print(f"Attendance already marked for {name} today")
return "Already Marked"
except Error as e:
print(f"Error marking attendance: {e}")
return "Error"

# Main execution
connection = create_db_connection()
if connection:
create_table(connection)

while True:
# Capture frame-by-frame
ret, frame = video_capture.read()

# Find all face locations and face encodings in the current frame
39
face_locations = face_recognition.face_locations(frame)
face_encodings = face_recognition.face_encodings(frame, face_locations)

# Loop through each face found in the frame


for (top, right, bottom, left), face_encoding in zip(face_locations,
face_encodings):
# See if the face is a match for the known face(s)
matches = face_recognition.compare_faces(known_face_encodings,
face_encoding)
name = "Unknown"
attendance_status = ""

# Use the known face with the smallest distance to the new face
face_distances = face_recognition.face_distance(known_face_encodings,
face_encoding)
best_match_index = np.argmin(face_distances)
if matches[best_match_index]:
name = known_face_names[best_match_index]
attendance_status = mark_attendance(name, connection)

# Draw a rectangle around the face


cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)

# Draw a label with a name below the face


cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255),
cv2.FILLED)
font = cv2.FONT_HERSHEY_DUPLEX
cv2.putText(frame, f"{name} - {attendance_status}", (left + 6, bottom - 6), font,
0.8, (255, 255, 255), 1)

40
# Display the resulting frame
cv2.imshow('Video', frame)

# Hit 'q' on the keyboard to quit!


if cv2.waitKey(1) & 0xFF == ord('q'):
break

# Release handle to the webcam


video_capture.release()
cv2.destroyAllWindows()
connection.close()
else:
print("Failed to connect to the database. Please check your configuration.")

3. Attendance_Portral

import tkinter as tk
from tkinter import ttk
import mysql.connector
from mysql.connector import Error

# MySQL Database Configuration


DB_HOST = 'localhost'
DB_NAME = 'attendance_db'
DB_USER = 'root'
DB_PASS = 'root'

class AttendanceViewer(tk.Tk):
41
def __init__(self):
super().__init__()

self.title("Attendance Viewer")
self.geometry("800x600")

# Create and set up the treeview


self.tree = ttk.Treeview(self, columns=('Name', 'Date', 'Time'),
show='headings')
self.tree.heading('Name', text='Name')
self.tree.heading('Date', text='Date')
self.tree.heading('Time', text='Time')
self.tree.pack(fill=tk.BOTH, expand=1)

# Create a frame for the refresh button


button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, padx=5, pady=5)

# Create the refresh button


refresh_button = tk.Button(button_frame, text="Refresh",
command=self.refresh_data)
refresh_button.pack(side=tk.RIGHT)

# Load initial data


self.refresh_data()

def refresh_data(self):
# Clear existing data
for i in self.tree.get_children():
42
self.tree.delete(i)

# Fetch and display data from the database


connection = self.create_db_connection()
if connection:
try:
cursor = connection.cursor()
cursor.execute("SELECT name, date, time FROM attendance ORDER
BY date DESC, time DESC")
records = cursor.fetchall()

for record in records:


self.tree.insert('', 'end', values=record)

except Error as e:
print(f"Error fetching data: {e}")
finally:
if connection.is_connected():
cursor.close()
connection.close()

def create_db_connection(self):
try:
connection = mysql.connector.connect(
host=DB_HOST,
database=DB_NAME,
user=DB_USER,
password=DB_PASS
)
43
if connection.is_connected():
return connection
except Error as e:
print(f"Error while connecting to MySQL: {e}")
return None

if __name__ == "__main__":
app = AttendanceViewer()
app.mainloop()

44
OUTPUT
((SCREENSHOTS)

45
46
47
Chapter 7

Results and Discussion

7.1 Test cases and Result


7.1.1 Unit testing
7.1.2 Functionality testing
After integrating all the modules, we performed functionality testing to check all the
scenarios which included failure paths and boundary cases. User Registered, user was
able to log in the app and the dashboard was visible with his profile in the up left corner.
We tested with a group image and selected their lasted information retrieved from the
database.

48
Chapter 8

Conclusion and Future Scope

8.1 Conclusion

In order to maintain the attendance this system has been proposed. It replaces the
manual system with an automated system which is fast, efficient, cost and time saving
as replaces the stationary material and the paper work. Hence this system is expected
to give desired results and in future could be implemented for logout. Also, the
efficiency could be improved by integrating other techniques with it in near future.

8.2 Future Scope

It can be easily implemented at any institute or organization. A method could be


proposed to illustrate robustness against the variations that is, in near future we could
build a system which would be robust and would work in undesirable conditions too.
Here it is proposed for an institute to take the attendance of the students but in future it
can be used to do the same work at entry as well as exit points. Authors are working to
improve the face recognition effectiveness to build more efficient systems in near
future. In further work, authors intend to improve face recognition effectiveness by
using the interaction among our system, the users and the administrators. On the other
hand, our system can be used in a completely new dimension of face recognition
application, mobile based face recognition, which can be an aid for common people to
know about any person being photographed by cell phone camera including proper
authorization for accessing a centralized database.

49
References

[1] Rekha A, Dr. Chethan H, Automated Attendance System Using Face Recognition
Through Video Surveillance, International Journal for Technological Research in
Engineering, Volume 1, Issue 11, July-2014.

[2] Nirmalya Kar, Mrinal Kanti Debbarma, Ashim Saha, and Dwijen Rudra Pal, Study
of Implementing Automated Attendance System Using Face Recognition Technique,
International Journal of Computer and Communication Engineering, Vol. 1, No. 2, July
2012.

[3] Naveed Khan Baloch, M. Haroon Yousaf, Waqar Ahmad and M. Iram Baig,
Algorithm for Efficient Attendance Management: Face Recognition Based Approach,
International Journal of Computer Science Issues, Vol. 9, Issue 4, No 1, July 2012.

[4] Kwok-WaiWong, Kin-ManLam, Wan-ChiSiu , Anefficient algorithm for human


face detection and facial feature extraction under different conditions, The Journal of
the Pattern Recognition Society, 25 Aug-2000.

50
51

You might also like