Smart Attendance System Report Final Document For Print
Smart Attendance System Report Final Document For Print
on
BACHELOR OF TECHNOLOGY
In
ELECTRONICS AND COMMUNICATION ENGINEERING
By
1
SREENIDHI INSTITUTE OF SCIENCE AND TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)
Yamnampet (V), Ghatkesar (M), Hyderabad – 501 301
CERTIFICATE
2
DECLARATION
We hereby declare that the work described in this thesis titled “SMART
ATTENDANCE SYSTEM USING ML TECHNIQUES” which is being submitted by us
in partial fulfilment for the award of Bachelor of Technology in the Department of
Electronics and Communication Engineering, Sreenidhi Institute of Science and
Technology is the result of investigations carried out by us under the guidance of Dr.
Asha Devi, Professor, Dept. of ECE, Sreenidhi Institute of Science and
Technology, Hyderabad.
No part of the thesis is copied from books/ journals/ internet and whenever the
portion is taken, the same has been duly referred. The report is based on the project
work done entirely by us and not copied from any other source. The work is original
and has not been submitted for any Degree/Diploma of this or any other University.
Place: Hyderabad
Date:
A. SAI CHARAN 21315A0401
B. SRI CHARAN 21315A0402
V. VARAPRASAD 21315A0403
3
ACKNOWLEDGEMENTS
We wish to express our deep sense of gratitude to our Internal guide and project
coordinator Dr. Asha Devi, Professor ECE Department who has taken great care in
the Project Work undertaken, by devoting their valuable time in advising and guiding
us at each phase, leading to successful completion of our Project Work. It has been
an educative and enlightening experience working with her.
We are greatly indebted to Prof. Dr. S.P.V Subba Rao, Head of the department
of Electronics and Communication for providing valuable guidance at every stage of
this Project Work.
We are thankful to our principal Dr. T. C. H. Siva Reddy for providing valuable
guidance and support at every stage of this Project Work.
We are profoundly grateful to our director Dr. C. V. Tomy and college
authorities for helping us in completing our Project Work. We would also like to
thank all our other faculty members and staff who supported us completing the
project work.
4
Contents
Abstract 8
CHAPTER1 : INTRODUCTION
1.1 Motivation 9
1.2 Background 9-10
1.3 Problem Statement 10-11
1.4 Aims and objectives 11-12
CHAPTER 2 : LITERATURE SURVEY 13 – 16
CHAPTER 3 : FUNDAMENTALS
3.1 Machine Learning 18
3.2 Deep Learning 19
3.3 Machine Learning vs Deep Learning 20
3.4 Open CV 22
3.5 HOG 23
3.6 Convolution Neural Network 24
3.7 Support Vector Machine 27
CHAPTER 4 : IMPLEMENTATION PROCESS 29 - 32
CHAPTER 5 : RESULTS
5.1 Output Images 33-35
5
CHAPTER 6: CONCLUSION & FUTURE SCOPE
6.1 Conclusion 37
6.2 Future Scope 38
REFERENCES 39-41
APPENDIX :
1.1 face_detection.py CODE 42
1.2 smart_attendance_system_program 43-44
6
LIST OF FIGURES
7
ABSTRACT
The paper outlines the development of a facial recognition system coupled with
a smart attendance feature using OpenCV and Python. Its core objective is to
streamline attendance processes in educational institutions or workplaces by
harnessing computer vision capabilities. Through real-time face detection and
recognition, manual attendance marking becomes obsolete, enhancing efficiency and
accuracy. Employing machine learning algorithms, the system is trained to precisely
identify individuals, ensuring dependable attendance tracking. A user-friendly
interface facilitates administrators in efficiently managing attendance records.
Notably, the project aims to overcome the shortcomings of traditional
attendance methods, offering a more precise and convenient alternative. OpenCV,
renowned for its prowess in computer vision tasks, is pivotal in handling challenges
like varying lighting conditions, facial expressions, and occlusions. Python's
integration enables seamless development and customization, ensuring adaptability
to specific needs. In conclusion, this endeavour seeks to deliver a practical and
trustworthy solution for automating attendance management, fostering enhanced
efficiency and productivity in both educational and organizational contexts.
Keywords: Face recognition, Smart Attendance system, Python, OpenCV,
Machine Learning.
8
CHAPTER 1
INTRODUCTION
9
1.1 MOTIVATION:
1.2 BACKGROUND:
10
to Robinson-Riegler and Robinson-Riegler (2008), the human visual system
then engages in analyzing the shape, size, contour, and texture of objects,
including faces, to extract relevant information. This analyzed data is
subsequently compared to stored representations of faces in our memory to
facilitate recognition.
11
recording their attendance status. The proposed system aims to optimize the
attendance-taking process through the integration of cutting-edge technologies
like machine learning algorithms and biometric recognition methods. Its goal is
to reduce errors, enhance efficiency, and offer immediate insights into
attendance trends in real-time.
This innovative approach not only improves efficiency but also enhances
the overall effectiveness of attendance management in various contexts,
including educational institutions, workplaces, and event venues. The
integration of machine learning algorithms allows for the automated
identification of individuals, reducing the need for manual intervention and
increasing the accuracy of attendance records. Additionally, the real-time
monitoring capabilities of the system enable prompt action in response to
attendance data, facilitating better decision-making and resource allocation.
Overall, the project aims to revolutionize traditional attendance-taking
methods, offering a more efficient, accurate, and adaptable solution for
attendance management.
Initially, the system will focus on identifying facial segments within video
frames accurately. This involves developing advanced algorithms capable of
discerning and isolating human faces, regardless of varying backgrounds and
perspectives, ensuring reliable face detection capabilities.
12
Following feature extraction, the system will engage in feature
classification to facilitate facial identification. Through the utilization of
machine learning or deep learning models, specific facial characteristics will be
associated with known individuals, enabling precise matching of detected faces
with their respective identities. This classification process significantly
enhances the system's capability to recognize faces with consistency and
efficiency.
13
CHAPTER 2
LITERATURE REVIEW
14
[2] Harsh D Joshi; Aditya Kakhandaki; Kimaya Pawar; Seema U Deoghare,
"Automated Attendance Tracking and Wage Management System Using IRIS
Detection".
Attendance Monitoring System Using LBPH and HAAR Algorithm, 2023 9th
International Conference on Advanced Computing and Communication Systems
(ICACCS).
15
The paper introduces an automated attendance management system that relies
on face detection and recognition algorithms to identify students as they enter the
classroom and record their attendance through recognition. Specifically, the Local
Binary Pattern Histogram (LBPH) algorithm is employed in this system, chosen for its
demonstrated superior performance compared to other algorithms. LBPH is known
for its robustness and effectiveness in capturing facial features, making it well-suited
for accurate face recognition tasks in real-world environments. By leveraging LBPH,
the system aims to achieve reliable and efficient attendance tracking, enhancing
classroom management and administrative processes.
[4] Ali Sharifara; Mohd Shafry Mohd Rahim; Yasaman Anisi, "A general review
of human face detection including a study of neural networks and Haar feature-
based cascade classifier in face detection".
[5] Wang Qiang; Zhang Zhijing; Ye Xin; Jin Xin; Zhou Zhi, "Directional Sub-
pixel Edge Detection Based on Limited Window Local Entropy", 2011 Fourth
International Conference on Intelligent Computation Technology and Automation.
Within the proposed system, students are prompted to stand in front of the
camera, initiating iris detection and face recognition processes that streamline
attendance marking. To facilitate iris detection, the system leverages a combination
of algorithms including Gray Scale Conversion, Six Segment Rectangular Filter, and
Skin Pixel Detection. These algorithms work cohesively to accurately identify and
capture iris patterns, contributing to the system's overall effectiveness in attendance
management. By integrating iris detection alongside face recognition, the system
addresses concerns related to proxy attendance, ensuring the reliability and integrity
of attendance records.
While the implementation of iris detection and face recognition enhances the
system's robustness, it may introduce a potential drawback in terms of time
efficiency. As individuals are required to wait for the preceding members to complete
the iris detection and face recognition process, there may be delays in attendance
marking, leading to potential time wastage. Despite this challenge, the system's
ability to mitigate proxy attendance risks and ensure accurate student attendance
management remains paramount. Efforts to optimize the iris detection and face
recognition processes to minimize wait times while maintaining reliability are crucial
for enhancing the overall efficiency and usability of the proposed attendance system.
17
CHAPTER 3
FUNDANMENTALS
18
3.1 MACHINE LEARNING:
At the heart of machine learning lies the concept of models, which are
mathematical representations of patterns or relationships within data. These
models are trained using a variety of algorithms that adjust their parameters to
minimize errors or discrepancies between predicted outcomes and actual data.
Various machine learning algorithms exist, categorized into types such as
supervised learning, unsupervised learning, and reinforcement learning. Each
type is tailored for specific tasks and data structures, offering a diverse range
of applications and capabilities.
19
bias, and job displacement, highlighting the importance of responsible and
ethical implementation.
One of the key advantages of deep learning is its ability to automatically learn
hierarchical representations of data at different levels of abstraction. This
hierarchical representation enables deep neural networks to effectively capture
intricate patterns and features within the data, making them well-suited for tasks
such as image recognition, speech recognition, natural language processing, and
more.
There are several types of deep learning architectures tailored to different tasks
and data modalities. Convolutional Neural Networks (CNNs) are widely used for tasks
involving image recognition and computer vision. CNNs leverage convolutional layers
to extract spatial hierarchies of features from input images, enabling them to
recognize patterns such as edges, textures, and shapes.
20
Another type of deep learning architecture is the Generative Adversarial
Network (GAN), which consists of two neural networks— a generator and a
discriminator— pitted against each other in a game-theoretic framework. GANs are
used for generating realistic synthetic data, image-to-image translation, and data
augmentation. The generator network learns to generate data samples that are
indistinguishable from real data, while the discriminator network learns to
differentiate between real and synthetic data, thereby pushing the generator to
improve its output.
Machine learning and deep learning are two prominent subfields within the
broader domain of artificial intelligence, each with distinct characteristics and
applications. While both involve training algorithms to learn from data, they differ in
their approach, complexity, and the types of problems they address.
21
On the other hand, deep learning is a subset of machine learning that
leverages artificial neural networks with multiple layers to model and extract complex
patterns from data. Deep learning architectures, inspired by the structure and
function of the human brain, consist of interconnected nodes organized into layers.
These networks can automatically learn hierarchical representations of data at
different levels of abstraction, making them well-suited for tasks involving image
recognition, speech recognition, natural language processing, and more.
One of the key distinctions between machine learning and deep learning lies in
the depth and complexity of the models used. While traditional machine learning
algorithms often rely on handcrafted features and shallow models, deep learning
models learn multiple levels of representation from the data itself, eliminating the
need for manual feature engineering in many cases. This allows deep learning models
to capture intricate patterns and features within the data, leading to state-of-the-art
performance in various domains.
22
Furthermore, deep learning often requires large amounts of labeled data and
computational resources for training, making it more computationally intensive
compared to some traditional machine learning techniques. However, the scalability
and flexibility of deep learning have fueled significant advancements in AI, enabling
breakthroughs in areas such as computer vision, natural language processing, and
autonomous systems. Despite their differences, both machine learning and deep
learning play crucial roles in advancing artificial intelligence and driving innovation
across industries.
One of the key strengths of OpenCV lies in its extensive collection of pre-built
functions and algorithms, which significantly streamline the development process for
computer vision applications. These functions cover a wide range of tasks, from basic
image processing operations such as filtering, edge detection, and morphological
operations to advanced techniques like feature detection, camera calibration, and
machine learning-based object detection.
23
3.5 HISTOGRAM OF ORIENTED GRADIENTS (HOG):
24
Figure No 3.2 Histogram of oriented gradients
25
At the heart of CNNs are convolutional layers, which perform the convolution
operation on input data using learnable filters or kernels. These filters slide across
the input image, computing dot products between the filter weights and the pixel
values in the receptive field. This operation results in feature maps that capture
spatial hierarchies of features, such as edges, textures, and patterns, across different
regions of the image.
CNNs also incorporate pooling layers, such as max pooling or average pooling,
which down sample the feature maps by summarizing the information within local
neighbourhoods. Pooling helps reduce the spatial dimensionality of the feature maps
while retaining important features, making the network more robust to variations in
the input data and reducing computational complexity.
26
layers, which are responsible for extracting features from the input data. These layers
employ learnable filters or kernels to convolve over the input image, computing dot
products and generating feature maps that capture spatial hierarchies of features.
With a depth of 128 measurements, the embedding encodes increasingly abstract
and discriminative representations of the input data as it progresses through the
convolutional layers. The pooling layers then down sample the feature maps,
summarizing the information within local neighbourhoods and reducing spatial
dimensionality. Through this process, the CNN learns to extract meaningful features
from the input data, enabling it to perform tasks such as image classification, object
detection, and semantic segmentation effectively.
27
Support vectors, pivotal in SVMs, represent data points positioned closest to
the decision boundary, thus delineating the optimal hyperplane and establishing the
margin. By prioritizing margin maximization, SVMs achieve heightened generalization
efficacy and resilience to noise. Employing kernel functions, SVMs can address non-
linearly separable data by projecting input data into higher-dimensional spaces
conducive to separation. Throughout the training process, SVMs fine-tune a convex
objective function to strike a balance between maximizing margin and minimizing
classification errors. Subsequently, when presented with new data points, SVMs
classify them based on their proximity to the decision boundary, thereby determining
their assigned class label.
28
CHAPTER 4
IMPLEMENTATION PROCESS
29
The initial step in building a facial recognition system using OpenCV involves
capturing an image from a camera as input. OpenCV provides functionalities to
interface with cameras and capture frames in real-time. This step typically involves
accessing the camera feed, either from a connected webcam or an external camera
device, and capturing a frame containing the face of the person whose attendance is
to be recorded. Careful consideration must be given to factors such as lighting
conditions, camera angles, and image resolution to ensure optimal results.
Following the image capture stage, the next crucial step is face detection using
OpenCV's pre-trained face detection models or custom-trained classifiers. OpenCV
offers various face detection algorithms. These algorithms analyze the captured image
to identify regions containing human faces. Upon detection, bounding boxes are
drawn around the detected faces, providing visual cues for further processing.
Once the face is successfully detected, the next step involves extracting the
facial region from the captured image. OpenCV provides utilities to crop and extract
regions of interest (ROI) from images based on the coordinates of the detected
30
bounding boxes. By isolating the facial region, unnecessary background information
is eliminated, allowing for more accurate facial feature extraction and recognition.
Preprocessing techniques such as resizing, normalization, and grayscale conversion
may also be applied to the extracted facial images to enhance their quality and
simplify subsequent processing.
After extracting and preprocessing the facial images, they are saved to a
storage location for future reference and comparison. OpenCV offers functionalities to
save images in various formats, such as JPEG or PNG, ensuring compatibility with
other image processing tools and applications. These saved images serve as reference
data for training recognition models or for comparison with new input images during
the recognition phase. Proper organization and labeling of the saved images are
essential for efficient retrieval and management of the dataset.
In the final step, the saved facial images are loaded and used for matching
against new input images. OpenCV provides tools for loading images from storage
and performing tasks such as feature extraction, similarity computation, and
matching. Techniques like facial embedding extraction using deep learning models or
feature extraction using traditional methods like Histogram of Oriented Gradients
(HOG) may be employed to represent facial images as numerical vectors. These
vectors are then compared with the vectors of input facial images using similarity
metrics such as cosine similarity or Euclidean distance to determine matches. The
recognition results are subsequently used for attendance tracking, identity
verification, or other applications requiring facial recognition capabilities. Through
these steps, a comprehensive facial recognition system is developed using OpenCV,
capable of capturing, detecting, extracting, saving, and matching facial images for
diverse use cases.
31
Figure No 4.2 Operation flow chart
32
CHAPTER 5
RESULTS
33
5.1 OUTPUT IMAGES:
35
CHAPTER 6
36
6.1 CONCLUSION:
37
6.2 FUTURE SCOPE:
38
REFERENCES
39
“Forecasting Election Results using Machine Learning Techniques”,
Communication and Management Journal, pp-88-96, vol.8,issue.10, Oct-
2023.
[9]. Dharmavaram Asha Devi, Satyavati Jaga, “Analysis of Scheduled
Routing Algorithms on 5Port Router for Network on Chip Application”,
International Journal of Scientific & Technology Research, ISSN 2277-8616,
VOLUME 8, ISSUE 09, pp-2148-2153, September 2019.
[10]. M. Veldurthi and A. D. Dharmavaram, "Automatic Vehicle
Identification and Recognition using CNN Implemented on PYNQ
Board," 2022 6th International Conference on Electronics, Communication and
Aerospace Technology, Coimbatore, India, 2022, pp. 1302-1306, doi:
10.1109/ICECA55336.2022.10009054
[11]. Babu, M.S., Raj, K.B., Devi, D.A. (2021). Data Security and Sensitive
Data Protection using Privacy by Design Technique. In: Haldorai, A., Ramu,
A., Mohanram, S., Chen, MY. (eds) 2nd EAI International Conference on Big
Data Innovation for Sustainable Cognitive Computing. EAI/Springer
Innovations in Communication and Computing. Springer,
Cham. https://doi.org/10.1007/978-3-030-47560-4_14
[12]. Jinane Mounsef, Lina Karam, "Augmented Sparse Representation
Classifier for Blurred Face Recognition", 2018 25th IEEE International
Conference on Image Processing (ICIP), pp.778-782, 2018.
[13]. Hongjun Wang, Jiani Hu, Weihong Deng, "Compressing Fisher Vector
for Robust Face Recognition", IEEE Access, vol.5, pp.23157-23165, 2017
[14]. Jeong-Jik Seo, Hyung-Il Kim, Yong Man Ro, "Pose-Robust and
Discriminative Feature Representation by Multi-task Deep Learning for
Multi-view Face Recognition", 2015 IEEE International Symposium on
Multimedia (ISM), pp.166-171, 2015
[15]. Rosebrock, A. (2019). Deep Learning for Computer Vision with
Python. PyImageSearch.
[16]. Wonjun Hwang, Junmo Kim, "Mark1ov Network-Based Unified
Classifier for Face Recognition", IEEE Transactions on Image Processing,
vol.24, no.11, pp.4263-4275, 2015
40
[17]. Togneri, R., & Bennamoun, M. (2001). Face recognition using line
edge maps. IEEE Transactions on Pattern Analysis and Machine
Intelligence, 23(6), 691-697.
[18]. Bradski, G., & Kaehler, A. (2008). Learning OpenCV: Computer Vision
with the OpenCV Library
[19]. Belhumeur, P. N., Hespanha, J. P., & Kriegman, D. J. (1997).
Eigenfaces vs. Fisherfaces: Recognition using class specific linear
projection. IEEE Transactions on Pattern Analysis and Machine
Intelligence, 19(7), 711-720.
[20]. Thambiratnam, D. P., & Ramana, K. V. (2018). A review on face
recognition algorithms. International Journal of Pure and Applied
Mathematics, 118(19), 3589-3600.
[21] https://medium.com/@ageitgey/machine-learning-is-fun-part-4-
modern-face-recognition-with-deep-learning-c3cffc121d78.
41
APPENDIX :
1.1 face_detection.py CODE :
# importing librarys
import cv2
import numpy as npy
import face_recognition as face_rec
# function
def resize(img, size) :
width = int(img.shape[1]*size)
height = int(img.shape[0] * size)
dimension = (width, height)
return cv2.resize(img, dimension, interpolation= cv2.INTER_AREA)
# img declaration
smplimg = face_rec.load_image_file('sample_images\smplimg.jpg')
smplimg = cv2.cvtColor(smplimg, cv2.COLOR_BGR2RGB)
smplimg = resize(smplimg, 0.50)
smplimg_test = face_rec.load_image_file('sample_images\elonmusk.jpg')
smplimg_test = resize(smplimg_test, 0.50)
smplimg_test = cv2.cvtColor(smplimg_test, cv2.COLOR_BGR2RGB)
faceLocation_smplimg = face_rec.face_locations(smplimg)[0]
encode_smplimg = face_rec.face_encodings(smplimg)[0]
cv2.rectangle(smplimg, (faceLocation_smplimg[3], faceLocation_smplimg[0]),
(faceLocation_smplimg[1], faceLocation_smplimg[2]), (255, 0, 255), 3)
faceLocation_smplimgtest = face_rec.face_locations(smplimg_test)[0]
encode_smplimgtest = face_rec.face_encodings(smplimg_test)[0]
cv2.rectangle(smplimg_test, (faceLocation_smplimg[3],
faceLocation_smplimg[0]), (faceLocation_smplimg[1], faceLocation_smplimg[2]),
(255, 0, 255), 3)
cv2.imshow('main_img', smplimg)
cv2.imshow('test_img', smplimg_test)
cv2.waitKey(0)
cv2.destroyAllWindows()
42
1.2 smart_Attendance_system_program.py CODE :
import cv2
import numpy as np
import face_recognition as face_rec
import os
import pyttsx3 as textSpeach
from datetime import datetime
engine = textSpeach.init()
path = 'student_images'
studentImg = []
studentName = []
myList = os.listdir(path)
for cl in myList :
curimg = cv2.imread(f'{path}/{cl}')
studentImg.append(curimg)
studentName.append(os.path.splitext(cl)[0])
def findEncoding(images) :
imgEncodings = []
for img in images :
img = resize(img, 0.50)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
encodeimg = face_rec.face_encodings(img)[0]
imgEncodings.append(encodeimg)
return imgEncodings
def MarkAttendance(name):
with open('Attendance.csv', 'r+') as f:
myDatalist = f.readlines()
nameList = []
for line in myDatalist :
entry = line.split(',')
nameList.append(entry[0])
43
engine.say(statment)
engine.runAndWait()
EncodeList = findEncoding(studentImg)
vid = cv2.VideoCapture(1)
while True :
success, frame = vid.read()
Smaller_frames = cv2.resize(frame, (0,0), None, 0.25, 0.25)
facesInFrame = face_rec.face_locations(Smaller_frames)
encodeFacesInFrame = face_rec.face_encodings(Smaller_frames, facesInFrame)
if matches[matchIndex] :
name = studentName[matchIndex].upper()
y1, x2, y2, x1 = faceloc
y1, x2, y2, x1 = y1*4, x2*4, y2*4, x1*4
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 3)
cv2.rectangle(frame, (x1, y2-25), (x2, y2), (0, 255, 0),
cv2.FILLED)
cv2.putText(frame, name, (x1+6, y2-6), cv2.FONT_HERSHEY_COMPLEX,
1, (255, 255, 255), 2)
MarkAttendance(name)
cv2.imshow('video',frame)
cv2.waitKey(1)
44