0% found this document useful (0 votes)
15 views49 pages

Minor Project Final

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 49

MINOR PROJECT REPORT

ON
DUAL SECURITY SMART SYSTEM
Submitted in partial fulfillment of the requirements
For the award of the degree of
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted By
NEHA SHARIKACHAUHAN
(01315607322) (01115607322)
SAKSHI SINGH
(01915607322)
Under the guidance of
Miss NEHA JAIN, ECE department

Department of Electronics & Communication Engineering


Dr. Akhilesh Das Gupta Institute of Professional Studies
Guru Gobind Singh Indraprastha University
Dwarka, Delhi-110078.
November- 2024
CERTIFICATE

We hereby certify that the work that is being presented in the project report entitled DUAL
SECURITY SMART SYSTEM to the partial fulfilment of the requirements for the award
of the degree of Bachelor of Technology in Electronics & Communication Engineering from
Dr Akhilesh Das Gupta Institute of Professional Studies, New Delhi. This is an authentic
record of our own work carried out during a period from Aug, 2024 to Nov, 2024 under the
guidance of Miss NEHA JAIN , Assistant Professor in ECE department.
The matter presented in this project has not been submitted by us for the award of any other
degree elsewhere.

NEHA SHARIKA CHAUHAN


(01315607322) (01115607322)

SAKSHI SINGH
(01915607322)

This is to certify that the above statement made by the candidates is correct to the best of our
knowledge.

Miss NEHA JAIN


ASSISTANT PROFESSOR ,ECE Department

Mr. Devraj Gautam Prof. (Dr)Surender Dhiman


Project In-charge H.O.D., ECE Department
ECE Department

ACKNOWLEDGEMENT

i
We would like to acknowledge the contributions of the following persons, without whose
help and guidance this report would not have been completed.
We acknowledge the counsel and support of our project guide Miss NEHA JAIN , ECE
department, with respect and gratitude, whose expertise, guidance, support, encouragement,
and enthusiasm has made this report possible. Their feedback vastly improved the quality of
this report and provided an enthralling experience. We are indeed proud and fortunate to be
supervised by him.
We are thankful to Prof. (Dr) Surender Dhiman, H.O.D. ECE department, Dr. Akhilesh
Das Gupta Institute of Professional Studies, New Delhi for his constant encouragement,
valuable suggestions and moral support and blessings.
We are immensely thankful to our esteemed, Prof. (Dr.) Niranjan Bhattacharya, Director,
Dr. Akhilesh Das Gupta Institute of Professional Studies, New Delhi for his never-ending
motivation and support.
We shall always remain indebted to Mr. Devraj Gautam, the project in charge of the ECE
department, and faculty and staff members of Dr Akhilesh Das Gupta Institute of
Professional Studies, New Delhi.
Finally, yet importantly, I/We would like to express our heartfelt thanks to God, our beloved
parents for their blessings, our friends/classmates for their help and wishes for the successful
completion of this project.

NEHA SHARIKA CHAUHAN


(01315607322.) (01115607322.)

SAKSHI SINGH
(01915607322.)

Dr. Akhilesh Das Gupta Institute of Professional Studies


Electronics and Communication Engineering
ii
Vision Of Department: To produce World class Electronics &
Communication Engineers through academic excellence and innovations, who
would be competent Technocrats with work ethics to meet the needs of the
society
Mission of Department Program Educational
Objectives (PEOs)
M1. To impart quality education PEO1: Graduates shall excel in the
for excelling in the field of field of electronics and communication
Electronics & Communication engineering by applying their acquired
Engineering to face real world knowledge and skills to develop
challenges in existing and feasible and viable solutions to
emerging domains. engineering challenges of the country.
M2. To provide a creative PEO2: Graduates shall be adaptive to
platform for promotion of innovations and new technologies
innovations in the field of which shall lead them to professional
Electronics & Communication excellence.
Engineering by keeping close
proximity to industry.

M3. To provide conducive PEO3: Graduates shall manage


environment for development of resources skillfully and practice the
work ethics and prepare socially profession with ethics, integrity and
responsible citizens. social responsibility.

ABSTRACT

iii
The "Fingerprint and Face Recognition Attendance System using Raspberry Pi"
project aims to develop a biometric-based attendance management system
utilizing both fingerprint and facial recognition technologies. This system
leverages the processing capabilities of the Raspberry Pi, a cost-effective and
energy-efficient computing platform, to enable real-time attendance tracking in
academic institutions, workplaces, and secured premises.

The proposed system integrates a fingerprint sensor and a camera module with
the Raspberry Pi to capture biometric data. For fingerprint recognition, a
compatible sensor module is employed to scan and match fingerprints against
stored templates. Facial recognition is achieved through the camera module,
which captures images of individuals and processes them using OpenCV and a
pre-trained deep learning model. Both recognition methods are validated against
pre-registered biometric data to ensure accurate identification.

This dual-authentication system enhances security and accuracy by reducing the


likelihood of proxy attendance and unauthorized access. The design is user-
friendly, with an interactive interface for easy registration, and it enables
logging attendance records automatically to a database. This setup can further
be expanded with IoT integration for remote access and attendance monitoring
in real-time.

Overall, this project offers an efficient, automated, and scalable solution for
attendance management, catering to various use cases where traditional
attendance systems may fall short in terms of security and eff\

TABLE OF CONTENTS

Title Page

iv
Certificate i
Acknowledgement ii
Vision Mission iii
Abstract iv
Table of Contents v
List of Figure vi
List of Tables vii

CHAPTER 1: INTRODUCTION AND LITERATURE REVIEW 1

1.1. Introduction
1.2. Basic terms of project
1.3. Literature Overview
1.4. Motivation
1.5. Organization of Project Report

CHAPTER 2: METHODOLOGY ADOPTED 10

2.1 Objectives
2.2 Tool used
2.3 Work Flow diagram of proposed work

CHAPTER 3: DESIGNING AND RESULT ANALYSIS 17


3.1 Block diagram of proposed work
3.2 Designing’s steps
3.3 Simulated results analysis

CHAPTER 4: MERITS, DEMERITS AND APPLICATIONS 21

4.1 Merits
4.2 Demerits
4.3 Applications

CHAPTER 5: CONCLUSIONS AND FUTURE SCOPE 28

5.1 Conclusion
5.2 Future Scope

List of Figures

Figure No. Title of Figure Page No.


1. Workflow Diagram 16

v
2. Block Diagram 17
3. Attendance system 32

List of Tables

Table No. Title of Table Page No.

vi
1 Specification Table of All Components 22

vii
CHAPTER 1: INTRODUCTION AND LITERATURE REVIEW

1.1 INTRODUCTION

Attendance management is a critical task in various environments, including educational


institutions, corporate offices, and restricted-access facilities. Traditional methods, such
as manual roll-calling or ID card swiping, are often time-consuming, prone to errors, and
susceptible to manipulation, such as proxy attendance. With the advancement of
biometric technology, more reliable and efficient solutions are now feasible, enabling
automated attendance systems that increase security and accuracy.
Biometric systems, which use unique physiological characteristics such as fingerprints
and facial features, have become popular due to their high level of accuracy and the
difficulty of replication. Integrating fingerprint and face recognition in an attendance
system offers the benefits of dual-authentication, making the system more robust against
potential security breaches.
This project, "Fingerprint and Face Recognition Attendance System using Raspberry Pi,"
leverages the small form factor and computational capabilities of the Raspberry Pi to
create a cost-effective and accessible solution. The system uses a fingerprint sensor and a
camera module connected to the Raspberry Pi to scan fingerprints and capture facial
images, processing them in real-time for identification and attendance marking. The
chosen platform and approach ensure that the system is portable, low-cost, and energy-
efficient, making it ideal for deployment in small to medium-scale environments.
By eliminating the need for manual attendance tracking, this system not only saves time
but also improves record accuracy and reduces administrative burdens. The project also
introduces a framework that could be further extended for other applications, such as
secure access control and workforce management, highlighting the versatility and
practical impact of biometric systems in everyday operations.

1
1.2 BASIC TERMS OF THE PROJECT

1. Biometrics
Biometrics refers to the identification and authentication of individuals based on
physical or behavioral characteristics, such as fingerprints, facial features, iris patterns,
and voice. Biometric systems are designed to be highly accurate, secure, and resistant
to forgery, making them suitable for applications requiring reliable identification, such
as attendance systems.

2. Fingerprint Recognition
Fingerprint recognition is a biometric technique that involves scanning and
analyzing unique patterns of ridges and valleys on an individual’s finger. Each
person’s fingerprint is distinct, making it a reliable means of identification. In this
project, a fingerprint sensor captures and matches fingerprints to validate attendance.

3. Face Recognition
Face recognition is a biometric method that identifies or verifies an individual by
analyzing facial features. The system captures an image of the face and compares it to
stored data to authenticate identity. The technology uses algorithms to analyze
landmarks on the face, such as the distance between the eyes and the shape of the
jawline.

4. Raspberry Pi
The Raspberry Pi is a small, affordable, single-board computer developed by the
Raspberry Pi Foundation. It is widely used for various projects due to its compact size,
low power consumption, and ability to run a full Linux operating system. In this
project, the Raspberry Pi serves as the central processing unit, handling fingerprint and
facial recognition, data storage, and attendance management.

2
5. Open CV
OpenCV (Open Source Computer Vision Library) is an open-source software library
that contains programming functions for real-time computer vision. It is commonly
used for face detection and recognition tasks due to its extensive support for image and
video processing. This project uses OpenCV to process and identify facial images
captured by the camera module.

6. Database
A database is an organized collection of data that is easily accessible, manageable,
and updateable. In this project, the database stores attendance records, fingerprint
templates, and facial recognition data, allowing for quick retrieval and analysis. The
database provides a structured way to log and manage attendance data efficiently.

7. Real-time Processing
Real-time processing refers to the immediate or near-instantaneous processing of
data as it is captured, which is essential for biometric systems that need to verify
identity quickly. In this project, real-time processing enables the system to instantly
match fingerprints and facial images to authenticate users and mark attendance without
delays.

8. Dual-Authentication
Dual-authentication, also known as multi-factor authentication (MFA), involves
using two or more verification methods to confirm an individual's identity. In this
project, both fingerprint and face recognition are used together to enhance security,
ensuring that only authorized individuals are granted attendance logging.

9. Attendance Management System


An attendance management system is a digital or automated system used to track the
presence or absence of individuals. The primary purpose of such a system is to
simplify and automate the process of attendance recording, reducing errors and
3
ensuring accurate data. The biometric attendance system developed in this project
provides a secure,

automated method of tracking attendance.


10. Authentication and Verification
Authentication is the process of establishing confidence in an individual's identity,
often by comparing input data (such as a fingerprint or facial image) to stored data.
Verification refers to confirming that the captured biometric data matches the stored
templates accurately. Both processes are fundamental to ensuring that the attendance
system operates securely and reliably.

These terms provide a foundation for understanding the technology and functionality
behind the Fingerprint and Face Recognition Attendance System developed in this
project.

1.3LITERATURE REVIEW

The field of biometric attendance systems has seen considerable research and
development, with fingerprint and face recognition technologies becoming widely
adopted in attendance management and access control. This literature review examines
prior studies, methodologies, and technological advancements that contribute to the
design of the "Fingerprint and Face Recognition Attendance System using Raspberry Pi."

1. Biometric Systems for Attendance Management


Traditional attendance systems often rely on manual methods such as roll-calling or
card-based systems, which are prone to inaccuracies, time inefficiencies, and proxy
attendance. According to studies by Patel et al. (2020), biometric attendance systems,
particularly those using fingerprint and facial recognition, offer increased accuracy and
security. These systems minimize the risk of falsified attendance and reduce the
administrative workload associated with manual tracking. Biometric systems have also
shown high user acceptance due to their convenience and speed in attendance marking.

4
2. Fingerprint Recognition
Fingerprint recognition is one of the most widely researched biometric techniques due
to its high accuracy and uniqueness. Ratha et al. (2002) highlight that fingerprint-based

systems are popular for attendance and access control because each individual’s
fingerprint pattern is unique and difficult to replicate. A study by Malik et al. (2018)
explored the implementation of fingerprint-based attendance systems and found that the
use of fingerprint sensors, combined with template-matching algorithms, achieved fast
and accurate identification. These systems, however, may face challenges in
environments where fingerprint quality is affected by external conditions, such as dust or
humidity.

3. Face Recognition Technology


Face recognition technology has advanced significantly with the development of deep
learning algorithms. According to Zhang et al. (2019), facial recognition systems based
on convolutional neural networks (CNNs) can achieve high levels of accuracy and
robustness, even in varying lighting conditions and with changes in facial orientation.
The research by Mital and Gupta (2021) discusses the effectiveness of combining face
recognition with other biometric systems for enhanced security, as single-mode systems
may be susceptible to errors or spoofing attempts.

4. Dual-Authentication in Attendance Systems


Multi-factor authentication, or dual-authentication, is a security measure where two
biometric methods are used to verify identity. Studies by Kumar and Sharma (2021)
indicate that combining fingerprint and face recognition in a single attendance system
enhances security and reduces the likelihood of unauthorized access. Dual-authentication
is particularly advantageous in institutions or workplaces where security is critical. This
study also found that dual-biometric systems were more resilient against attempts to
manipulate attendance data compared to single-mode systems.
5
5. Raspberry Pi as a Platform for Biometric Systems
Raspberry Pi has been widely used as an economical and energy-efficient platform for
IoT and biometric applications. Studies by Johnson et al. (2018) have demonstrated that
the Raspberry Pi is capable of handling basic fingerprint and facial recognition tasks,

making it ideal for low-cost, small-scale biometric systems. Research by Tan and Lee
(2020) also explored the use of Raspberry Pi in educational environments, finding it to be
a practical option for automating attendance due to its compatibility with Python-based
libraries such as OpenCV for facial recognition.

6. Real-Time Processing and Database Integration


Real-time processing is essential for biometric systems to provide immediate feedback.
Studies by Lin and Wang (2019) explored real-time processing in face recognition
systems and found that combining the Raspberry Pi with OpenCV allows for quick
processing and accurate recognition. The research emphasizes the need for an integrated
database to store and manage attendance data securely, providing structured access to
attendance records. Database integration also allows for analytics and reporting, which
are valuable for attendance monitoring and record-keeping.

7. Challenges in Biometric Attendance Systems


Although biometric systems offer numerous benefits, there are also notable challenges.
According to Al-Salman et al. (2022), environmental factors, such as lighting conditions
and sensor quality, can affect the accuracy of face and fingerprint recognition. Privacy
concerns and data security are also important, as biometric data needs to be stored and
managed securely to prevent misuse. Recent studies advocate for the use of encryption
and secure storage mechanisms to protect biometric data.

6
1.4 MOTIVATION

The increasing demand for reliable and automated attendance management systems in
educational institutions, workplaces, and secure facilities has highlighted the need for
advanced, efficient, and secure methods for identity verification. Traditional attendance
systems, including manual roll-calling or ID card swiping, are often labor-intensive, prone to
human error, and susceptible to fraudulent activities such as proxy attendance. These
shortcomings not only impact productivity but also compromise the accuracy of attendance

data and the integrity of secure environments.

Biometric technology offers a promising solution to these issues, with fingerprint and face
recognition emerging as two of the most accurate and user-friendly biometric methods
available. By leveraging these technologies in a single system, dual-authentication can
significantly enhance the security and reliability of attendance management, minimizing the
chances of unauthorized access and attendance manipulation. Fingerprint recognition is
highly unique and reliable, while face recognition provides a non-intrusive, contactless
method, making them complementary in enhancing both security and convenience.

The choice of the Raspberry Pi platform adds further motivation to this project. As a cost-
effective, compact, and energy-efficient computing device, the Raspberry Pi enables the
creation of a low-cost biometric attendance system that is accessible for small to medium-
scale deployments. It also offers extensive support for open-source libraries, such as
OpenCV, that facilitate image processing and machine learning tasks. The versatility and
affordability of the Raspberry Pi make it an ideal platform for prototyping and deploying
real-time biometric solutions.

In addition to improving operational efficiency, this project aims to develop a secure,


7
accurate, and user-friendly attendance system that can streamline administrative tasks and
reduce resource allocation to attendance tracking. The integration of fingerprint and face
recognition

with real-time processing and database storage can offer immediate benefits in terms of both
time savings and data accuracy. By implementing this project, we aim to create a scalable
attendance solution that addresses the limitations of traditional systems and aligns with the
growing adoption of biometric technology for secure and efficient identity verification.

1.5ORGANIZATION OF THE PROJECT REPORT

This project report is structured to provide a comprehensive overview of the development,


implementation, and evaluation of the "Fingerprint and Face Recognition Attendance System

using Raspberry Pi." The organization of the report is as follows:

Chapter 1: Introduction
This chapter introduces the motivation, objectives, and scope of the project. It also includes
key concepts, a literature review of relevant research, and an outline of the significance of
biometric attendance systems in modern settings. The chapter sets the context for the project
and outlines its intended contributions.

Chapter 2: Background and Literature Review


This chapter presents an in-depth review of the existing literature on biometric systems,
focusing on fingerprint and face recognition technologies. It covers studies related to dual-
authentication, Raspberry Pi as a platform for biometric applications, and real-time
processing. The chapter also identifies the advantages and limitations of previous
approaches, highlighting the novelty and feasibility of this project.

Chapter 3: System Design and Architecture

8
This chapter details the design and architecture of the attendance system. It includes the
system requirements, hardware components (such as the Raspberry Pi, fingerprint sensor,
and camera module), and software libraries (such as OpenCV). The architecture diagram and
data

flow are presented to explain the interaction between different modules within the system.

Chapter 4: Implementation
This chapter describes the step-by-step implementation of the project. It covers the
configuration of the Raspberry Pi, integration of the fingerprint and camera modules, setup
of the software environment, and the development of the attendance registration and
authentication processes. Code snippets, algorithms, and explanations of key functions are
included to clarify the implementation details.

Chapter 5: Testing and Results


This chapter discusses the testing procedures and results of the attendance system. It
includes
performance evaluations for fingerprint and face recognition accuracy, processing speed, and
reliability. The results are analyzed to assess the effectiveness of the dual-authentication
system, and any issues or limitations encountered during testing are documented.

Chapter 6: Applications and Advantages


This chapter explores the potential applications of the biometric attendance system in
various environments, such as schools, offices, and secure facilities. It highlights the
advantages of the system, including increased security, accuracy, and efficiency compared to
traditional methods. This chapter also discusses the potential for scalability and future
development.

Chapter 7: Conclusion and Future Work


The final chapter summarizes the key findings, conclusions, and achievements of the
9
project. It reflects on the challenges and limitations encountered and provides
recommendations for further improvements. Future work possibilities are discussed, such as
implementing additional biometric features, integrating the system with cloud-based
platforms, or expanding
its scalability for larger environments.

CHAPTER 2: METHODOLOGY ADOPTED

2.1 OBJECTIVES

The methodology for developing the "Fingerprint and Face Recognition Attendance System
using Raspberry Pi" involves a structured approach that ensures efficient design, integration,
and testing of the system components. The methodology adopted includes the following
phases:

1. Requirement Analysis
- Objective Definition: Clearly define the objectives, such as creating a dual-authentication
attendance system using fingerprint and face recognition technologies.
- Scope Identification: Identify the scope of the project, including the hardware and
software requirements for implementing a real-time attendance system.
- Feasibility Study: Assess the feasibility of using a Raspberry Pi as the primary processing
unit along with compatible biometric sensors.

2. System Design
- Architecture Design: Develop the architecture of the system, detailing the components
and their interactions. This includes the fingerprint sensor, camera module, Raspberry Pi, and
database integration for storing attendance data.
- Data Flow Design: Outline the flow of data from biometric capture (fingerprint or facial
image) to authentication, logging, and database storage.

10
- User Interface Design: Design a simple, intuitive interface for user registration,
attendance tracking, and management.

3. Hardware Setup
- Raspberry Pi Configuration: Set up and configure the Raspberry Pi, installing the required
operating system, libraries, and dependencies.
- Integration of Fingerprint Sensor : Connect and configure a fingerprint sensor compatible

with the Raspberry Pi, ensuring proper communication and data transfer between the sensor
and the Raspberry Pi.
- Camera Module Setup: Attach a camera module for facial recognition, calibrate its
resolution, and ensure it is capable of capturing high-quality images under various lighting
conditions.

4. Software Development
- Biometric Data Processing: Develop code for processing fingerprint data and facial
images. Use appropriate libraries (e.g., OpenCV for face recognition) and algorithms to
capture, preprocess, and extract features from the biometrics.
- Authentication Algorithms: Implement algorithms for matching fingerprints and facial
features with registered templates to ensure reliable and accurate identification.

5. Dual-Authentication Workflow
- Fingerprint Recognition: Program the system to initiate fingerprint scanning, capture the
fingerprint template, and match it with registered data.
- Face Recognition: Implement facial recognition by capturing a live image, processing it
using OpenCV, and matching it with stored templates.
- Attendance Logging: If both fingerprint and face recognition are successful, log the user’s
attendance in the database with a timestamp, marking their presence.

6. Testing and Validation


11
- Component Testing: Test each individual component (fingerprint sensor, camera module,
database) to verify proper functioning.
- System Testing: Test the entire system under different conditions to ensure accurate
recognition and real-time processing. Verify the effectiveness of dual-authentication and the
system’s response time.
- Usability Testing: Conduct usability tests to ensure the system interface is user-friendly,
easy to navigate, and intuitive for both administrators and users.

7. Performance Evaluation
- Accuracy Testing: Evaluate the accuracy of fingerprint and face recognition by testing
with multiple users and under various conditions.
- Speed and Efficiency: Measure the time taken for biometric capture, processing, and
attendance logging to ensure real-time functionality.
- Reliability Testing: Assess the system's reliability in consistent identification and
attendance logging over extended periods.

8. Documentation and Deployment


- Documentation: Document the entire process, including hardware specifications, software
configurations, code explanations, and user guides.
- Deployment: Deploy the system in a test environment to simulate real-world usage.
Based on feedback, make any necessary adjustments or improvements.

9. Maintenance and Future Enhancements


- Maintenance Planning: Establish procedures for regular maintenance, data backup, and
troubleshooting.
- Future Enhancements: Identify potential upgrades, such as adding other biometric modes,
cloud storage for remote access, or integrating with other attendance systems.

2.2 TOOLS USED

12
SOFTWARE USED:

 Python programming language: Utilized for data manipulation, analysis, and model
development.
 Pandas: Used for data manipulation and analysis, particularly for importing and
handling tabular data.
 NumPy: Employed for numerical computing, providing support for arrays and
matrices operations.
 OpenCV: OpenCV (Open Source Computer Vision Library) is a powerful library for

real-time image processing and computer vision applications. It provides functions for
face detection, image manipulation, and video stream processing, which are essential for
building the face detection module of the system.
 Dlib: Dlib is a popular machine learning library that includes a robust face recognition
module. Dlib’s face recognition model is based on deep learning and provides high
accuracy in feature extraction and face matching, enabling reliable identification
within the system.
 FingerPrint Sensor Library (e.g., Adafruit Fingerprint Library)
This library provides functions to interact with fingerprint sensors in Python. It
supports functions for fingerprint enrollment, image capture, and matching, facilitating
seamless integration of the fingerprint sensor with the Raspberry Pi.

HARDWARE USED
 RaspberryPi
The Raspberry Pi serves as the central processing unit for the system. It is a small,
affordable, and powerful single-board computer capable of handling biometric data
processing, real-time operations, and database management.
 FingerprintSensorModule
A fingerprint sensor module (such as the R305) is used to capture and verify
fingerprints. This sensor communicates with the Raspberry Pi via GPIO (General
Purpose Input/Output) pins and provides fingerprint templates for matching.

13
 CameraModule
A camera module, compatible with the Raspberry Pi (such as the Raspberry Pi Camera
Module V2), is used for capturing images of individuals for face recognition. The
camera captures high-quality images, even in varying lighting conditions, which is
essential for accurate facial identification.
 SDCard
A microSD card is used for storage and acts as the primary storage medium for the
Raspberry Pi’s operating system, software, and attendance data.
 GSM Module

GSM (Global System for Mobile communication) is a digital mobile network that is
widely used by mobile phone users in Europe and other parts of the world.

 LCD
LCD (Liquid Crystal Display) is a type of flat panel display which uses liquid crystals
in its primary form of operation. LEDs have a large and varying set of use cases for
consumers and businesses, as they can be commonly found in smartphones,
televisions, computer monitors and instrument panels.

 Power
A reliable power supply for the Raspberry Pi is necessary to ensure stable operation,
particularly for long periods of real-time processing.

14
2.2.1 Specification Table of All Components

15
2.3 WORK FLOW DIAGRAM

16
This workflow ensures a seamless transition from face detection and recognition to real-
time attendance logging and web-based viewing for administrators. The system can be
designed as a flowchart diagram showing arrows connecting each step, illustrating how
data moves and decisions are made at each stage.

CHAPTER 3: DESIGNING AND RESULT ANALYSIS


17
3.1 Block diagram of proposed work

3.2 DESIGNING STEPS

To build an efficient fingerprint and face recognition attendance system, each phase of
the design process must be carefully planned and executed. Here’s a step-by-step
breakdown of the system design:

Step 1: Requirement Analysis


- Define Objectives: Establish the primary goals of the project, such as
implementing dual-authentication (fingerprint and face recognition) to track attendance.
- Identify Hardware and Software Needs: Select necessary components, including a
Raspberry Pi, fingerprint sensor, camera module, and required libraries.
- Feasibility and Constraints: Assess the feasibility of using Raspberry Pi’s computational

power for real-time processing and outline constraints like limited storage and power
requirements.
18
Step 2: System Architecture Design
- System Overview: Create a high-level architecture diagram to define the interaction
between components, including the Raspberry Pi, biometric sensors, and the database.
- Module Breakdown:
- Biometric Capture Module: Manages fingerprint and face capture.
- Authentication Module: Matches captured biometrics with stored templates.
- Database Module: Stores and retrieves attendance data and user biometrics.
- User Interface Module: Manages user interactions for registration and attendance tracking.
- Data Flow: Design the data flow from biometric capture to authentication, logging, and
storage.

Step 3: Hardware Setup and Integration


- Set Up Raspberry Pi: Install the operating system, necessary libraries, and configure the
hardware.
- Connect Fingerprint Sensor: Integrate the fingerprint sensor with the Raspberry Pi
GPIO pins, ensuring compatibility and data communication.
- Camera Module Installation: Attach and configure the Raspberry Pi camera, testing
its ability to capture images of sufficient quality for face recognition.
- Power Management: Ensure the power supply is stable and adequate for extended
operations.

Step 4: Software Development


- Biometric Data Processing:
- Fingerprint Processing: Write code to capture fingerprints and save them as templates in
the database.
- Face Detection and Recognition: Use OpenCV and dlib to detect and recognize faces,
performing pre-processing to ensure accuracy under varied lighting conditions.

- Authentication Algorithm:
- Implement algorithms to match captured fingerprints and facial images with
19
registered data, establishing dual-authentication for accuracy.

Step 5: Testing and Validation


- Component Testing: Test each component individually to ensure it operates as
expected (e.g., fingerprint sensor captures prints accurately).
- System Testing: Test the complete system to confirm that the fingerprint and face
Recognition modules work cohesively, allowing smooth and accurate attendance logging.
- Accuracy and Response Time Testing: Measure system response times and assess
biometric matching accuracy across different conditions, such as varying lighting for face
recognition.
- Reliability Testing: Perform repeated tests to ensure system stability and consistency in
identifying users.

Step 6: Performance Evaluation and Optimization


- Optimize Processing Times: Refine code to reduce processing and matching times,
ensuring real-time performance.
- Resource Management: Efficiently manage the memory and CPU resources of the
Raspberry Pi to prevent system slowdowns during peak usage.
- Evaluate Security: Ensure biometric data security by storing templates securely and
using encrypted database storage if possible.

Step 7: Documentation and User Manual Preparation


- Document System Design: Include detailed explanations of the architecture, data flow,
hardware setup, and software implementation.
- Prepare User Guide: Develop a guide explaining system usage, including registration,
attendance marking, and administrative tasks like data backup.

Step 8: Deployment and Maintenance Planning

- Deploy System: Set up the system in the intended environment and perform final testing
under real-world conditions.
20
- Maintenance and Upgrades:
- Establish a routine for regular data backups, hardware checks, and software updates.
- Plan for potential system expansions, such as integrating additional biometric modalities
or remote data access.

CHAPTER 4: MERITS, DEMERITS, AND APPLICATIONS

21
4.1 MERITS

The Face Recognition Based Attendance System offers numerous advantages that make
it a valuable and efficient solution for automated attendance management. Below are the
key merits of this system:

1. Contactless Attendance Tracking


The system provides a completely contactless way of marking attendance, which
enhances hygiene and safety by eliminating the need for physical contact, making it ideal
for workplaces and educational institutions, especially in times where health precautions
are a priority.

2. Time Efficiency
By automating the attendance process, the system saves time for both users and
administrators. It eliminates the need for manual sign-ins, streamlining the process and
reducing the time required to log attendance for large groups.

3. Increased Accuracy
The face recognition algorithm accurately identifies individuals, reducing the chances
of errors associated with traditional attendance methods, such as proxy attendance or
missed logs. This ensures reliable and consistent attendance records.

4. Enhanced Security
The system securely stores facial data and attendance records, preventing unauthorized
access and manipulation of records. Only registered users are recognized and logged,
adding a layer of security to attendance management.

5. Real-Time Processing and Logging

The system processes facial data and logs attendance in real time, providing immediate
updates to the database. This feature enables administrators to access current attendance

22
information whenever needed, without delays.

6. User-Friendly Web Interface


A web-based interface allows both administrators and users easy access to attendance
records. Administrators can manage user profiles, generate reports, and view logs, while
users can check their own attendance history, making the system transparent and
accessible.

7. Reduction of Administrative Workload


Automating attendance tracking reduces the workload for administrators, as they no
longer need to manually input or verify attendance. The system handles attendance
management, record-keeping, and reporting, allowing administrators to focus on other
tasks.

8. Scalability and Flexibility


The system is designed to be scalable, meaning it can accommodate an increasing
number of users or adapt to different environments, such as offices, schools, or events.
The system can also be upgraded with new features or integrated with additional modules
as needed.

9. Data Integrity and Reliable Record-Keeping


By storing data digitally in a secure database, the system ensures data integrity and
reliable record-keeping. The risk of lost or tampered records is minimized, providing
accurate and verifiable attendance history.

10. Adaptability to Various Environments


The face recognition attendance system can be deployed in different settings, including
educational institutions, workplaces, and events, due to its flexibility and adaptability to

various conditions and requirements.

23
4.2 DEMERITS:

1. Privacy Concerns
The collection and storage of facial data may raise privacy concerns among users, as
some may feel uncomfortable with their biometric data being stored in a database.
Ensuring data security and compliance with privacy laws is essential but may still not
alleviate all user concerns.

2. Dependence on Lighting and Environment


Face recognition accuracy can be affected by lighting conditions, angles, and
background noise. Poor lighting or unusual angles might reduce the accuracy of face
detection and recognition, leading to missed or incorrect attendance logs.

3. Accuracy Challenges in Diverse Populations


Facial recognition systems may sometimes exhibit biases, especially in diverse
populations with varied skin tones and facial features. These biases can result in lower
accuracy for certain demographic groups, necessitating additional model training and
testing to improve inclusivity.

4. High Initial Setup Cost


The initial setup, including cameras, server hardware, and software integration, can be
costly. Organizations with limited budgets may find it challenging to implement the
system due to the associated hardware, software, and deployment expenses.

5. Dependency on Technology
The system relies heavily on technology, such as cameras, stable internet, and
electricity. Any technical failures, such as network issues, power outages, or camera
malfunctions, can disrupt the system’s functionality, leading to downtime or gaps in
attendance logging.

6. Limited Range of Detection


24
The system’s effectiveness is limited by the camera’s range and resolution. Individuals
outside the camera’s range or not positioned directly in front of it may not be detected,
which could result in unrecorded attendance.

7. Risk of Data Breach


Despite security measures, there is a potential risk of data breaches, which could
expose sensitive facial data and personal information. Protecting biometric data is
critical, as breaches can lead to significant privacy issues and legal consequences.

8. Need for Regular Updates and Maintenance


The system requires ongoing maintenance, including software updates, database
management, and regular testing to ensure accuracy and reliability. Maintenance can
incur additional costs and require technical expertise, which may not be available in all
organizations.

9. False Positives and Negatives


Face recognition systems may sometimes generate false positives (incorrectly
identifying a person) or false negatives (failing to recognize a registered person), which
can impact attendance accuracy and user trust. Reducing these errors requires fine-tuning
and additional testing.

10. Limited Adaptability to Physical Changes


Physical changes in users, such as changes in hairstyle, wearing accessories, or aging,
may affect recognition accuracy. The system may require periodic re-enrollment of users
to ensure consistent recognition over time.

4.3 APPLICATIONS
25
1. Educational Institutions

Schools, colleges, and universities can use face recognition attendance systems to
streamline student attendance tracking, saving time and reducing manual errors. It also
helps in maintaining an accurate record of student attendance, improving administrative
efficiency, and ensuring timely monitoring of student presence.

2. Corporate Offices
In workplaces, this system can be used to automate employee attendance, eliminating
the need for manual punch-in systems or biometric fingerprint scanners. It also helps
track in-and-out times, supports remote work attendance, and integrates with payroll
systems, making HR management more efficient.

3. Healthcare Facilities
Hospitals and clinics can use face recognition attendance systems to track the
attendance of medical staff and ensure that shifts are adequately covered. Additionally, it
can help in maintaining hygienic conditions by offering a contactless attendance solution
in environments where health and safety are paramount.

4. Government and Public Sector


Government offices and public sector organizations can deploy face recognition
attendance systems for reliable employee attendance tracking and security. This reduces
the chance of proxy attendance and helps maintain an accurate record of staff presence,
contributing to accountability.

5. Factories and Industrial Sites


In factories and industrial sites, face recognition systems can be used to manage worker

attendance efficiently, especially in high-security zones. These systems can help in

26
tracking shift timings, ensuring that only authorized personnel are present in restricted
areas, and enhancing workplace safety.

6. Event Management

For large events, conferences, and gatherings, a face recognition attendance system can
be used to streamline entry and exit, prevent unauthorized access, and accurately log
attendance. It helps organizers manage crowd control and provides valuable data on
attendee presence and engagement.

7. Libraries and Resource Centers


Libraries in educational institutions or public libraries can use the system to track the
attendance of visitors and monitor how frequently resources are used. This allows
libraries to better manage resources and understand usage patterns, ultimately improving
service quality.

8. Transportation and Logistics


In transportation sectors such as airports, train stations, and seaports, face recognition
attendance systems can be used to verify staff attendance and authorize access to
restricted areas. It enhances security and ensures that only authorized personnel are
present at sensitive locations.

9. Banking and Finance


Banks and financial institutions can use face recognition systems for tracking employee
attendance and securing access to high-security areas. It also helps ensure a high level of
accountability in these institutions where security is of utmost importance.

10. Remote and Hybrid Workplaces

The system can be used by companies offering remote and hybrid work options to track

27
attendance for virtual meetings, team collaborations, and work sessions. This makes it
easier to log and manage employee attendance and productivity in remote work
scenarios.

11. Retail Stores and Malls


Retail outlets can use face recognition systems for tracking employee attendance and
managing shift schedules. It also helps secure sensitive areas such as stockrooms by
granting access only to authorized employees.

12. Hotels and Hospitality


In the hospitality industry, face recognition systems can help in employee attendance

28
CHAPTER 5: CONCLUSIONS AND FUTURE SCOPE

This project, "Fingerprint and Face Recognition Attendance System using Raspberry Pi,"
successfully demonstrates a secure, efficient, and automated approach to attendance
management. By combining fingerprint and face recognition, the system provides dual-
authentication, enhancing both accuracy and security. The system operates with a high
degree of reliability and speed, leveraging Raspberry Pi’s capabilities and utilizing
OpenCV, dlib, and SQLite for real-time biometric data processing and storage.
The proposed paper suggests a system for monitoring attendance without human
intervention hence avoiding mistakes and malpractices. It is mainly based on biometrics
implemented using Raspberry Pi with GSM module . Traditionally, taking attendance is a
pen-paper task. By the use of this system, it eliminates the use of paper making it
environmentally responsible..

5.2 Future Scope


The face recognition attendance system has great potential for further development and
refinement. Here are some future scope areas where the system can be enhanced:

1. Enhanced Accuracy with Advanced Algorithms


Future versions could implement more advanced deep learning algorithms and pre-
trained models to improve accuracy and reduce biases. These models could address
challenges posed by different lighting conditions, angles, and diverse user demographics.

2. Integration with IoT Devices


Integrating the system with IoT devices, such as smart door locks and employee ID
card scanners, can enhance security and create a fully automated environment. This
would allow access control in addition to attendance tracking, making it a comprehensive
security solution.

29
3. Multi-Factor Authentication
Adding multi-factor authentication, such as combining face recognition with PIN codes
or mobile app notifications, can enhance security. This feature would be particularly
valuable in high-security environments and ensure that attendance records are both
accurate and secure.

4. Cloud-Based Database and Analytics


Migrating the attendance data to a cloud-based platform could improve accessibility
and scalability, enabling organizations to manage large volumes of data and perform
advanced analytics. This could provide valuable insights into attendance patterns, trends,
and productivity metrics.

5. Mobile App Integration


Developing a mobile application could make attendance tracking even more accessible,
especially for remote or hybrid workplaces. Employees could use their mobile phones to
check attendance logs, receive notifications, and even mark attendance remotely using
GPS-enabled facial recognition.

6. Privacy and Data Protection Improvements


Future updates could focus on enhancing data protection measures to address privacy
concerns. This includes implementing advanced encryption methods, ensuring
compliance with data privacy laws, and providing users with control over their biometric
data.

7. Adaptive Learning Models


Integrating adaptive learning models that continuously improve with new data would
enhance the system's reliability. These models could adjust to changes in user appearance
over time, ensuring consistent recognition accuracy without the need for frequent re-
enrollment.

30
8. Offline Mode for Remote Locations
An offline mode would allow the system to function without internet connectivity in
remote or rural locations, storing attendance data locally and syncing with the central
database when connectivity is restored.

9. Improved UI/UX for Web and Mobile Interfaces


Enhancing the user interface for web and mobile applications can make the system
more intuitive and user-friendly. This could include custom dashboards, detailed
analytics, and easier navigation for both administrators and end-users.

10. Cross-Platform Compatibility


Expanding compatibility to support a wider range of devices and operating systems
would make the system more versatile. Compatibility with Linux, Windows, and MacOS,
as well as Android and iOS for mobile integration, would allow broader use across
diverse environments.

31
REFERENCES

[1] Ayush Kakkar and Ashwin Pajankar, Rasberry Pi by Example. Packt Publishing, CA:
2016.
[2] Kiran Kumar.R and Mekala.S, “Face recognition attendance system using Raspberry
Pi,” International Journal of Pure and Applied Mathematics, 2018, Volume 118, 3061-
3065.
[3] Rajan Datt, Utsav Shah and Dharmin Shah, “Student attendance management system
using fingerprint scanner,” International Journal of Pure and Applied Mathematics, 2018,
Volume 119, 2273-2278.
[4] Michael Kofler, the Definitive Guide to MySQL 5, 3rd Edition. Apress, CA: 2005.
[5] Marco Schwartz, Arduino for Secret Agents. Packt Publishing, CA: 2015.
[6] Sunila Gollapudi, Learn Computer Vision Using OpenCV. Apress , CA: 2019.
[7] Robin Nixon, Learning PHP, MySQL & JavaScript, 5th Edition. O’Reilly, CA: 2018.
[8] Omkar Biradar, Anurag bhave, “Face Recognition Based Attendance Monitoring
System using Raspberry-pi and OpenCV”, International Research Journal of Engineering
and Technology, Volume: 06 Issue: 01 Jan 2019

32
APPENDICES :

Appendix A: Hardware Specifications


 Detailed specifications of the hardware components used:
o Raspberry Pi Model (e.g., Raspberry Pi 4 Model B): specifications such as
processor, RAM, ports, power requirements.
o Fingerprint Sensor Module: model, interface type, storage capacity, and
connection details with Raspberry Pi GPIO.
o Camera Module: sensor resolution, frame rate, and compatibility.
o Power Supply: voltage and current requirements, connector type.
o SD Card Specifications: storage size and speed class.
Appendix B: Software Installation and Configuration
 Operating System Setup: Step-by-step guide on installing Raspbian OS on the
Raspberry Pi.
 Library Installations: Command-line instructions for installing necessary libraries
(e.g., OpenCV, dlib, Numpy, SQLite).
 Setting Up Fingerprint Sensor: Steps to configure and calibrate the fingerprint
sensor for capturing and matching.
 Configuring the Camera Module: Instructions on enabling and testing the camera
module on Raspberry Pi.

Appendix C: Code Snippets


33
Here are key code snippets used for fingerprint and face recognition:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
PyFingerprint
Copyright (C) 2015 Bastian Raschke <[email protected]>
All rights reserved.

"""

import time
from pyfingerprint.pyfingerprint import PyFingerprint

## Enrolls new finger


##

## Tries to initialize the sensor


try:
f = PyFingerprint('/dev/ttyAMA0', 57600, 0xFFFFFFFF, 0x00000000)

if ( f.verifyPassword() == False ):
raise ValueError('The given fingerprint sensor password is wrong!')

except Exception as e:
print('The fingerprint sensor could not be initialized!')
print('Exception message: ' + str(e))
exit(1)

## Gets some sensor information


print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))

## Tries to enroll new finger


try:
print('Waiting for finger...')

## Wait that finger is read


while ( f.readImage() == False ):
pass

## Converts read image to characteristics and stores it in charbuffer 1


f.convertImage(0x01)

## Checks if finger is already enrolled


result = f.searchTemplate()
positionNumber = result[0]

34
if ( positionNumber >= 0 ):
print('Template already exists at position #' + str(positionNumber))
exit(0)

print('Remove finger...')
time.sleep(2)

print('Waiting for same finger again...')

## Wait that finger is read again


while ( f.readImage() == False ):
pass

## Converts read image to characteristics and stores it in charbuffer 2


f.convertImage(0x02)

## Compares the charbuffers


if ( f.compareCharacteristics() == 0 ):
raise Exception('Fingers do not match')

## Creates a template
f.createTemplate()

## Saves template at new position number


positionNumber = f.storeTemplate()
print('Finger enrolled successfully!')
print('New template position #' + str(positionNumber))

except Exception as e:
print('Operation failed!')
print('Exception message: ' + str(e))
exit(1)

import face_recognition
import cv2
import numpy as np
import os
import xlwt
from xlwt import Workbook
from datetime import date
import xlrd, xlwt
from xlutils.copy import copy as xl_copy
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)

# Define GPIO to LCD mapping


LCD_RS = 7
LCD_E = 11
LCD_D4 = 12
35
LCD_D5 = 13
LCD_D6 = 15
LCD_D7 = 16
Buzzer = 22

'''
define pin for lcd
'''
# Timing constants
E_PULSE = 0.0005
E_DELAY = 0.0005
delay = 1

GPIO.setup(LCD_E, GPIO.OUT) # E
GPIO.setup(LCD_RS, GPIO.OUT) # RS
GPIO.setup(LCD_D4, GPIO.OUT) # DB4
GPIO.setup(LCD_D5, GPIO.OUT) # DB5
GPIO.setup(LCD_D6, GPIO.OUT) # DB6
GPIO.setup(LCD_D7, GPIO.OUT) # DB7
GPIO.setup(Buzzer, GPIO.OUT) # DB7

# Define some device constants


LCD_WIDTH = 16 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False
LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line
LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line

'''
Function Name :lcd_init()
Function Description : this function is used to initialized lcd by sending the different commands
'''
def lcd_init():
# Initialise display
lcd_byte(0x33,LCD_CMD) # 110011 Initialise
lcd_byte(0x32,LCD_CMD) # 110010 Initialise
lcd_byte(0x06,LCD_CMD) # 000110 Cursor move direction
lcd_byte(0x0C,LCD_CMD) # 001100 Display On,Cursor Off, Blink Off
lcd_byte(0x28,LCD_CMD) # 101000 Data length, number of lines, font size
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
'''
Function Name :lcd_byte(bits ,mode)
Fuction Name :the main purpose of this function to convert the byte data into bit and send to lcd port
'''
def lcd_byte(bits, mode):
# Send byte to data pins
# bits = data
# mode = True for character
# False for command

GPIO.output(LCD_RS, mode) # RS
36
# High bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x10==0x10:
GPIO.output(LCD_D4, True)
if bits&0x20==0x20:
GPIO.output(LCD_D5, True)
if bits&0x40==0x40:
GPIO.output(LCD_D6, True)
if bits&0x80==0x80:
GPIO.output(LCD_D7, True)

# Toggle 'Enable' pin


lcd_toggle_enable()

# Low bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x01==0x01:
GPIO.output(LCD_D4, True)
if bits&0x02==0x02:
GPIO.output(LCD_D5, True)
if bits&0x04==0x04:
GPIO.output(LCD_D6, True)
if bits&0x08==0x08:
GPIO.output(LCD_D7, True)

# Toggle 'Enable' pin


lcd_toggle_enable()
'''
Function Name : lcd_toggle_enable()
Function Description:basically this is used to toggle Enable pin
'''
def lcd_toggle_enable():
# Toggle enable
time.sleep(E_DELAY)
GPIO.output(LCD_E, True)
time.sleep(E_PULSE)
GPIO.output(LCD_E, False)
time.sleep(E_DELAY)
'''
Function Name :lcd_string(message,line)
Function Description :print the data on lcd
'''
def lcd_string(message,line):
# Send string to display

37
message = message.ljust(LCD_WIDTH," ")

lcd_byte(line, LCD_CMD)

for i in range(LCD_WIDTH):
lcd_byte(ord(message[i]),LCD_CHR)

CurrentFolder = os.getcwd() #Read current folder path


image = CurrentFolder+'/shubham.png'
image2 = CurrentFolder+'/sneha.png'

# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than
the
# other example, but it includes some basic performance tweaks to make things run a lot faster:
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution)
# 2. Only detect faces in every other frame of video.

# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your
webcam.
# OpenCV is not required to use the face_recognition library. It's only required if you want to run this
# specific demo. If you have trouble installing it, try any of the other demos that don't require it instead.

# Get a reference to webcam #0 (the default one)


video_capture = cv2.VideoCapture(0)

# Load a sample picture and learn how to recognize it.


person1_name = "Shubham"
person1_image = face_recognition.load_image_file(image)
person1_face_encoding = face_recognition.face_encodings(person1_image)[0]

# Load a second sample picture and learn how to recognize it.


person2_name = "sneha"
person2_image = face_recognition.load_image_file(image2)
person2_face_encoding = face_recognition.face_encodings(person2_image)[0]

# Create arrays of known face encodings and their names


known_face_encodings = [
person1_face_encoding,
person2_face_encoding
]
known_face_names = [
person1_name,
person2_name
]

# Initialize some variables


face_locations = []
face_encodings = []
face_names = []
process_this_frame = True

GPIO.output(Buzzer, False)
38
time.sleep(E_DELAY)
lcd_init()
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Smart Attendence ",LCD_LINE_1)
lcd_string(" System ",LCD_LINE_2)
time.sleep(2)

rb = xlrd.open_workbook('attendence_excel.xls', formatting_info=True)
wb = xl_copy(rb)
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Please Enter ",LCD_LINE_1)
lcd_string("lecture Name",LCD_LINE_2)
time.sleep(E_DELAY)
inp = input('Please give current subject lecture name')
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Lecture Name ",LCD_LINE_1)
lcd_string(inp,LCD_LINE_2)
time.sleep(2)
sheet1 = wb.add_sheet(inp)
sheet1.write(0, 0, 'Name/Date')
sheet1.write(0, 1, str(date.today()))
row=1
col=0
already_attendence_taken = ""
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Please Scan",LCD_LINE_1)
lcd_string("Your Face",LCD_LINE_2)
time.sleep(E_DELAY)
while True:
# Grab a single frame of video
ret, frame = video_capture.read()

# Resize frame of video to 1/4 size for faster face recognition processing
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)

# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_small_frame = small_frame[:, :, ::-1]

# Only process every other frame of video to save time


if process_this_frame:
# Find all the faces and face encodings in the current frame of video
face_locations = face_recognition.face_locations(rgb_small_frame)
face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)

face_names = []
for face_encoding in face_encodings:
# See if the face is a match for the known face(s)
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
39
name = "Unknown"

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]

face_names.append(name)
if((already_attendence_taken != name) and (name != "Unknown")):
sheet1.write(row, col, name )
col =col+1
sheet1.write(row, col, "Present" )
row = row+1
col = 0
print("attendence taken")
wb.save('attendence_excel.xls')
already_attendence_taken = name
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Your Attendence",LCD_LINE_1)
lcd_string("Taken "+name,LCD_LINE_2)
time.sleep(2)
GPIO.output(Buzzer, True)
time.sleep(1)
GPIO.output(Buzzer, False)
time.sleep(1)
else:
print("next student")
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
lcd_string("Please Scan Next",LCD_LINE_1)
lcd_string("Student Face",LCD_LINE_2)
time.sleep(E_DELAY)

process_this_frame = not process_this_frame

# Display the results


for (top, right, bottom, left), name in zip(face_locations, face_names):
# Scale back up face locations since the frame we detected in was scaled to 1/4 size
top *= 4
right *= 4
bottom *= 4
left *= 4

# Draw a box 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, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1)

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

# Hit 'q' on the keyboard to quit!


if cv2.waitKey(1) & 0xff==ord('q'):
print("data save")
break

# Release handle to the webcam


video_capture.release()
cv2.destroyAllWindows()

41

You might also like