Uploaded by Jaimin Shrimali

Mini Project Report Format

advertisement
LOK JAGRUTI KENDRA UNIVERSITY, AHMEDABAD
A
Project Report On
Face Mask Detection using Machine Learning
B. E. Semester-V
(Computer Engineering Department)
Submitted by:
Name of Students
Enrollment No.
Jivani Shrusti
170430116050
Ms. Monali Patel.
(Faculty Guide)
Academic Year (2023-24)
1
LOK JAGRUTI KENDRA UNIVERSITY, AHMEDABAD
COMPUTER ENGINEERING
CERTIFICATE
This is to certify to Jivani Shrusti of B.E Semester 5thI.T. Class, Enrollment No.
170430116050 has satisfactorily completed her Mini Project work of the subject
ProjectReport on Face Mask Detection and recognition using Machine
Learning during the academic year 2023-24 and submitted on
.
Head of Department
Guided By
Prof. Shruti Raval
Prof. Monali Patel
Computer Department
Computer Department
LJU, Ahmedabad
LJU , Ahmedabad
Certified that this
Examiner
term work is accepted an assessed on
Convener
2
ACKNOWLEGEMENT
We are heartily thankful to all faculty members of the department of Computer
Engineering from L.J University, Ahmedabad for making my project. It is my pleasure
to take this opportunity to thank all people who helped me directly or indirectly to
prefer this project would have been impossible without their guidance. They all
encouraged and trusted in our ideas. They were always available for us to give
guidance about the project. The disruption about the project and the great advice given
by them helped to make this project complete. We are thankful to them pristine and
enlightening guidance given to as throughout the semester.
We are especially thankful to our internal guide Prof. Monali Patel , for their
Encouragement, guidance, understanding and lots of support and trust. Without his help
this project would not be success. Finally, we thank all persons who directly or indirectly
supported us in making this project.
3
ABSTRACT
Face mask detection using machine learning is a project which detects whether person is
wearing mask or not. Our project will be helpful to private companies , educational institute
, hospitals, government sector etc. Due to COVID-19 outbreak wearing of mask is compulsory
when person enters premises it will detect whether person is wearing mask or not. As our
project is about detecting face mask using machine learning so for that we need to train a
model so that it can detect face mask and for training our model we require huge amount of
data set. So for data set we started collecting images of faces with mask and without mask at
different angles, different poses and different directions.
4
INDEX
Acknowledgement… ................................................................................. 6
Abstract… ................................................................................................. 7
Chapter 1 INTRODUCTION ................................................................. 10
Background .............................................................................................. 10
Motivation ................................................................................................ 10
Challenges ................................................................................................ 11
Objectives ..................................................................................................11
Organization Of Report ............................................................................ 12
Chapter 2 LITERATURE REVIEW ........................................................ 13
Face detection device, face pose detection device, methods for face mask
detection .................................................................................................. 13
Methods and system used for face mask detection… ................................... 13
Validation the correct wearing protection mask by taking picture: Design
of an application “Check your Mask” to limit the spread of COVID-19…
14
An Automated system to limit COVID-19 using Facial Mask Detection in
smart city… ................................................................................................15
Face mask detection using tensorflow and OpenCV ..................................... 15
Chapter 3 IMPLEMENTATION OF THE MODEL ............................... 16
Data Visualization ......................................................................................... 16
Data Augmentation ........................................................................................ 16
Splitting the Data… ......................................................................................... 16
Pre-Training CNN Model ............................................................................ 17
Trainig the CNN Model ................................................................................. 17
Importing the face detection Program .............................................................17
5
Detecting the face with and without Mask… .................................................. 17
Chapter 4 METHODOLOGY ................................................................. 18
System Design .............................................................................................. 19
Implementation ............................................................................................ 19
Use case Diagram..........................................................................................21
Sequence Diagram ........................................................................................ 22
Activity Diagram .......................................................................................... 23
Chapter 5 EXPERIMENTS AND RESULT ............................................. 25
Accuracy Of the mask detector system .......................................................... 25
Confusion matrix Of face mask detector ........................................................ 26
Chapter 6 CONCLUSION ........................................................................... 27
Chapter 7 REFERENCE ............................................................................... 28
6
1. INTRODUCTION
Background
we decided to take a problem statement which can be helpful to public, Government, Private
sectors. So for that we decided to create application/software which can detect whether person
is wearing face mask or not using machine learning. As we are using machine learning we
firstly need to learn concepts of machine learning so that we can create our
application/software. So we learnt machine learning. As we are using concept of machine
learning here we need to collect dataset to train our model. So for data set we need images
with mask and without mask at different angles, different poses and different directions.
As our project is about detecting face mask using machine learning so for that we need to
train a model so that it can detect face mask and for training our model we require huge
amount of data set. So for data set we started collecting images of faces with mask and without
mask at different angles, different poses and different directions. We decided to use python
as our language in which we will code for face mask detection so for that we need any good
IDE for python and along with that we need tensor flow/keras. As tensor flow is used handling
huge computations that are needed for deep learning purpose and keras is high-level API that
is built on top of tensor flow
Motivation
The new Coronavirus disease (COVID-19) has seriously affected the world. By the end of
November 2020, the global number of new coronavirus cases had already exceeded 60 million
and the number of deaths 1,410,378 according to information from the World Health
Organization (WHO). To limit the spread disease,mandatory of the face-mask rules are now
becoming common in public settings around the world. Additionally, many public service
providers require customers to wear face-masks in accordance with predefined rules (e.g.,
covering both mouth and nose) when using public services. These developments inspired
research into automatic (computer-vision-based) techniques for face-mask detection that can
help monitor public behavior and contribute towards constraining the COVID-19 pandemic.
Additionally, many public service providers require customers to wear face-masks in
7
accordance with predefined rules (e.g., covering both mouth and nose) when using public
services. These developments inspired research into automatic (computer-vision-based)
techniques for face-mask detection that can help monitor public behavior and contribute
towards constraining the COVID-19 pandemic. Although existing research in this area
resulted in efficient techniques for face-mask detection, these usually operate under the
assumption that modern face detectors provide perfect detection performance (even for
masked faces) and that the main goal of the techniques is to detect the presence of face-masks
only.Finally, we design a complete pipeline for recognizing whether face-masks are worn
correctly or not and compare the performance of the pipeline with standard face-mask
detection models.
Once the mask detector was ready we performed face mask detection using image as well as
using video which detects faces with mask and without mask.
Challenges
Collecting data set is not easy as using 1 or 2 image we cannot train our model to detect face
mask so for that we need large amount of dataset so that our software/application can run
properly and can detect face mask from any angle, any pose. It was difficult to collect large
amount of dataset. As we are using python as our base we need tensor flow/ keras for our
project and we found difficulty in installing tensor flow/keras in our pc. Along with that
loading data set was also bit difficult. It was not easy to code for face mask detection as we
need to load a large dataset and along with that we were using new tools so coding and
working with new tool was not easy for us. Size of the images. Faces are drastically smaller,
and much less clear. Varying angles. People are rarely looking straight to the camera .they
look in every other possible angle. Lack of clarity. Often, it’s very difficult or not possible at
all to tell if the person is wearing a mask or not from a single still frame.
Objective
The project mainly designed with the aim of face mask detection. We motive to perform
various methods on face mask detection. The system is not only expected to detect mask in
images, It also used for different criteria to give a transparent outcome. This will help us in
many criteria at different places.
Nowadays, wearing of mask is compulsory. So for that organizations need some worker at
the entrance of the organization to check whether any person entering premises is wearing
8
mask or not instead of worker organization can set up our project in their system which detects
whether the person is wearing mask or not.
Organization of Report
This report has been given in six chapters. Chapter one offers a short introduction to the
analysis space, motivation of the study , challenges to be moon-faced and objectives of the
study. Chapter a pair of offers the literature Review concerning the instruments and ways
accustomed apply on a dataset that gift the definition of detection and it shows the explanation
behind why and that techniques of machine learning didn't work for the model. Chapter three
has given the varied techniques. The procedure for preprocessing the dataset and therefore the
feature of the technique. Chapter four has coated the materials and methodology of the study
space. rationalization of model is additionally coated during this chapter. Chapter five is all
concerning results and impact of varied techniques on the model. Chapter vi presents
limitation and future work plans. Lastly , it's followed by references cited during this report.
9
2. LITERATURE REVIEW
Face detection device, face pose detection device, methods for face
mask detection
This invention concerns a face detection device, face pose detection device, and arts
related to these devices. In image processing fields where an image of a person is handled,
it is convenient to have a system that can automatically detect the position and the
approximate size of the face of the person in the image. Thus in recent years, attempts
have been started toward carrying out face detection from a subject image and examining
the face pose. A face detection device includes a face learning dictionary, which holds
learned information for identification between a facial image and a non-facial image. An
image input unit inputs a subject image. An edge image extraction unit extracts an edge
image from the subject image. A partial image extraction unit, based on the edge image,
extracts partial images that are candidates to contain facial images from the subject image.
Methods and system used for face mask detection
A method for deciding the presence of a face from image knowledge includes a face
detection formula having 2 separate recursive steps: a primary step of prescreening
image knowledge with a primary element of the formula to seek out one or additional
face candidate regions of the image supported a comparison between facial form models
and facial possibilities appointed to image pixels within the region; and a second step of
operational on the face candidate regions with a second element of the formula
employing a pattern matching technique to look at every face candidate region of the
image and thereby make sure a facial presence within the region, whereby the mix of
those elements provides higher performance in terms of detection levels than either
element one by one.
10
Validation the correct wearing protection mask by taking picture:
Design of an application “Check your Mask” to limit the spread of
COVID-19
In a context of a plague that's transmissive by sputtering, sporting masks seem necessary to
safeguard the user and to limit the propagation of the sickness. Currently, we tend to face the
2019–2020 coronavirus pandemic. Coronavirus sickness 2019 (COVID-19) is associate
communicable disease with initial symptoms almost like the contagious disease. The
symptom of COVID-19 was rumored initial in China and really quickly spreads to the
remainder of the planet. The COVID-19 contagiousness is thought to be high by comparison
with the contagious disease. during this paper, we tend to propose a style of a mobile
application for allowing everybody having a smartphone and having the ability to require an
image to verify that his/her protection mask is properly positioned on his/her face. The
designed methodology exploits feature which uses descriptors to find key options of the face
and a decision-making algorithmic program is applied. Experimental results show the
potential of this methodology within the validation of the proper mask sporting. To the most
effective of our information, our work is that the only 1 that presently proposes a mobile
application style “CheckYourMask” for corroboratory the proper sporting of protection mask.
11
An Automated System to Limit COVID-19 Using Facial Mask Detectionin
Smart City Network
The health care system goes through a crisis. several preventative measures are taken to cut
back the unfold of this sickness wherever carrying a mask is one in every of them. during this
paper, we tend to propose a system that prohibit the expansion of COVID-19 by looking for
people that aren't carrying any facial mask in an exceedingly good town network wherever all
the general public places ar monitored with television (CCTV) cameras. whereas someone
while not a mask is detected, the corresponding authority is up on through town network. A
deep learning design is trained on a dataset that consists of pictures of individuals with and
while not masks collected from numerous sources. The trained design achieved ninety
eight.7% accuracy on distinctive folks with and while not a facial mask for antecedently
unseen take a look at knowledge. it's hoped that our study would be a useful gizmo to cut back
the unfold of this disease for several countries within the world.
Face Mask Detection using TensorFlow and OpenCV
In this article, we've with success engineered a CNN model to sight if someone is sporting a
mask or not. this will be employed in varied applications. Sporting a mask is also necessary
within the close to future, considering the COVID-19 crisis and this methodology to sight if
the person wears a mask could are available in handy. to form this method we tend to
enforced python script to coach a mask detector on our dataset victimisation OpenCV,
Keras/TensorFlow, and deep learning. to form our mask dtector, we tend to trained a 2
category model of individuals sporting maks and other people not sporting masks. The
dataset was downloaded from Kaggle. This dataset consists of one,035 around pictures.
12
3. IMPLEMENTATION OF THE MODEL
Data Visulization
In the opening move, allow us to visualize the entire variety of pictures in our dataset in each
classes. we will able to} see that there are quite pictures within the dataset. Instead, disguised
faces were usually studied among a broader drawback domain associated with process and
classifying occluded facial pictures. As a result, few datasets with annotated disguised faces
were out there publically for analysis functions.The goal of face detection is to see if there
area unit any faces within the image or video. If multiple faces area unit gift, every face is
self-enclosed by a bounding box and therefore we all know the placement of the faces. Human
faces area unit tough to model as there area unit several variables which will amendment for
instance countenance, orientation, lighting conditions and partial occlusions like spectacles,
scarf, mask etc. The results of the detection provides the face location parameters and it can
be needed in numerous forms, for example, a parallelogram covering the central a part of the
face, eye centers or landmarks as well as eyes, nose and mouth corners, eyebrows, nostrils,
etc.
Data Augmentation
In the next step, we tend to augment our dataset to incorporate additional range of pictures for
our coaching. during this step of information augmentation, we tend to rotate and flip every of
the pictures in our dataset. we tend to see that, once knowledge augmentation, we've got a
complete of pictures with 690 pictures within the with mask category and 686 pictures within
the while not mask category.
Splitting the data
In this step, we split our data into the training dataset which will contain the images on which
the CNN model will be trained and the test set with the images on which our model will be
tested. After splitting, we see that the desired percentage of images have been distributed to
both the training set and the test set as mentioned above.
13
Pre-training CNN Model
pre-trained model is a model created by some one else to solve a similar problem. Instead of
building a model from scratch to solve a similar problem, you use the model trained on other
problem as a starting point. Image classification refers to assigning a class label to an image.
Object localization refers to sketching a bounding box around the object in an image. Object
detection is more difficult without using Neural network
Training the CNN Model
A great way to use deep learning to classify images is to build a convolutional neural network
(CNN). The Keras library in Python makes it pretty simple to build a CNN. This step is the
main step where we fit our images in the training set and the test set to our Sequential model
we built using Keras library.
Importing the face detection program
After this, we intend to use it to detect if we are wearing a face mask using our PC’s webcam.
For this, first, we need to implement face detection. In this, I am using the Haar Feature-based
Cascade Classifiers for detecting the features of the face.
Detecting the face with and without mask
In the last step, we use the OpenCV library to run an infinite loop to use our web camera in
which we detect the face using the Cascade Classifier.
14
Fig 3 Implementation models steps
15
4. METHODOLOGY
System Design
Systemdesign is the solution to the creation of new system. We have systemwhich detects
person is wearing mask or not which is very useful in many sectors. Thisphase is composed
of several systems. Thisphase focuses on the detailed implementation of the feasible system. It
emphasis on translating design specifications to performance specification. System design has
two phases of development logical and physical design.
Now a days requirement is changed. We need mask detector which can detect face mask
so that organizations can use it for checking that no one is entering without putting on
face mask.
implementation Model
We have implemented our model in two phases
1)Train face mask detector
2)Apply face mask detector
To train a machine learning model to detect whether a person is wearing a mask or not.
The face mask detector is trained, we can then move on to loading the mask detector,
performing face detection, and then classifying each face as with mask or without mask.
16
Fig 4.2 Implementation Model
17
Use Case Diagram
Use case diagrams are used to gather the requirements of a system including internal and
external influences. These requirements are mostly design requirements. Hence, when a
system is analyzed to gather its functionalities, use cases are prepared and actors are
identified.
This diagram in the there are three use cases: (1)add picture /video (2)Receive picture
/video (3)detect mask and one actor which is the user.
Fig 4.3 Use Case Diagram
18
Sequence Diagram
A sequence diagram shows object interactions arranged in time sequence. It depicts the
objects involved in the scenario and the sequence of messages exchanged between the
objects needed to carry out the functionality of the scenario. the sequence diagram has
five objects (user, system application, camera, image database and trained neural
network).
The first call is touch interface Then second call is start camera and next call is feature
extracted. and last call is detect with mask or without mask. The following diagram
mainly describes the method calls from one object to another, and this is also the actual
scenario when the system is running.
Fig 4.4 Sequence Diagram)
19
Activity Diagram
An activity diagram visually presents a series of actions or flow of control in a
system similar to a flowchart or a data flow diagram.
Activities modeled can be sequential and concurrent. In both cases an activity diagram will
have a beginning (an initial state) and an end (a final state).
Activity Diagram of Face Mask Detection using Machine Learning is start from initial
state or start point. after initial state the flow goes into action state and the first action is
Reading the face capture by Web-Camera. then the flow going into other action which
is Mask Detection, Here the Mask is detect by the mask detector from image or video.
after that it goes for image testing . then the flow comes into decision (A diamond
represents a decision with alternate paths.
When an activity requires a decision prior to moving on to the next activity, add a
diamond between the two activities.), here the decision is about user with or without
mask. after the decision we are at end point or final state of a activity diagram(An arrow
pointing to a filled circle nested inside another circle represents the final action state.
20
4.5 Activity diagram
21
5. EXPERIMENTS AND RESULTS
5.1 Experiment of Machine learning Algorithm
A machine learning algorithm is optimized by a loss function. Loss functions plays an
important role in any statistical model. It defines how well our model evaluating our
dataset. If our prediction are totally off, loss function will give output in higher number. If
our prediction is pretty good, it will give output in lower number.
An accuracy is preferred to compute the algorithm's performance analytically. The
accuracy rate for a model is usually examine after the parameters for the model and
calculates the percentage for the accuracy. Model prediction compares the true data for the
measure of accuracy.
We have tested the samples and the below graph shows the actual rate of loss/accuracy of
the train and validation set :
In our model we have taken total 1376 images in dataset ,In which 690 images are of with
mask and 686 images are of without mask.
Fig 5.1 Accuracy of the mask detection system.
22
Fig 5.2 Confusion matrix Of face mask detector
As we got good results weimplement it with camera to work in real time . Thereafter Using
Opencv we implemented this model with my webcam . using caffe model I predict faces in
image then after send it to our trained model to predict wheather person wearing mask or not
.
A confusion matrix is a table that is often used to describe the performance of a classification
model on a set of test data for which the true values are known. After Plotting Confusion
Matrix what I see Model only predicts 1 image wrong else all images are correctly predicted.
so model will work with realtime .
23
6. CONCLUSION
Our Project is about Face Mask Detection Using Machine Learning. The Face Mask
Detection using machine learning we are building here so we can potentially used it to
help our safety from COVID-19 pandemic.
To create this system we implemented python script to train a face mask detector on our
dataset using OpenCV, Keras/TensorFlow, and deep learning.
To create our face mask dtector, we trained a two class model of people wearing maks
and people not wearing masks. The dataset was downloaded from Kaggle. This dataset
consists of 1,035 around images.
We fine-tuned MobileNet on our mask/no mask dataset and obtained a classifier that is
~99% accurate. Then we took this face mask classifier and applied it to both images and
real-time video. Our face mask detector is accurate, and since we used the MobileNet,
it’s also computationally efficient.
24
7. REFERENCE
1. Developer Ashish, Corona Virus Mask Detection and Recognization using Deep Learning
Keras || Transfer Learning (12 Sep , 2020). Accesed : Oct 15 , 2020. [Online Video] Available
https://youtu.be/TNZAbVNTLhA
2. Adrian Rosebrock, (2020, May 4),COVID-19:Face Mask Detector with OpenCV
, Keras/TensorFlow and Deep Learning.
https://www.pyimagesearch.com/2020/05/04/covid-19-face-mask detector-with-opencvkeras- tensorflow-and-deep-learning/
3. S. Ge, J. Li, Q. Ye and Z. Luo, "Detecting Masked Faces in the Wild with LLECNNs," 2017 IEEE Conference on Computer Vision and Pattern Recognition
(CVPR), Honolulu, HI, 2017, pp. 426-434. doi: 10.1109/CVPR.2017.53 URL:
http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8099536&isnumber=80
99483
4. Face Mask detection ,Kaggle ,2020.[online]. Available:
https://www.kaggle.com/andrewmvd/face-mask-detection/metadata
5. Nataraj B, How to Install Tensorflow and Keras using Anaconda Navigator
(Nov19,2018). [online video] . Available:
https://www.youtube.com/watch?v=V9cDjjRXS08&feature=youtu.be
6. Krishna Ohja, How to install Opencv on Anaconda (April 19,2019). [Online
video]. Available:
https://www.youtube.com/watch?v=T2ykss_4Af0&feature=youtu.be
25
7. Toshinori, Method, system and program for searching area considered to be face
image (October 10,2003).
https://patents.google.com/patent/US20050141766A1/en
8. H. Lau et al., "Internationally lost COVID-19 cases", J. Microbiol. Immunol.
Infect., vol. 53, no. 3, pp. 454-458, 2020. An Automated system to limit COVID-19
using Facial Mask Detection in smart city
https://ieeexplore.ieee.org/document/9216386
9. Yuji Takata Face detection device, face pose detection device, partial image
extraction device, and methods for said devices, (October 19, 2002)
https://www.worldometers.info/coronavirus.
10. Adrian Rosebrock, (2020, May 4) Face Mask detector with Open cv, keras and
deep learning
https://www.pyimagesearch.com/2020/05/04/covid-19-face-mask-detector-withopencv-keras-tensorflow-and-deep-learning/
26
Download