You are on page 1of 8

REAL TIME FACE MASK DETECTION USING MACHINE LEARNING

 Madhu Madhavi  Akanksha Priya  Bhavprita

 Dr. Bhawna Sinha

Received : January 2021


Accepted : February 2021
Corresponding Author : Dr. Bhawna Sinha

1. ABSTRACT:

The ceaseless spread of Corona infection has


prompted supported expansion in the death pace The System is prepared to recognize precisely if an
of numerous nations across the globe from the day individual is wearing mask. At the point when the
it began. It is causing a global health crisis so we calculation recognizes an individual without mask,
need to protect ourselves [6]. One of the method, a caution ought to be produced to alarm
the World Health Organization has proposed is the individuals around or the concerned specialists
utilization of FACE MASKS to relieve the spread of close by, so essential moves can be made against
Virus. [5] such violators [6]. As a large portion of the
establishments, organizations, businesses,
shopping centres, medical clinics, need to begin
working with not many relaxations before this
Madhu Madhavi pandemic is totally deleted, coordinating face
MCA- IVth Semester , Session : 2019-2022, mask location framework with the current access
Patna Women’s College, Patna University, control framework at passage and leave focuses is
Patna- 800001, Bihar, India enthusiastically suggested.

We have developed a model using Deep Learning


Akanksha Priya and Machine Learning to detect Facemasks [1].
MCA-IVth Semester , Session : 2019-2022, The Face cover recognition dataset contains
Patna Women’s College, Patna University,
pictures of the two individuals with mask and
Patna-800001, Bihar, India
without masks and we are utilizing OpenCV for
Real-time face discovery by means of our webcam.
Bhavprita We are using this dataset along with various other
MCA-IVth Semester , Session : 2019-2022, technologies like Python, TensorFlow, Keras,
Patna Women’s College, Patna University, OpenCV to build this Face mask detector.
Patna-800001, Bihar, India
KEYWORDS: - OpenCV, Computer Vision, Deep
Learning, Keras, TensorFlow
Dr. Bhawna Sinha
Head, Department of MCA, 2. INTRODUCTION:
Patna Women’s College,
Before Coronavirus Pandemic, Individuals used to
Patna-800001,
Bihar, India wear covers to shield their wellbeing from air
contamination. While some people wear it since
they are reluctant about their looks [1], they whether a person is wearing a mask or not. The first
conceal their feelings from general society by step to recognize the presence of a mask on
the face is to detect the face, which makes the
concealing their countenances, etc. But nowadays,
strategy divided into two parts: to detect faces and
it’s not one’s choice to wear masks rather than it to detect masks on those faces. Face detection is
has become mandatory to ensure safety to one of the applications of object detection and can
people. be used in many areas like security, biometrics, law
enforcement and more. There are many detec-
Covid sickness (COVID-19) is an airborne tor systems developed around the world and being
implemented. However, all this science needs
irresistible infection brought about by a newfound
optimization; a better, more precise detector,
Covid-19 [6]. Individuals who are contaminated because the world cannot afford any more increase
with this infection will have gentle to genuine in
respiratory sickness and may not recuperate corona case
without requiring exceptional therapy. More To monitor that people are following this basic
safety principle, a strategy should be developed. A
seasoned individuals and individuals who as of face mask detector system can be implemented to
now have clinical issues like cardiovascular illness, check this. Face mask detection means to identify
diabetes, ongoing respiratory infection, and whether a person is wearing a mask or not. The first
malignancy are at higher risk. step to recognize the presence of a mask on
the face is to detect the face, which makes the
In excess of 5,000,000 cases were tainted by strategy divided into two parts: to detect faces and
to detect masks on those faces. Face detection is
COVID-19 in under a half year across 188 nations.
one of the applications of object detection and can
The infection spreads through close contact and in be used in many areas like security, biometrics, law
swarmed and packed zones. enforcement and more. There are many detec-
tor systems developed around the world and being
The World Health Organization (WHO) reports implemented. However, all this science needs
suggest that the two main routes of transmission optimization; a better, more precise detector,
of the COVID-19 virus are respiratory because the world cannot afford any more increase
in
droplets and physical contact. Respiratory corona case
droplets are generated when an infected person To monitor that people are following this basic
coughs or sneezes. Any person in close contact safety principle, a strategy should be developed. A
(within 1 meter) with someone who has face mask detector system can be implemented to
check this. Face mask detection means to identify
respiratory symptoms (coughing, sneezing) is at
whether a person is wearing a mask or not. The first
risk of being exposed to potentially infective step to recognize the presence of a mask on
respiratory droplets. Droplets may also land on the face is to detect the face, which makes the
surfaces where the virus could remain viable; thus, strategy divided into two parts: to detect faces and
the immediate environment of an infected to detect masks on those faces. Face detection is
one of the applications of object detection and can
individual can serve as a source of transmission
be used in many areas like security, biometrics, law
(contact transmission). Wearing a enforcement and more. There are many detec-
medical/NORMAL mask is one of the prevention tor systems developed around the world and being
measures that can limit the spread of certain implemented. However, all this science needs
respiratory viral diseases, including COVID-19. optimization; a better, more precise detector,
because the world cannot afford any more increase
in
So, people must wear the masks when they need
corona case
to step out of their homes and there is a need that To monitor that people are following this basic
authority strictly will ensure that people are safety principle, a strategy should be developed. A
wearing mask in public places as well as in face mask detector system can be implemented to
crowded places. check this. Face mask detection means to identify
whether a person is wearing a mask or not. The first
To monitor that people are following this basic step to recognize the presence of a mask on
safety principle, a strategy should be developed. A the face is to detect the face, which makes the
face mask detector system can be implemented to strategy divided into two parts: to detect faces and
check this. Face mask detection means to identify to detect masks on those faces. Face detection is
one of the applications of object detection and can
be used in many areas like security, biometrics, law optimization; a better, more precise detector,
enforcement and more. There are many detec- because the world cannot afford any more increase
tor systems developed around the world and being in
implemented. However, all this science needs corona cases.
optimization; a better, more precise detector, To monitor that people are following this basic
because the world cannot afford any more increase safety principle, a strategy should be developed. A
in face mask detector system can be implemented to
corona case check this. Face mask detection means to identify
To monitor that people are following this basic whether a person is wearing a mask or not. The first
safety principle, a strategy should be developed. A step to recognize the presence of a mask on
face mask detector system can be implemented to the face is to detect the face, which makes the
check this. Face mask detection means to identify strategy divided into two parts: to detect faces and
whether a person is wearing a mask or not. The first to detect masks on those faces. Face detection is
step to recognize the presence of a mask on one of the applications of object detection and can
the face is to detect the face, which makes the be used in many areas like security, biometrics, law
strategy divided into two parts: to detect faces and enforcement and more. There are many detec-
to detect masks on those faces. Face detection is tor systems developed around the world and being
one of the applications of object detection and can implemented. However, all this science needs
be used in many areas like security, biometrics, law optimization; a better, more precise detector,
enforcement and more. There are many detec- because the world cannot afford any more increase
tor systems developed around the world and being in
implemented. However, all this science needs corona cases.
optimization; a better, more precise detector, To ensure that people are following the basic
because the world cannot afford any more increase rules, a solution should be developed. This Face
in
corona case Mask Detection System can be utilized to
To monitor that people are following this basic guarantee this. Face Mask Detection intends to
safety principle, a strategy should be developed. A check if an individual is wearing mask.
face mask detector system can be implemented to
check this. Face mask detection means to identify The first step to perceive the presence of a cover
whether a person is wearing a mask or not. The first on the essence of an individual is to recognize the
step to recognize the presence of a mask on
face, which makes the procedure isolated into two
the face is to detect the face, which makes the
strategy divided into two parts: to detect faces and sections:-
to detect masks on those faces. Face detection is
one of the applications of object detection and can  To detect the faces
be used in many areas like security, biometrics, law  To detect masks on those faces.
enforcement and more. There are many detec-
tor systems developed around the world and being
implemented. However, all this science needs
optimization; a better, more precise detector, 3. OBJECTIVES:
because the world cannot afford any more increase
in The basic aim
corona cases. of the project is to detect the presence of a face
To monitor that people are following this basic mask on human faces on live
safety principle, a strategy should be developed. A streaming video as well as on images. We have
face mask detector system can be implemented to used deep learning to develop
check this. Face mask detection means to identify our face detector model.
whether a person is wearing a mask or not. The first The basic objective of the system is to detect the
step to recognize the presence of a mask on presence of a face mask on human faces on
the face is to detect the face, which makes the livestreaming video as well as on images. We
strategy divided into two parts: to detect faces and have used deep learning method to make our
to detect masks on those faces. Face detection is face detector model. The main aim is to identify
one of the applications of object detection and can the people in the image/Video Stream is wearing
be used in many areas like security, biometrics, law
face mask or not.
enforcement and more. There are many detec-
tor systems developed around the world and being
implemented. However, all this science needs If multiple faces are present, each face is
enclosed by a bounding box and thus we know
the location of face and that person is wearing building and the dataset itself. If our dataset and
mask or not. model are such that a lot of training is required,
then we use a larger chunk of the data just for
The basic aim training which is our case. If the model has a lot
of the project is to detect the presence of a face of hyperparameters that can be tuned, then we need
mask on human faces on live to take a higher amount of validation dataset.
streaming video as well as on images. We have Models with a smaller number of hyperparameters
used deep learning to develop are easy to tune and update, and so we can take
our face detector model. a smaller validation dataset.
The basic aim In our approach, we have dedicated 80% of the
of the project is to detect the presence of a face dataset as the training data and the remaining 20%
mask on human faces on live as the testing data, which makes the split ratio as
streaming video as well as on images. We have 0.8:0.2 of train to test set. Out of the training data,
used deep learning to develop we have used 20% as a validation data set. Overall,
our face detector model. 64% of the dataset is used for training, 16% for
Experimental results show that our model performs validation and 20% for testin
well on the test We need to split our dataset into three parts:
data with 100% and 99% precision and recall, training dataset, test dataset and validation dataset.
respectively The purpose of splitting data is to avoid overfitting
Test results show that our model performs well on which is paying attention to minor details/noise
the test information with 100% and 99% exactness which is not necessary and only optimizes the
training dataset accuracy. We need a model that
and review, separately. performs well on a dataset that it has never seen
(test data), which is called generalization. The
4. METHODOLOGY: - training set is the actual subset of the dataset that
we use to train the model. The model observes
4.1 DATASET: and learns from this data and then optimizes its
parameters. The validation dataset is used to select
The dataset that we have used for our proposed hyperparameters (learning rate, regularization
system consist a total of 3136 images, out of which parameters). When the model is performing well
1582 images are of people with masks and 1654 enough on our validation dataset, we can stop
learning using a training dataset. The test set is the
are of people without masks. The images that we
remaining subset of data used to provide an
have taken are of different sizes and resolutions, unbiased evaluation of a final model fit on the
and were extracted from different sources (like training
Kaggle Dataset) or from machines (cameras) of dataset. Data is split as per a split ratio which is
different resolutions. highly dependent on the type of model we are
building and the dataset itself. If our dataset and
We need to split our dataset into three parts: model are such that a lot of training is required,
training dataset, test dataset and validation dataset. then we use a larger chunk of the data just for
The purpose of splitting data is to avoid overfitting training which is our case. If the model has a lot
which is paying attention to minor details/noise of hyperparameters that can be tuned, then we need
which is not necessary and only optimizes the to take a higher amount of validation dataset.
training dataset accuracy. We need a model that Models with a smaller number of hyperparameters
performs well on a dataset that it has never seen are easy to tune and update, and so we can take
(test data), which is called generalization. The a smaller validation dataset.
training set is the actual subset of the dataset that In our approach, we have dedicated 80% of the
we use to train the model. The model observes dataset as the training data and the remaining 20%
and learns from this data and then optimizes its as the testing data, which makes the split ratio as
parameters. The validation dataset is used to select 0.8:0.2 of train to test set. Out of the training data,
hyperparameters (learning rate, regularization we have used 20% as a validation data set. Overall,
parameters). When the model is performing well 64% of the dataset is used for training, 16% for
enough on our validation dataset, we can stop validation and 20% for testin
learning using a training dataset. The test set is the We need to split our dataset into three parts:
remaining subset of data used to provide an training dataset, test dataset and validation dataset.
unbiased evaluation of a final model fit on the The purpose of splitting data is to avoid overfitting
training which is paying attention to minor details/noise
dataset. Data is split as per a split ratio which is which is not necessary and only optimizes the
highly dependent on the type of model we are training dataset accuracy. We need a model that
performs well on a dataset that it has never seen enough on our validation dataset, we can stop
(test data), which is called generalization. The learning using a training dataset. The test set is the
training set is the actual subset of the dataset that remaining subset of data used to provide an
we use to train the model. The model observes unbiased evaluation of a final model fit on the
and learns from this data and then optimizes its training
parameters. The validation dataset is used to select dataset. Data is split as per a split ratio which is
hyperparameters (learning rate, regularization highly dependent on the type of model we are
parameters). When the model is performing well building and the dataset itself. If our dataset and
enough on our validation dataset, we can stop model are such that a lot of training is required,
learning using a training dataset. The test set is the then we use a larger chunk of the data just for
remaining subset of data used to provide an training which is our case. If the model has a lot
unbiased evaluation of a final model fit on the of hyperparameters that can be tuned, then we need
training to take a higher amount of validation dataset.
dataset. Data is split as per a split ratio which is Models with a smaller number of hyperparameters
highly dependent on the type of model we are are easy to tune and update, and so we can take
building and the dataset itself. If our dataset and a smaller validation dataset.
model are such that a lot of training is required, In our approach, we have dedicated 80% of the
then we use a larger chunk of the data just for dataset as the training data and the remaining 20%
training which is our case. If the model has a lot as the testing data, which makes the split ratio as
of hyperparameters that can be tuned, then we need 0.8:0.2 of train to test set. Out of the training data,
to take a higher amount of validation dataset. we have used 20% as a validation data set. Overall,
Models with a smaller number of hyperparameters 64% of the dataset is used for training, 16% for
are easy to tune and update, and so we can take validation and 20% for testin
a smaller validation dataset. We need to part our dataset into three sections
In our approach, we have dedicated 80% of the [4]:
dataset as the training data and the remaining 20%
as the testing data, which makes the split ratio as  Training dataset
0.8:0.2 of train to test set. Out of the training data,  Test dataset
we have used 20% as a validation data set. Overall,  Validation dataset
64% of the dataset is used for training, 16% for
validation and 20% for testin
We need to split our dataset into three parts: 4.2 SIMPLE ARCHITECTURE:
training dataset, test dataset and validation dataset.
The purpose of splitting data is to avoid overfitting Our proposed framework targets arranging if a
which is paying attention to minor details/noise
which is not necessary and only optimizes the specific individual is wearing a mask or not. This
training dataset accuracy. We need a model that should be possible by taking the contribution from:
performs well on a dataset that it has never seen
(test data), which is called generalization. The
training set is the actual subset of the dataset that
we use to train the model. The model observes •Images
and learns from this data and then optimizes its
parameters. The validation dataset is used to select •Real time real time Videos
hyperparameters (learning rate, regularization
parameters). When the model is performing well The proposed framework considers dataset of
absolute 3136 pictures.
Picture With Mask Picture Without Mask
The characterizations of the pictures are Stage 2:
finished via preparing the model in 2 stages [6]:
- Load the face veil classifier model.
Stage 1:
- Detect faces in the pictures/video transfer.
- Facemask dataset is stacked into the
framework. - Apply the classifier to each face RoI.

- Classifiers like MobileNetV2 is utilized to - Classify the pictures to be "With Mask" and
produce a prepared model. "Without Mask" with Confidence.

Load Face Mask Train facemask with Generate trained


Dataset Deep learning Model

Load facemask classifier model Detect faces in Images Apply Facemask classifier to each face

Classify as “with mask” and “without mask”

Show the Results

Show Red Colour Box with people with “No masks”


Show Green Colour Box with peop
5. EXPERIMENTAL RESULTS: - undertaking catalog and the calculation is
prepared based on the named pictures.
The Face Mask Detection framework is a profound
learning arrangement that utilizes OpenCV and In pre-handling steps, the picture is resized to
TensorFlow, to prepare the model [5]. We join the
256×256 pixels, changed over to NumPy exhibit
profound learning MobileNetV2 modular with the
SSD structure for a quick and proficient profound design and the relating names are added to the
learning answer for constant human location in
pictures in the dataset prior to utilizing our SSD
video transfers and are recognized by camera
progressively out in the open places and contains model as contribution to construct our custom
altered information assortment to determine a
model with MobileNetV2 as the spine and train
face veil discovery model with difference in the
kinds of face covers worn by people in general our model utilizing the Tensor Flow Object
continuously by methods for an exchange of
Detection API.
figuring out how to a pre-prepared SSD face
locator [5].

In the proposed system, four stages were


followed, for example [5]:
1) Data collection and pre-processing
2) Model development and training
3) Model testing
4) Model implementation
Our proposed system utilizes the AI approach and
will adjust the MobileNetV2 model, which is a
profoundly proficient design that can be applied to
edge gadgets with restricted processing power, for
example, raspberry pi4 to identify individuals
continuously. We utilized 80% of our absolute Model Training Accuracy / Loss Curve

custom informational collection to prepare our 6. Conclusion: -


model with a solitary shot locator, which makes
just a single effort to recognize various articles that In this undertaking, we have built up a profound
learning model for face veil identification utilizing
are available in a picture utilizing multibox. The
Python, Keras, and OpenCV. We built up the face
custom informational collection is stacked into the veil indicator model for recognizing if individual is
wearing a cover [1]. We have prepared the model
utilizing Keras with network engineering. Preparing
the model is the initial segment of this task and 3. Inamdar, M., & Mehendale, N. (2020).
testing utilizing webcam utilizing OpenCV is the Real-Time Face Mask Identification Using
subsequent part. This was a decent undertaking Facemasknet Deep Learning
for fledglings like us to execute our learnings and
Network. Available at SSRN 3663305.
gain mastery.
weblink:
https://www.researchgate.net/publicatio
n/344173985_Face_Mask_Detector
Hence, this proposed framework will work in an (visited on 23rd December, 2020)
effective way in the current circumstance when 4. Tengjiao Wang, Fang Yang, and Jian Song,
the lockout is facilitated and assists with following "Deep learning-based detection scheme
public places effectively in a mechanized way. We for visible light communication with
have tended to top to bottom the following of
generalized spatial modulation," Opt.
social removing and the recognizable proof of face
veils that help to guarantee human wellbeing. The Express 28, 28906-28915 (2020)
usage of this arrangement was effectively tried 5. Edgell J., Andrew T., “Limitations of Facial
progressively by sending model [3]. The Recognition Technology”, FedTech,
arrangement can possibly altogether lessen November 2020
infringement by constant intercessions, so the weblink:
proposed framework would improve public https://fedtechmagazine.com/article/201
wellbeing through saving time and assisting with
3/11/4-limitations-facial-recognition-
diminishing the spread of Covid-19. This
arrangement can be utilized in places like technology#:~:text=security%20best
sanctuaries, shopping complex, metro stations, air %20practices.-,1 (visited on 18th
terminals, and so forth. November, 2020)
6. IBM Cloud Education, “Machine
Learning”, 15 July, 2020.
7. REFERENCES: - Weblink:
https://www.ibm.com/cloud/learn/machi
1. Militante, S. V., & Dionisio, N. V. (2020, ne-learning (visted on 29th September,
October). Deep Learning Implementation 2020)
of Facemask and Physical Distancing
Detection with Alarm Systems. In 2020
Third International Conference on Weblinks:
Vocational Education and Electrical
Engineering (ICVEE) (pp. 1-5). IEEE. 1. https://www.guru99.com/keras-
2. Rosebrok, A. (2020). COVID-19: Face Mask tutorial.html
Detector with OpenCV, Keras/ TensorFlow 2. https://www.tutorialspoint.com/
and Deep Learning. pycharm/pycharm_introduction.htm
3. https://developer.ibm.com/
Weblink: technologies/artificial-intelligence/
https://www.pyimagesearch.com/ articles/cc-get-started-tensorflow/
2020/05/04/covid-19-face-mask-detector- 4. https://www.ibm.com/topics/computer-
with-opencv-keras-tensorflow-and-deep- vision
learning/ (visited on 21st December, 2020)

You might also like