You are on page 1of 63

Attendance Management System using Facial

Recognition
A PROJECT REPORT
Submitted by
JEET JATIN SHAH [Reg No:RA2111003010034]
RAHUL GUPTA [Reg No: RA2111003010047]
SARANSH [Reg No:RA2111003010050]
RUPAJ SEN [Reg No: RA2111003010064]
RISHABH RAJ [Reg No: RA2111003010068]
HARSH RAJA [Reg No: RA2111003010070]
Under the Guidance of
Dr. S. DEEPAJOTHI
Associate Professor, Department of Computing Technologies

in partial fulfillment of the requirements for the degree of

BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE AND ENGINEERING

DEPARTMENT OF COMPUTING TECHNOLOGIES


COLLEGE OF ENGINEERING AND TECHNOLOGY
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
KATTANKULATHUR– 603 203
NOVEMBER 2023
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
KATTANKULATHUR–603 203
BONAFIDE CERTIFICATE

Certified that 18CSE357T project report titled “Attendance Management System using

Facial Recognition” is the bonafide work of JEET JATIN SHAH

[RegNo:RA2111003010034], RAHUL GUPTA [RegNo:RA2111003010047], SARANSH

[RegNo:RA2111003010050] , RUPAJ SEN [RegNo:RA2111003010064], RISHABHB RAJ

[RegNo:RA2111003010068], HARSH RAJA [RegNo: RA2111003010070] who carried out

the project work under my supervision. Certified further, that to the best of my knowledge the

work reported here in does not form part of any other thesis or dissertation on the basis of which

a degree or award was conferred on an earlier occasion for this or any other candidate.

Dr. S. DEEPAJOTHI Dr. M. PUSHPALATHA


HEAD OF THE DEPARTMENT
SUPERVISOR
Department of Computing Technologies
Assistant Professor
Department of Computing Technologies
Department of Computing Technologies
SRM Institute of Science and Technology
Own Work Declaration Form
Degree/Course :B.Tech in Computer Science and Engineering
Student Names : Jeet Jatin Shah, Rahul Gupta, Saransh, Rupaj Sen, Rishabh Raj,
Harsh Raja
Registration Number: RA2111003010034, RA2111003010047,RA2111003010050,
RA2111003010064, RA2111003010068, RA2111003010070

Title of Work : Attendance Management System using Facial Recognition

I/We here by certify that this assessment compiles with the University’s Rules and
Regulations relating to Academic misconduct and plagiarism, as listed in the University
Website, Regulations, and the Education Committee guidelines.
I / We confirm that all the work contained in this assessment is our own except where
indicated, and that we have met the following conditions:
▪ Clearly references / listed all sources as appropriate, Referenced and
put in inverted commas all quoted text (from books, web,etc.)
▪ Given the sources of all pictures, data etc that are not my own.
▪ Not made any use of the report(s) or essay(s) of any other
student(s)either past or present, Acknowledged in appropriate places
any help that I have received from others (e.g fellow students,
technicians, statisticians, external sources)
▪ Compiled with any other plagiarism criteria specified in the Course
hand book / University website
I understand that any false claim for this work will be penalized in accordance with the
University policies and regulations.
DECLARATION:
I am aware of and understand the University’s policy on Academic misconduct and
plagiarism and I certify that this assessment is my / our own work, except where indicated
by referring, and that I have followed the good academic practices noted above.

Date:
Student 1 Signature: Jeet Jatin Shah
Student 2 Signature: Rahul Gupta
Student 3 Signature: Saransh
Student 4 Signature: Rupaj Sen

Student 5 Signature: Rishabh Raj


Student 6 Signature: Harsh Raja
ACKNOWLEDGEMENT

We express our humble gratitude to Dr. C. Muthamizhchelvan, Vice-Chancellor, SRM Institute

of Science and Technology, for the facilities extended for the project work and his continued

support.

We extend our sincere thanks to Dean-CET, SRM Institute of Science and Technology, Dr.

T. V. Gopal, for his invaluable support.

We wish to thank Dr. Revathi Venkataraman, Professor and Chairperson, School of

Computing, SRM Institute of Science and Technology, for her support throughout the project

work.

We are incredibly grateful to our Head of the Department, Dr. M. Pushpalatha, Professor,

Department of Computing Technologies, SRM Institute of Science and Technology, for her

suggestions and encouragement at all the stages of the project work.

We register our immeasurable thanks to our Course Faculty, Dr. S DEEPAJOTHI, Assistant

Professor, Department of Computing Technologies, SRM Institute of Science and Technology,

for leading and helping us to complete our course.


ABSTRACT

The Attendance Management System using Facial Recognition is a project aimed at


developing a reliable and efficient attendance management system for organizations. The
system uses facial recognition technology to automate attendance tracking and
streamline payroll and HR processes. It is implemented using Python programming
language and utilizes OpenCV, CMake, Pandas, and other Python libraries for facial
recognition. The system also incorporates databases such as MongoDB and utilizes SQL
queries for data management. The collected attendance data is reported in an Excel sheet
for further analysis.

The system's architecture consists of multiple modules such as a facial recognition


module, attendance tracking module, and reporting module. It also incorporates security
measures to protect the collected data and ensure compliance with laws and regulations
related to attendance tracking and data protection.

The benefits of the Attendance Management System using Facial Recognition are
numerous, including increased accuracy and security of attendance data, cost savings,
improved productivity, and compliance with legal requirements. The system is
customizable to fit the unique needs of each organization and is designed to be user-
friendly and intuitive.

However, there may be obstacles in the development and implementation of the system,
such as technical challenges, data privacy concerns, and potential resistance from
employees.
Nevertheless, with the right resources, expertise, and a well-designed implementation
plan, the Attendance Management System using Facial Recognition can bring significant
benefits to organizations seeking to improve their attendance management processes.
TABLE OF CONTENTS

ABSTRACT vi
LIST OF TABLES ix
LIST OF FIGURES x
LIST OF SYMBOLS AND ABBREVIATIONS xi
1. INTRODUCTION 1
1.1 General 1
1.2 Machine Learning and Deep Learning 2
1.3 Difference Between Machine Learning and Deep Learning 4
2 LITERATURE SURVEY 11
2.1 Motivation 12
2.2 Objective 13
3 ARCHITECTURE AND ANALYSIS OF LEPROSY 15
DETECTION
3.1 Architecture Diagram 15
3.2 Frontend Design 16
3.3 Backend Design 19
4 DESIGN AND IMPLEMENTATION OF LEPROSY 22
DETECTION USING EXPLAINABLE AI
4.1 Dataset 23
4.2 Image Preprocessing 25
5 RESULTS AND DISCUSSION 39
5.1 Performance Analysis using Various Metrics 39
5.2 Comparison Between Existing Models 45
6 CONCLUSION AND FUTURE SCOPE 48
6.1 Conclusion 49
6.2 Future Scope 49

REFERENCES 50

1.
A
p
p
e
n
d
i
c
e
s
LIST OF TABLES

1.1 Difference between Machine Learning and Deep Learning….…………….. 5


5.1 Performance of all models…….……………………………….…………… 40
5.2 Comparison of proposed system with other existing methods..……………. 45
LIST OF FIGURES

1.1 Relationship between AI, ML and DL 3


1.2 Brain MRI Segmentation………………….............................................................. 7
1.3 Architecture of Simple CNN………………………………………………...……. 8
1.7 ResNet Architecture………..................................................................................... 9
1.8 AlexNet Architecture............................................................................................... 10
3.1 Architecture Diagram of Website………………………………………………… 15
3.2 Home page………………………………………………………………………... 16
4.1 Architecture flow of paper……………………………………………………….. 22
LIST OF SYMBOLS AND ABBREVIATIONS

US United States of America


ReLU Rectified Linear Unit
GAN Generative Adversarial Network
CNN Convolutional Neural Network
XAI Explainable Artificial Intelligence
AI Artificial Intelligence
ML Machine Learning
MRI Magnetic Resonance Imaging
CT Computed Topography
CHAPTER 1

INTRODUCTION

At present facial recognition and image processing is a very interesting topic


that has only had its surface scratched, facial recognition is quickly
surpassing other forms of biometrics (Fingerprints, RFID etc) as facial
recognition systems use a set of features distinct to one person.

This proposed project can be applied to create an attendance system using


facial recognition as the traditional method i.e., pen and paper is not only
time consuming and burdensome it is also prone to proxies and
manipulation, our aim in developing this project is to make the attendance
system efficient, stop methods and means of proxies and to save time that
would otherwise be lost in the lecture.

The idea for this project came to us in class as we saw the amount of time
that has to be skipped for attendance and the nonchalance of students who
had already marked their attendance which leads to the method being
delayed further, we then decided that this would be a good and interesting
field to delve into for our Project as the field of Image processing,
recognition etc; has a world of scope and would help us inculcate our skills
and make us a tad bit ready for any or most challenges ahead.

.
REFERENCES

[1] Hernández, E.; Sanchez-Anguix, V.; Julian, V.; Palanca, J.; Duque, N. Rainfall prediction: A
deep learning approach. In International Conference on Hybrid Artificial Intelligence Systems;
Springer: Cham, Switzerland, 2016; pp. 151–162.
[2] Goswami, B.N. The challenge of weather prediction. Resonance 1996, 1, 8–17.
[3] Nayak, D.R.; Mahapatra, A.; Mishra, P. A survey on rainfall prediction using artificial neural
network. Int. J. Comput. Appl. 2013, 72, 16.
[4] Kashiwao, T.; Nakayama, K.; Ando, S.; Ikeda, K.; Lee, M.; Bahadori, A. A neural network-
based local rainfall prediction system using meteorological data on the internet: A case study using
data from the Japan meteorological agency. Appl. Soft Comput. 2017, 56, 317–330.
[5] Mislan, H.; Hardwinarto, S.; Sumaryono, M.A. Rainfall monthly prediction based on artificial
neural network: A case study in Tenggarong Station, East Kalimantan, Indonesia. Procedia Comput.
Sci. 2015, 59, 142–151.
[6] Muka, Z.; Maraj, E.; Kuka, S. Rainfall prediction using fuzzy logic. Int. J. Innov. Sci. Eng.
Technol. 2017, 4, 1–5.
3

TABLE OF CONTENTS

CHAPTER TITLE PAGE NO


NO

1 ABSTRACT

2 PROBLEM STATEMENT

3 STAKEHOLDERS & PROCESS MODELS

4 IDENTIFYING REQUIREMENTS

5 PROJECT PLAN & EFFORT

6 WORK BREAKDOWN STRUCTURE & RISK


ANALYSIS
7 SYSTEM ARCHITECTURE, USE CASE & CLASS
DIAGRAM

8 ENTITY RELATIONSHIP DIAGRAM

9 DATA FLOW DIAGRAM

10 SEQUENCE & COLLABORATION DIAGRAM

11 DEVELOPMENT OF TESTING
FRAMEWORK/USER INTERFACE

12 TEST CASES & REPORTING

13 ARCHITECTURE/DESIGN/FRAMEWORK/IMPLE
-MENTATION

14 CONCLUSION REFERENCES

15 APPENDIX (CODE)
4

ABSTRACT

The Attendance Management System using Facial Recognition is a project aimed at developing
a reliable and efficient attendance management system for organizations. The system uses facial
recognition technology to automate attendance tracking and streamline payroll and HR
processes. It is implemented using Python programming language and utilizes OpenCV, CMake,
Pandas, and other Python libraries for facial recognition. The system also incorporates databases
such as MongoDB and utilizes SQL queries for data management. The collected attendance data
is reported in an Excel sheet for further analysis.
The system's architecture consists of multiple modules such as a facial recognition module,
attendance tracking module, and reporting module. It also incorporates security measures to
protect the collected data and ensure compliance with laws and regulations related to attendance
tracking and data protection.

The benefits of the Attendance Management System using Facial Recognition are numerous,
including increased accuracy and security of attendance data, cost savings, improved
productivity, and compliance with legal requirements. The system is customizable to fit the
unique needs of each organization and is designed to be user-friendly and intuitive.

However, there may be obstacles in the development and implementation of the system, such as
technical challenges, data privacy concerns, and potential resistance from employees.
Nevertheless, with the right resources, expertise, and a well-designed implementation plan, the
Attendance Management System using Facial Recognition can bring significant benefits to
organizations seeking to improve their attendance management processes
6

Aim
To Frame a project team, analyze and identify a Software project. To create a business case
and Arrive at a Problem Statement for the Attendance Management System using Facial Recognition.

Project Title: Attendance Management System using Facial Recognition

Project Description
This project aims to develop an Attendance Management System using Facial Recognition
technology. The system will be implemented using Python programming language, along with
the use of OpenCV, CMake, Pandas, and various other Python libraries for facial recognition.
The system will also incorporate databases such as MongoDB, and will utilize SQL queries for
data management. The collected attendance data will be reported in an Excel sheet for further
analysis.

Business Case

The business case for this project is to provide an efficient and secure method of attendance
management for organizations. By using facial recognition technology, the system eliminates
the need for traditional methods such as punch cards or manual sign-ins, which can be prone
to errors and manipulation. Additionally, the system will save time for employees and
administrators by automating the attendance tracking process.

Another benefit of this system is that it can be integrated with existing databases, such as a
company's payroll system, to streamline the process of tracking attendance and calculating
employee hours. This will save HR and payroll staff time and effort in tracking attendance
records and preparing reports.

The use of facial recognition technology also provides a higher level of security, as it ensures
that only authorized individuals are able to sign in, reducing the risk of fraud or errors. This
can be particularly useful for organizations that have sensitive information or restricted access
areas.
7

Overall, the implementation of an Attendance Management System using Facial Recognition


technology can provide organizations with a more efficient and secure method of tracking
employee attendance, while also reducing the workload of HR and payroll staff.

Result
Thus, the project team formed, the project is described, the business case was prepared
and the problem statement was arrived.
8

ONE PAGE BUSINESS CASE TEMPLATE


DATE 20th January 2023

SUBMITTED
RUPAJ SEN
BY

Attendance Management System using Facial Recognition


TITLE / ROLE
Role: Member

THE PROJECT
In bullet points, describe the problem this project aims to solve or the opportunity it aims to develop.

This project aims to address the issues of inefficiency and inaccuracy in attendance management
within organizations by creating a secure and automated system utilizing facial recognition
technology. The system will help save time for employees and administrators, as well as integrate
seamlessly with existing databases and improve the security of attendance tracking by only
allowing authorized individuals to sign in.

THE HISTORY
In bullet points, describe the current situation.

Currently, many organizations still rely on traditional methods such as punch cards or manual sign-
ins for attendance tracking, which are known to be time-consuming, error-prone, easily
manipulated and lack the necessary security measures. But as technology has advanced,
organizations are beginning to recognize the limitations of these traditional methods and are starting
to adopt new technologies such as facial recognition to improve the accuracy, security, and
efficiency of attendance tracking, However, these new technologies are not yet widely adopted
and many organizations still rely on traditional methods.

LIMITATIONS
List what could prevent the success of the project, such as the need for expensive equipment, bad weather,
lack of special training, etc.

There are several factors that could prevent the success of the Attendance Management System
using Facial Recognition project, including: the high cost of equipment and hardware, lack of
technical expertise, privacy concerns, limited accuracy of the facial recognition technology,
resistance to change, scalability limitations, difficulties with integrating the system with existing
systems, data security challenges, and legal considerations such as compliance with laws and
regulations.

APPROACH
List what is needed to complete the project.

To complete the Attendance Management System project, the organization will need necessary
hardware, software, database, technical expertise, resources, integration with existing systems,
data security measures, and compliance with laws related to facial recognition technology and
data protection.

BENEFITS
In bullet points, list the benefits that this project will bring to the organization.

The implementation of the Attendance Management System using Facial Recognition can
automate the attendance tracking process, increase the accuracy and security of attendance
data, and streamline payroll and HR processes, resulting in cost savings, increased productivity and
compliance with laws and regulations. Additionally, the system can be tailored to fit the specific
needs of the organization.
10

Aim
To identify the appropriate Process Model for the project and prepare
Stakeholder and User Description.

Project Title: Attendance Management System using Facial Recognition


Selection of Methodology:
The choice of methodology for the Attendance Management System using Facial
Recognition project will depend on several factors, such as the size and
complexity of the project, the resources available, the constraints and risks
involved, and the desired outcome. Some common methodologies that may be
suitable for this project include Agile, Waterfall, Lean, and Scrum. Each
methodology has its own pros and cons, and the organization will need to
carefully evaluate each option and choose the one that best suits their specific
needs and requirements.
We have chosen Agile Methodology
Agile methodology is often a good fit for projects such as the Attendance
Management System using Facial Recognition project because it provides several key
benefits:
1. Flexibility: Agile methodology is designed to be flexible and adapt to
change, which is particularly important in software development projects.
This makes it ideal for the Attendance Management System project, which
may require changes as the project progresses.
2. Collaboration: Agile methodology emphasizes collaboration and
communication between team members, which can help to ensure that all
stakeholders are aligned and working together towards the same goal.
11

3. Iterative development: Agile methodology involves iterative development,


where the project is divided into smaller parts, and each part is developed
and tested before moving on to the next part. This can help to minimize
risk and ensure that the final product meets the requirements.
4. Faster delivery: Agile methodology enables faster delivery of working
software, which is important in a project like the Attendance Management
System where time is a critical factor.
5. Customer involvement: Agile methodology places a strong emphasis on
customer involvement and feedback, which is important in a project like
the Attendance Management System where the customer's needs and
requirements are a key consideration.
In conclusion, the Agile methodology provides the flexibility, collaboration,
iterative development, faster delivery, and customer involvement that are key
factors in a successful Attendance Management System using Facial Recognition
project.

Incorporate information to below table regarding stakeholders of the project [Make use
of below examples]

Stakeholder Activity/ Area /Phase Interest Influence Priority


Name (High/
Medium/
Low)
Project Leads the project and is High High Medium
Manager responsible for its
success
Development Develops and High High High
Team implements the
Attendance Management
System using Facial
Recognition
Payroll/HR Relies on accurate High High High
Department attendance data for
payroll and HR processes
Management Makes decisions High High High
regarding the
implementation and use
of the system
12

IT Supports and maintains High High High


Department the technology used in
the system
Vendors Provide equipment, High Medium High
software, and other
resources needed for the
project
Customers May be affected by the High Low Medium
use of facial recognition
technology
Regulatory Enforce laws and High High High
Bodies regulations related to
facial recognition
technology and data
protection

An interest and influence matrix is a tool used to identify and prioritize


stakeholders in a project based on their level of interest and influence in the
project outcomes. The matrix is typically represented in a grid format, with
stakeholders listed along the left-hand column and levels of interest and
influence indicated on the top row.
For the Attendance Management System using Facial Recognition project,
potential stakeholders and their level of interest and influence could include:
• Management: High interest, high influence
• HR department: High interest, high influence
• IT department: High interest, high influence
• Payroll department: High interest, high influence
• Customers: Low interest, low influence
• Regulators: Low interest, high influence
Based on the matrix, management, HR, IT, and payroll departments would be
considered high priority stakeholders due to their high level of interest and
influence in the project outcomes. Customers and regulators would be
considered low priority stakeholders due to their lower level of interest and
influence.
It's important to regularly assess and update the interest and influence matrix
throughout the project lifecycle to ensure that all stakeholders are being
effectively engaged and their needs and concerns are being addressed.

Result
Thus the Project Methodology was identified and the stakeholders were
described.
14

Aim
To identify the system, functional and non-functional requirements for the project.

Project Title: Attendance Management System using Facial Recognition

System Requirements:
To run the Attendance Management System using Facial Recognition, the minimum system
requirements include:

Hardware:
A computer with a dual-core processor or higher
A webcam with a resolution of 720p or higher
2GB of RAM
A graphics card with at least 128MB of VRAM

Software:
Windows 7 or later, or MacOS 10.12 or later
Python 3.x
OpenCV 4.x
cmake 3.x
The facial recognition library

The recommended system requirements are:


Hardware:
A computer with a quad-core processor or higher
A webcam with a resolution of 1080p or higher
4GB of RAM or higher
A graphics card with at least 256MB of VRAM

Software:
Windows 10 or later, or MacOS 11 or later
Python 3.x
OpenCV 4.x
cmake 3.x
The facial recognition library
15

In general, a higher-end system will allow for more efficient and accurate processing of the facial
recognition data.

Functional Requirements

Functional Requirements are the specific features and capabilities that a system must have in order
to meet the needs and expectations of the stakeholders. For the Attendance Management System
using Facial Recognition project, some functional requirements may include:

Facial recognition: the ability to accurately and efficiently recognize the face of an employee to
track attendance.

Real-time tracking: the ability to track attendance in real-time and immediately update the
database.

User Management: the ability to create, modify, and delete user accounts, and assign permissions
for different levels of access.

Attendance Report: the ability to generate attendance reports, including daily, weekly, and
monthly reports, and to export the data to an excel sheet.

Integration with Payroll/HR systems: the ability to integrate the Attendance Management
System with existing payroll or HR systems to streamline the process of tracking attendance and
calculating employee hours.

Data security: the ability to store and secure the data collected by the facial recognition system,
including measures to protect sensitive information.

User-friendly interface: the ability to provide an intuitive, user-friendly interface for employees
to log in and view their attendance records.

Customization: the ability to customize the Attendance Management System to fit the unique
needs of the organization.

Scalability: the ability to handle a large number of employees and a high volume of transactions,
and to expand the system as the organization grows.

Compliance with laws and regulations: the ability to comply with laws and regulations related
to facial recognition technology and data protection.
16

Non-Functional Requirements

Non-Functional Requirements for the Attendance Management System using Facial Recognition
project could include:

User-friendliness: The system should be easy to use and navigate, with a clear and intuitive
interface.

Scalability: The system should be able to handle a large number of employees and transactions.

Performance: The system should be able to perform facial recognition quickly and accurately,
with minimal latency.

Data Security: The system should have robust security measures in place to protect the data
collected by the facial recognition system.

Legal Compliance: The system should comply with laws and regulations related to facial
recognition technology and data protection.

Data Integrity: The system should be able to store and manage attendance data accurately and
securely.

Integration: The system should be able to integrate with existing payroll or HR systems to
streamline the process of tracking attendance and calculating employee hours.

Support and Maintenance: The system should have adequate support and maintenance in place
to ensure its longevity and effectiveness.

Result
Thus the requirements were identified and accordingly described.
18

Aim
To Prepare Project Plan based on scope, Calculate Project effort based on resources, Find Job
roles and responsibilities

1. Project Management Plan


Describe the key issues driving the project. [Min 3 Focus Areas]

Focus Area Details

Integration Management User Interface design


Integration with Facial Recognition Technology
Database Management
Error Handling
Reporting

Scope Management Scope Statement


Requirement Management (Gathering, Control, Assumption,
Constraint Stakeholder)
Scope Verification
Scope Change Control
Scope Reporting

Schedule Management Activity Definition


Activity Sequencing
Activity Duration Estimation

Cost Management Resource Planning


Cost Estimation
Budget Development
Cost Reporting

Quality Management Quality Assurance


Quality Control
Quality Reporting
19

Resource Management Resource Planning


Resource Acquisition
Resource Development

Stakeholder Identifying
Analyzing
Engagement
Management Plan

Communication Management Communication Planning


Communication Channels
Communication Execution
Communication Monitoring

Risk Management Risk Identification


Risk Analysis
Risk Response Planning
Risk Monitoring
Risk Reporting

Procurement Management Adhering to organization procurement process

2. Estimation
2.1. Effort and Cost Estimation
20

2.2. Infrastructure/Resource Cost [CapEx]

2.3 Maintenance and Support Cost [OpEx]


21

Project Team Formation


2.3. Identification Team members

2.4. Responsibility Assignment Matrix


22

In this matrix, "R" stands for "Responsible", "A" stands for "Accountable", "I" stands for "Informed",
and "-" stands for "Not involved".

"PM" stands for "Project Manager", "BA" stands for "Business Analyst", "SA" stands for "Solution
Architect", "DBA" stands for "Database Administrator", "FED" stands for "Front-end Developer", "BED"
stands for "Back-end Developer", "QA" stands for "Quality Assurance Engineer", "TW" stands for
"Technical Writer", "DO" stands for "DevOps Engineer", and "SS" stands for "Security Specialist".

Reference
1. https://www.pmi.org/
2. https://www.projectmanagement.com/
3. https://www.tpsgc-pwgsc.gc.ca/biens-property/sngp-npms/ti-it/ervcpgpm-dsfvpmpt-
eng.html

Result:
Thus, the Project Plan was documented successfully
24

Aim
To Prepare Work breakdown structure, Timeline chart and Risk identification table

Work Breakdown Structure (WBS) for developing an Attendance Management System


using Facial Recognition:
1. Project Management
1.1. Define project scope
1.2. Create project plan
1.3. Monitor and control project progress
2. Requirements Gathering and Analysis 2.1
2.1 Gather functional requirements
2.2 Gather non-functional requirements
2.3 Analyse requirements and create requirements specification document
3. Design
3.1 Develop system architecture
3.2 Develop user interface design
3.3 Develop database schema
3.4 Develop facial recognition algorithm design
3.5 Develop system integration design
4. Development
4.1 Develop user interface
4.2 Develop database
4.3 Develop facial recognition algorithm
4.4 Develop integration components
4.5 Integrate system components
25

5. Testing
5.1 Develop test cases
5.2 Perform unit testing
5.3 Perform integration testing
5.4 Perform system testing
6. Deployment
6.1 Install and configure the system
6.2 Train users and administrators
6.3 Develop user manuals and system documentation
7. Maintenance and Support
7.1 Provide ongoing system maintenance and support
7.2 Address user support requests and issues
7.3 Perform regular system backups and updates

Timeline Chart:
26

Risk Table:

Result:
Thus, the work breakdown structure with timeline chart and risk table were formulated
successfully.
28

Aim
To Design a System Architecture, Use case and Class Diagram

Title: Attendance management system using facial recognition

SYSTEM ARCHITECTURE
29

USE CASE DIAGRAM

Detect

CLASS DIAGRAM

Result:
Thus, the system architecture, use case and class diagram created successfully.
31

Aim
To create the Entity Relationship Diagram

ER Diagram
32
33
34

Result:
Thus, the entity relationship diagram was created successfully.
35

*/ ER Diagram, Notation and Example


What is ER Diagram?
- ER Diagram stands for Entity Relationship Diagram, also known as ERD is a diagram that
displays the relationship of entity sets stored in a database. In other words, ER diagrams help
to explain the logical structure of databases. ER diagrams are created based on three basic
concepts: entities, attributes and relationships.
- ER Diagrams contain different symbols that use rectangles to represent entities, ovals to
define attributes and diamond shapes to represent relationships.
- At first look, an ER diagram looks very similar to the flowchart. However, ER Diagram
includes many specialized symbols, and its meanings make this model unique. The purpose
of ER Diagram is to represent the entity framework infrastructure.

What is ER Model?
- ER Model stands for Entity Relationship Model is a high-level conceptual data model
diagram. ER model helps to systematically analyze data requirements to produce a well-
designed database.
- ER Model represents real-world entities and the relationships between them. Creating an ER
Model in DBMS is considered as a best practice before implementing your database.
- ER Modeling helps you to analyze data requirements systematically to produce a well-
designed database. So, it is considered a best practice to complete ER modeling before
implementing your database.

Why use ER Diagrams?


Here, are prime reasons for using the ER Diagram
- Helps you to define terms related to entity relationship modeling
- Provide a preview of how all your tables should connect, what fields are going to be on each
table
- Helps to describe entities, attributes, relationships
- ER diagrams are translatable into relational tables which allows you to build databases
quickly
- ER diagrams can be used by database designers as a blueprint for implementing data in
specific software applications
- The database designer gains a better understanding of the information to be contained in the
database with the help of ERP diagram
- ERD Diagram allows you to communicate with the logical structure of the database to users

Components of the ER Diagram


This model is based on three basic concepts: Entities, Attributes, Relationships

ER Diagram – Notations
- Rectangles represent entity sets.
- Diamonds represent relationship sets.
- Lines link attributes to entity sets and entity sets to relationship sets.
- Ellipses represent attributes
- Double ellipses represent multivalued attributes.
- Dashed ellipses denote derived attributes.
- Underline indicates primary key attributes
36

ER Diagram of University Database


37

ADDITIONAL NOTES

- A database can be modeled as a collection of entities, relationship among entities.


- An entity is an object that exists and is distinguishable from other objects.
Example: specific person, company, event, plant
- Entities have attributes.
Example: people have names and addresses
- An entity set is a set of entities of the same type that share the same properties.
Example: set of all persons, companies, trees, holidays

- Express the number of entities to which another entity can be associated via a relationship
set.
- Most useful in describing binary relationship sets.
- We express cardinality constraints by drawing either a directed line (->), signifying “one,” or
an undirected line (—), signifying “many,” between the relationship set and the entity set.

- An entity is represented by a set of attributes, that is descriptive properties possessed by all


members of an entity set.
Example: customer = (customer-id, customer-name, customer-street, customer-city)
loan = (loan-number, amount)
- Domain – the set of permitted values for each attribute
- Attribute types:
1. Simple and composite attributes.
2. Single-valued and multi-valued attributes
E.g. multivalued attribute: phone-numbers
3. Derived attributes-Can be computed from other attributes
E.g. age, given date of birth

Cardinality
- For a binary relationship set the mapping cardinality must be one of the following types:
1. One to one
A customer is associated with at most one loan via the relationship borrower. A loan is
associated with at most one customer via borrower
2. One to many
A loan is associated with at most one customer via borrower, a customer is associated with
several (including 0) loans via borrower
3. Many to one
A loan is associated with several (including 0) customers via borrower, a customer is associated
with at most one loan via borrower
4. Many to many
A loan is associated with several (including 0) customers via borrower, a customer is associated
with several loans (including 0) via borrower

Weak Entity Set


- An entity set that does not have a primary key is referred to as a weak entity set and
represented by double outlined box in E-R diagram.
Example : Consider the entity set payment which got three attributes : payment_number,
payment_date and payment_amount. Payment numbers are sequential starting from 1 generally
38

separately for each loan. Although each payment entity is distinct, payments for different loans
may share the same payment number. Thus this entity set does not have a primary key.

Discriminator
- The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes
among all the entities of a weak entity set
Example: discriminator of weak entity set payment is the attribute payment_number since for
each loan a payment number uniquely identifies one single payment for that loan.

Specialization-Generalization-ISA
- E-R model provides means of representing these distinctive entity groupings
- Process of designating subgroupings within an entity set is called specialization depicted by
triangle component labelled ISA (“is a”)
- Bottom up design process in which multiple entity sets are synthesized into higher level entity
set - Generalization
- ISA relationship may also be referred to as superclass-subclass relationship
- Higher and lower level entity sets are designated by the terms superclass and subclass.
- Specialization and generalization are simple inversions of each other; they are represented in
an E-R diagram in the same way.

Total & Partial Participation


- Total participation (indicated by double line): every entity in the entity set participates in at
least one relationship in the relationship set
E.g. participation of loan in borrower is total, every loan must have a customer associated to it
via borrower
- Partial participation: some entities may not participate in any relationship in the relationship
set
Example: participation of customer in borrower is partial

Cardinality limits
- Cardinality limits can also express participation constraints
- Minimum and maximum cardinality is expressed as l..h where l is the minimum and h is the
maximum cardinality
- Minimum value of 1 indicates total participation of entity set in relationship set
- Maximum value of 1 indicates entity participates in atmost one relationship set.
- Maximum value of * indicates no limit

Role indicator
- Entity sets of a relationship need not be distinct
- The labels “manager” and “worker” are called roles; they specify how employee entities
interact via the works-for relationship set.
- Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles.
- Role labels are optional, and are used to clarify semantics of the relationship

Disjoint Generalization
- Disjointness constraint requires that an entity belong to more than one lower level entity set.
Example: account entity can satisfy only one condition for account_type attribute ; entity can
either be savings or chequing account but not both.
39

Aim
To develop the data flow diagram up to level 1 for the attendance management system
using facial recognition.

DATA FLOW DIAGRAM


40

Data Flow Diagram

The DFD takes an input-process-output view of a system. That is, data objects flow into the
software, are transformed by processing elements, and resultant data objects flow out of the
software. Data objects are represented by labeled arrows, and transformations are represented
by circles (also called bubbles). The DFD is presented in a hierarchical fashion. That is, the
first data flow model (sometimes called a level 0 DFD or context diagram) represents the
system as a whole. Subsequent data flow diagrams refine the context diagram, providing
increasing detail with each subsequent level.

The data flow diagram enables you to develop models of the information domain and functional
domain. As the DFD is refined into greater levels of detail, you perform an implicit functional
decomposition of the system. At the same time, the DFD refinement results in a corresponding
refinement of data as it moves through the processes that embody the application.
A few simple guidelines can aid immeasurably during the derivation of a data flow diagram:
(1) Level 0 data flow diagram should depict the software/system as a
single bubble;
41

(2) Primary input and output should be carefully noted;


(3) Refinement should begin by isolating candidate processes, data objects, and data stores to
be represented at the next level;
(4) All arrows and bubbles should be labeled with meaningful names;
(5) Information flow continuity must be maintained from level to level and
(6) One bubble at a time should be refined. There is a natural tendency to overcomplicate the
data flow diagram. This occurs when you attempt to show too much detail too early or represent
procedural aspects of the software in lieu of information flow.

Result:
Thus, the data flow diagrams have been created for the Attendance Management system
using facial recognition.
43

Aim
To create the sequence and collaboration diagram for the Attendance Management
System using facial recognition.

Sequence Diagram:
44

Collaboration Diagram:

Result:
Thus, the sequence and collaboration diagrams were created for the Attendance
Management System using facial recognition.
45

*/ For Example

Sequence Diagram

Collaboration Diagram
47

Aim
To develop the testing framework and/or user interface framework for the attendance
management system using facial recognition system.

Scope of testing:

1. Functional testing: Focus on testing the core functionality of the system, such as
capturing and storing images, recognizing faces, and displaying attendance records.

2. Performance testing: Focus on testing the speed and accuracy of the facial recognition
system, especially in scenarios where a large number of users need to be recognized
quickly.

3. Security testing: Focus on testing the system's ability to prevent unauthorized access
and protect sensitive data, such as implementing secure login and access controls.

4. Usability testing: Focus on testing the user interface's ease of use, especially in
scenarios where users may be less familiar with the technology, such as providing clear
instructions and guidance.

5. Regression testing: Focus on testing the system's ability to maintain its functionality
after changes or updates are made, such as verifying that new features do not break
existing functionality.

6. Integration testing: This type of testing focuses on testing the integration of the facial
recognition system with other systems or applications. You may test the system's
ability to integrate with the organization's existing attendance management system,
payroll system, or other systems.
48

Types of Testing, Methodology, Tools:

Result:
Thus, the testing framework/user interface framework has been created for the
attendance management system using facial recognition system.
50

Aim
To develop the test cases manual for the Attendance management system using facial
recognition system.

Functional Test cases:


51

Non-Functional Test cases:

Result: Thus, the test case manual has been created for the Attendance management system
using facial recognition system.
53

Aim
To prepare the manual test case report for the Attendance Management System using
facial recognition system.

Test Case ID: TC_001

Test Case Name: Facial Recognition System Integration Test


Test Objective: To ensure that the facial recognition system is properly integrated into the
attendance management system and is able to recognize faces accurately.

Test Steps:

Launch the attendance management system and navigate to the facial recognition section.
Click on the "Load Face" button and position the camera to capture a clear image of a face.
Click on the "Recognize" button and verify that the system correctly identifies the person in
the image.
Repeat the test with different individuals and verify that the system accurately recognizes all
faces.

Expected Results:

The system should properly integrate with the facial recognition system.
The system should be able to accurately recognize faces with a high degree of accuracy.
The system should produce consistent results when tested with different individuals.
General Uses:

This test case ensures that the facial recognition system is functioning correctly and accurately
identifies individuals in the attendance management system.
It helps to ensure the system can be used to automate the process of attendance tracking
using facial recognition technology.
54

Current Status of Testing:

As we are currently in the first test phase, the testing team has developed and executed test
cases for functional and non-functional requirements of the Attendance Management System
using Facial Recognition project. The team has identified several defects and issues that need
to be addressed before proceeding to the next phase of testing. Overall, the testing phase is
progressing according to the planned timeline, and the team is working to ensure that all
identified defects are resolved before the next phase of testing.

Present Obstacles to proceed further:

There are several potential obstacles that could arise when proceeding further with the
Attendance Management System using Facial Recognition project. These may include
technical challenges such as difficulty integrating the system with existing payroll or HR
systems, or ensuring the accuracy and reliability of the facial recognition technology. There
may also be legal and ethical concerns related to data privacy and compliance with
regulations surrounding the use of facial recognition technology. Additionally, the project may
face resource constraints such as lack of funding, personnel, or time. Finally, there may be
potential user adoption issues or resistance to change from employees who are used to
traditional attendance tracking methods.

Category Progress Against Plan Status


Functional Testing Green Completed
Non-Functional Testing Green Completed

Functional Test Case Coverage Status


(%)
Module ID 100% Completed

Result:
Thus, the test case report has been created for the Attendance Management System
using facial recognition system.
56

Aim
To provide the details of architectural design/framework/implementation

Abstract:
The Attendance Management System using Facial Recognition is a project aimed at developing
a reliable and efficient attendance management system for organizations. The system uses
facial recognition technology to automate attendance tracking and streamline payroll and HR
processes. It is implemented using Python programming language and utilizes OpenCV,
CMake, Pandas, and other Python libraries for facial recognition. The system also incorporates
databases such as MongoDB and utilizes SQL queries for data management. The collected
attendance data is reported in an Excel sheet for further analysis.
The system's architecture consists of multiple modules such as a facial recognition module,
attendance tracking module, and reporting module. It also incorporates security measures to
protect the collected data and ensure compliance with laws and regulations related to
attendance tracking and data protection.

The benefits of the Attendance Management System using Facial Recognition are numerous,
including increased accuracy and security of attendance data, cost savings, improved
productivity, and compliance with legal requirements. The system is customizable to fit the
unique needs of each organization and is designed to be user-friendly and intuitive.

However, there may be obstacles in the development and implementation of the system, such
as technical challenges, data privacy concerns, and potential resistance from employees.
Nevertheless, with the right resources, expertise, and a well-designed implementation plan, the
Attendance Management System using Facial Recognition can bring significant benefits to
organizations seeking to improve their attendance management processes.
57

Introduction:
The Attendance Management System using Facial Recognition project is aimed at developing
an efficient and accurate system for tracking attendance using facial recognition technology.
The manual attendance tracking process is often time-consuming and prone to errors, leading
to discrepancies in the recorded data. The system developed in this project will eliminate these
issues, resulting in a streamlined attendance management process.

The system will be developed using Python programming language, incorporating various
libraries for facial recognition such as OpenCV, CMake, and Pandas. It will utilize databases
like MongoDB and SQL for data management and storage, with attendance data being reported
in an Excel sheet for further analysis.

The project aims to provide several benefits to organizations, including automation of


attendance tracking, improved accuracy and security of attendance data, streamlining of payroll
and HR processes, cost savings from reducing manual attendance tracking methods, and
increased productivity by reducing time spent on administrative tasks. The project will also
ensure compliance with laws and regulations related to attendance tracking and data protection.

Requirement Analysis:
Here are the requirements analysis of the Attendance Management System using Facial
Recognition project:

• The system should be able to recognize and match the faces of individuals in real-time.
• The system should be able to track the attendance of individuals accurately and reliably.
• The system should be able to store attendance data securely in a database for future use.
• The system should provide a user-friendly interface for users to interact with the system
and access attendance data.
• The system should be able to integrate with existing payroll or HR systems to
streamline the process of calculating employee hours and compensation.
• The system should comply with laws and regulations related to attendance tracking and
data protection.
• The system should be able to handle multiple users and process attendance data
simultaneously.
• The system should have a high level of accuracy in facial recognition and attendance
tracking, with minimal errors or false positives.
• The system should be scalable and adaptable to fit the unique needs of the organization.
• The system should be able to generate reports and analytics on attendance data for
further analysis and decision-making.

Architecture:
58

The architecture for the Attendance Management System using Facial Recognition involves a
client-server model, where the client is the system interface and the server is responsible for
the facial recognition processing. The system will be developed using Python programming
language, and will utilize various libraries such as OpenCV, CMake, and Pandas for facial
recognition. The system will also incorporate databases such as MongoDB, and will utilize
SQL queries for data management. The system will have a modular design, with separate
modules for capturing images, facial recognition, data storage, and user interface. The system
will be able to integrate with existing payroll or HR systems to streamline attendance tracking
and calculating employee hours. The architecture will also have security measures in place to
protect the data collected by the facial recognition system, and will comply with laws and
regulations related to facial recognition technology and data protection.

Framework:

The framework of the project involves the use of Python programming language, along with
various Python libraries such as OpenCV, CMake, Pandas, etc. for facial recognition. The
system utilizes databases such as MongoDB and SQL queries for data management.

The attendance management system using facial recognition involves the following key
components:

• Data Collection: Capturing facial images of employees and storing them in the
database.
• Facial Recognition: Processing the captured images to recognize the employees and
mark their attendance.
• Database Management: Storing and managing the attendance data in databases such as
MongoDB or SQL.
• Reporting: Generating attendance reports in Excel sheets for further analysis.
The system architecture is designed in a way that ensures scalability, flexibility, and
maintainability of the system. The implementation involves a modular approach, where each
component is developed separately and then integrated to form the complete system. The
system is designed to be user-friendly, efficient, and secure, with features such as access control
and data encryption to protect the attendance data.

Implementation:

Screen 1
59

Screen 2

Screen 3
60

Screen 4
61

Screen 5

Source Code:
import threading
from functools import partial
from kivy.clock import Clock
from kivy.graphics.texture import Texture
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
import cv2
import numpy as np
import os
from datetime import datetime
from PIL import Image
from kivy.core.window import Window
import pandas as pd
Window.clearcolor = (.8, .8, .8, 1)

class AttendenceWindow(Screen):
pass

class DatasetWindow(Screen):
pass

class WindowManager(ScreenManager):
pass

kv = Builder.load_file("my.kv")

class MainApp(App):
running = False
Dir = os.path.dirname(os.path.realpath( file ))
def build(self):
62

self.icon = self.Dir + '/webcam.ico'


self.title = 'Face Detection Attendance System'
return kv
def break_loop(self):
self.running = False
def startAttendence(self):
threading.Thread(target=self.Attendence,
daemon=True).start()
def startTrain(self):
threading.Thread(target=self.train, daemon=True).start()
def startDataset(self):
threading.Thread(target=self.dataset, daemon=True).start()
def StudentList(self):
os.startfile(self.Dir + '/list/students.csv')
def AttendanceList(self):
os.startfile(self.Dir + '/Attendance/Attendance.csv')
def Attendence(self):
self.running = True
dataset_path = path = os.path.join(self.Dir, 'dataset')
if not (os.path.isdir(dataset_path)):
os.mkdir(dataset_path)
try:
user_id = int(kv.get_screen('main').ids.user_id.text)
now = datetime.now()
date_time = now.strftime("%d/%m/%Y %H:%M:%S")
date = now.strftime("%d/%m/%Y")
eye = cv2.CascadeClassifier(self.Dir +
'/haarcascade_eye.xml')
recog = cv2.face.LBPHFaceRecognizer_create()
recog.read(self.Dir + '/trainer/trainer.yml')
face = cv2.CascadeClassifier(self.Dir +
'/haarcascade_frontalface_default.xml')

font = cv2.FONT_HERSHEY_DUPLEX

rec = 0
id = 0
face_numbers = 5
camera = cv2.VideoCapture(0)
camera.set(3, 1920)
camera.set(4, 1080)

minWidth = 0.001*camera.get(3)
minHeight = 0.001*camera.get(4)
blink = 0
is_eye = False
while self.running:
rtrn, image=camera.read()
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = face.detectMultiScale(
gray,
scaleFactor = 1.3,
minNeighbors = face_numbers,
minSize = (int(minWidth), int(minHeight)),
)
63

eyes = eye.detectMultiScale(image,scaleFactor = 1.2,


minNeighbors = 5)
for (x, y, w, h) in eyes:
cv2.rectangle(image, (x, y),
(x + w, y + h), (255, 0, 0), 1)
if len(eyes) >= 2:
is_eye = True
cv2.putText(image, "eye detected", (50,50),
font, 1, (0,255,0), 1)
if(len(faces)==0):
blink = 0
if len(eyes) < 2:
blink+=1
cv2.putText(image, "Blink(16+) : {}".format(blink),
(1020,50), font, 1, (0,0,255), 2)
for(x,y,w,h) in faces:
id, match = recog.predict(gray[y:y+h,x:x+w])
if (id == user_id) and (match < 35):
rec = 1
cv2.rectangle(image, (x,y), (x+w,y+h),
(0,255,0), 2)
status = "Attandance Recorded"
cv2.putText(image, str(status), (x,y+h+25),
font, 1, (0,255,0), 1)
try:
df = pd.read_csv(self.Dir +
'/list/students.csv')
name = df.loc[df['id'] == id,
'name'].iloc[0]
except:
name = "Unknown"
match = " {0}%".format(round(100 - match))
else:
rec = 0
cv2.rectangle(image, (x,y), (x+w,y+h),
(0,0,255), 2)
status = "Attandance Not Recorded"
cv2.putText(image, str(status), (x,y+h+25),
font, 1, (0,0,255), 1)
name = "unknown"
match = " {0}%".format(round(100 - match))
cv2.putText(image, str(name), (x+5,y-5), font,
1, (255,255,255), 2)
cv2.putText(image, str(match), (x+5,y+h-5),
font, 1, (255,255,0), 1)
Clock.schedule_once(partial(self.display_frame,
image))
k = cv2.waitKey(1)
if k == 27:
break
if rec==1 and blink >15:
df = pd.read_csv(self.Dir +
'/Attendance/Attendance.csv')
coll = ['0']*len(df['id'])
if date in df.columns:
64

if (int(df.loc[df['id'] == id,
date].iloc[0]))==0:
df.loc[df['id'] == id, date]=1
df.to_csv(self.Dir +
'/Attendance/Attendance.csv', index=False)
kv.get_screen('main').ids.info.text =
"Attendence entered successfully."
else:
kv.get_screen('main').ids.info.text =
"Attendence already exist."
else:
df[date] = coll
df.loc[df['id'] == id, date]=1
df.to_csv(self.Dir +
'/Attendance/Attendance.csv', index=False)
kv.get_screen('main').ids.info.text =
"Attendence entered successfully."
else:
kv.get_screen('main').ids.info.text = "Attendence
not entered."
camera.release()
cv2.destroyAllWindows()
except Exception as e:
kv.get_screen('main').ids.info.text = "Some error
occured. Try again!"
print(e)
def display_frame(self, frame, dt):
texture = Texture.create(size=(frame.shape[1],
frame.shape[0]), colorfmt='bgr')
texture.blit_buffer(frame.tobytes(order=None),
colorfmt='bgr', bufferfmt='ubyte')
texture.flip_vertical()
kv.get_screen('main').ids.vid.texture = texture
def dataset(self):
dataset_path = path = os.path.join(self.Dir, 'dataset')
if not (os.path.isdir(dataset_path)):
os.mkdir(dataset_path)
try:
name = kv.get_screen('second').ids.user_name.text
face_id = kv.get_screen('second').ids.user_id.text
snap_amount = int(kv.get_screen('second').ids.snap.text)
camera = cv2.VideoCapture(0)
camera.set(3, 1920)
camera.set(4, 1080)

face = cv2.CascadeClassifier(self.Dir +
'/haarcascade_frontalface_default.xml')
if len(face_id)<=0 or len(name)<=0 or snap_amount <=0:
kv.get_screen('second').ids.info.text = "All Fields
Required"
else:
count = 0
while(True):
rtrn, image=camera.read()
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = face.detectMultiScale(gray, 1.3, 5)
65

for(x,y,w,h) in faces:
cv2.rectangle(image,
(x,y),(x+w,y+h),(255,0,0),2)
count+=1

cv2.imwrite(self.Dir +
"/dataset/"+str(name)+"_" + str(face_id) + '_' + str(count) +
".jpg", gray[y:y+h,x:x+w])
cv2.imshow('image', image)

wait = cv2.waitKey(10) & 0xff


if wait == 27:
break
elif count >=snap_amount:
break
camera.release()
cv2.destroyAllWindows()
try:
exist = False
df = pd.read_csv(self.Dir +
'/list/students.csv')
for i in range(len(df['id'])):
if df['id'].iloc[i] == int(face_id):
exist = True
if not exist:
df.loc[len(df.index)] = [int(face_id),name]
df.to_csv(self.Dir + '/list/students.csv',
index=False)
df1 = pd.read_csv(self.Dir +
'/Attendance/Attendance.csv')
for i in range(len(df1['id'])):
if df1['id'].iloc[i] == int(face_id):
exist = True
if not exist:
arr = [int(face_id),name]
arr =
np.concatenate((arr,[0]*(len(df1.columns)-2)))
df1.loc[len(df1.index)] = arr
df1.to_csv(self.Dir +
'/Attendance/Attendance.csv', index=False)
except Exception as e:
print(e)
kv.get_screen('second').ids.info.text = "Face
included successfully. Please train the system."
except:
kv.get_screen('second').ids.info.text = "Some error
occured. Try again!"
def getImage_Labels(self, dataset,face):
imagesPath=[os.path.join(dataset,f) for f in
os.listdir(dataset)]
faceSamples = []
ids = []
for imagePath in imagesPath:
PIL_img=Image.open(imagePath).convert('L')
img_numpy = np.array(PIL_img, 'uint8')
66

id=int(os.path.split(imagePath)[-1].split("_")[1])
faces = face.detectMultiScale(img_numpy)

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


faceSamples.append(img_numpy[y:y+h,x:x+w])
ids.append(id)
return faceSamples,ids
def train(self):
dataset_path = path = os.path.join(self.Dir, 'dataset')
if not (os.path.isdir(dataset_path)):
os.mkdir(dataset_path)
kv.get_screen('main').ids.info.text = "Training Faces."
kv.get_screen('second').ids.info.text = "Training Faces."
dataset = self.Dir + '/dataset'
recog = cv2.face.LBPHFaceRecognizer_create()
face = cv2.CascadeClassifier(self.Dir +
'/haarcascade_frontalface_default.xml')

faces,ids=self.getImage_Labels(dataset,face)
recog.train(faces, np.array(ids))

recog.write(self.Dir + '/trainer/trainer.yml')

kv.get_screen('main').ids.info.text =
str(len(np.unique(ids))) + " face trained."
kv.get_screen('second').ids.info.text =
str(len(np.unique(ids))) + " face trained."

if( name == " main "):


MainApp().run()

Result:

Thus, the details of architectural design/framework/implementation along with the


screenshots were provided.

You might also like