0% found this document useful (0 votes)
77 views

Face Mask Detection Using Python

With the rise of pandemic the face mask became one of the most essential part of human life. This project aims to ease the maintenance of the rules and regulations by the authorities. This system will do the task of detecting the percentage mask worn on a person’s face. This way it will detect if a person has worn the mask or if he/she has worn it properly such that it would prevent the infections.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Face Mask Detection Using Python

With the rise of pandemic the face mask became one of the most essential part of human life. This project aims to ease the maintenance of the rules and regulations by the authorities. This system will do the task of detecting the percentage mask worn on a person’s face. This way it will detect if a person has worn the mask or if he/she has worn it properly such that it would prevent the infections.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

10 I January 2022

https://doi.org/10.22214/ijraset.2022.39926
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue I Jan 2022- Available at www.ijraset.com

Face Mask Detection using Python


Amol Kawade1, Nikita Khawase2
1, 2
Department of Mechanical Engineering, Vishwakarma Institute of Technology, Pune

Abstract: With the rise of pandemic the face mask became one of the most essential part of human life. This project aims to ease
the maintenance of the rules and regulations by the authorities. This system will do the task of detecting the percentage mask
worn on a person’s face. This way it will detect if a person has worn the mask or if he/she has worn it properly such that it would
prevent the infections. If the mask is not worn then the person would be highlighted and post the detection, we can raise an alert
if used in public places
Keywords: Face mask, Python, MobileNetV2, Detection, highlighted.

I. INTRODUCTION
Nowadays the whole world is wearing masks due to COVID-19 corona virus epidemic. Scientists have proved that wearing a mask
helps to stop COVID-19 transmissions. Due to its fast spreading across the world WHO has declared COVID-19 as a global
pandemic. Wearing the face masks are one of the important preventive measures given by them it is useful as it not only stops the
people from getting infected but it also help the infected people to not infect others. But we should wear the face mask correctly, it
should be covering our mouth, nose entirely. In order to check if the person is wearing mask correctly or not we can use machine
learning technique.
Face Mask Detector is the solution to check whether people are wearing masks correctly or not, in percentage. We have used
Dataset, Keras, Machine Learning, MobileNetV2, OpenCV, Python, Tensorflow. Face mask detection will help the government and
private bodies. It will help to stop carelessness of people and can even be used to punish them. It can also be used to get the data of
number of people following the norms in different cities. It will detect as mask and no mask and it will also start an alarm, beeping
as soon as it detects person without a mask.

II. LITERATURE REVIEW


In the background of the COVID-19 pandemic, institutions Behind the scenes of the COVID-19 pandemic, organizations, for
example, the institute experience the ill effects of for all intents and purposes shut around the world assuming the current
circumstance won't change. Coronavirus otherwise called Serious Acute Respiratory Syndrome Corona infection 2 is an irresistible
illness that is set free from a contaminated debilitated individual who talks, wheezes, or hacks by respiratory beads. This spreads
rapidly through close contact with anybody tainted, or by contacting articles or surfaces impacted with an infection. There's still as
of now no immunization accessible to ensure against COVID-19 and forestalling openness to the infection is by all accounts the
main technique to defend ourselves. Wearing a facemask that covers the nose and mouth in a public setting and regularly washing
hands or the utilization of at minimum 70% liquor based sanitizers is one method for trying not to be presented to the infection. In
the midst of the headway of innovation, Deep Learning has demonstrated its viability in acknowledgment and characterization
through picture handling. The examination concentrate on involves profound learning procedures in distinctive facial
acknowledgment and perceive in the event that the individual is wearing a facemask or not. The dataset gathered contains 25,000
pictures utilizing 224x224 pixel goal and accomplished an exactness pace of 96% concerning the exhibition of the prepared model.
The framework fosters a Raspberry Pi-based constant facemask acknowledgment that cautions and catches the facial picture
assuming the individual recognized isn't wearing a facemask. This review is gainful in battling the spread of the infection and
keeping away from contact with the infection[1]
In the new occasions, the Coronaviruses that are a major group of various infections have become exceptionally normal, infectious
and perilous to the entire mankind. It spreads human to human by breathing out the contamination breath, which leaves drops of the
infection on various surface which is then breathed in by other individual and gets the disease as well. So it has become vital to
ensure ourselves and individuals around us from the present circumstance. We can avoid potential risk, for example, social
separating, washing hands like clockwork, utilizing sanitizer, keeping social separation and the main wearing a cover. Public
utilization of wearing a veil has become extremely normal wherever in the entire world at this point. From that the most impacted

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 817
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue I Jan 2022- Available at www.ijraset.com

and destroying condition is of India because of its outrageous populace in little region. This paper proposes a strategy to identify the
facial covering is put on or not so much for workplaces, or some other work place with a many individuals coming to work. We
have utilized convolutional neural organization for the equivalent. The model is prepared on a genuine world dataset and tried with
live video real time with a decent exactness. Further the precision of the model with various hyper boundaries and numerous
individuals at various distance and area of the edge is finished.[2]
This task plans to recognize facial coverings and social removing on a video feed utilizing Machine Learning and Object Detection.
TensorFlow and Keras were utilized to fabricate a CNN model to distinguish facial coverings and it was prepared on a dataset of
3800 pictures. Just go for it Object location was utilized to recognize individuals in a casing and check for social removing by
ascertaining the Euclidean distance between the centroids of the identified boxes. Fostered an Android application named
"StaySafe" where the client will be advised and can screen the infringement.
For this reason, Firebase was utilized as the backend administration. Assuming that an infringement is identified it will transfer the
picture
to a Firebase Cloud Storage with a notice, and the client will actually want to see these pictures on their Android
application alongside the date and time. Firebase Cloud Messaging administration was utilized to send notices which will
be taken care of in the android application. The application offers different elements like review history, saving the picture to the
gadget, erasing the pictures from the cloud and so on A hotness guide can likewise be seen which features swarmed
districts which can assist authorities with distinguishing the locales that should be cleaned all the more frequently. At present, even
with the wellbeing emergency brought about by the Coronavirus COVID-19 which has spread all through the around the world. The
battle against this pandemic has turned into an unavoidable reality for some nations. It is presently a matter including numerous
spaces of examination in the utilization of new data advancements, especially those connected with man-made reasoning. In this
paper, we present a clever commitment to help in the battle against this pandemic. It concerns the identification of individuals
wearing covers since they can't work or move around as common without security against COVID-19. In any case, there are a
couple of exploration learns about facial covering recognition. In this work, we researched utilizing diverse profound Convolutional
Neural Networks (CNN) to separate profound elements from pictures of appearances.
The separated elements are additionally handled utilizing different AI classifiers like Support Vector Machine (SVM) and K-
Nearest Neighbors (K-NN). Were utilized and inspected all various measurements like exactness and accuracy, to look at every
model exhibition. The best characterization rate was getting is 97.1%, which was accomplished by joining SVM and the
MobileNetV2 model. Regardless of the little dataset utilized (1376 pictures), we have gotten exceptionally agreeable outcomes for
the discovery of covers on the faces.[3]
Coronavirus or Severe Acute Respiratory Syndrome Corona infection 2 is an amazingly contagious infection that is released through
breathing beads let out of a contaminated person who is talking, wheezing, or hacking. Close collaboration with an individual
tainted or through contacting a debased surface and item can spread the infection quickly.At this point, there is no antibody to battle
the COVID-19, and the most ideal way to shield the individual from an infection is to try not to be presented to it. Wearing a
facemask that covers the nose and mouth in a public setting and more than once purifying of hands or the utilization of at minimum
70% liquor based sanitizers is a training to keep away from infection openness. Profound Learning innovation has shown its
accomplishment in acknowledgment and arrangement by handling pictures. The exploration concentrate on utilizes profound
learning methods that distinguish assuming the individual is wearing a facemask or not and check in the event that the people in the
space notice physical separating. The gathered picture information contains 20,000 pictures, consistently crop pictures in 224x224
pixels, and accomplished an exactness pace of 97% during the preparation of the model. The created framework is executed
utilizing Python and OpenCV through TensorFlow that perceives people wearing a facemask or not wearing and measures the actual
distance between every individual. It flags a caution and catches facial pictures after recognizing people not wearing a cover and
doesn't notice physical removing. This review is useful in fighting the spread of the infection and keeping away from contact with
the infection.[4]
This composition portrays the advancement of a framework for perceiving individuals, in any event, when they are utilizing a facial
covering, from photos. An order model dependent on the MobileNetV2 design and the OpenCV’s face indicator is utilized.
Consequently, utilizing these stages, it very well may be distinguished where the face is and it tends not really settled whether or not
it is wearing a facial covering. The Face Net model is utilized as a component extractor and a feedforward multi-facet perceptron to
perform facial acknowledgment. For preparing the facial acknowledgment models, a bunch of perceptions comprised of 13,359
pictures is created; 52.9% pictures with a facial covering and 47.1% pictures without a facial covering. The exploratory outcomes
show that there is an exactness of 99.65% in deciding if an individual is wearing a veil or not.[5]

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 818
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue I Jan 2022- Available at www.ijraset.com

III. METHODOLOGY/EXPERIMENTAL
1) Step 1 Installing all required Libraries
Installing the required libraries like OpenCV, Keras, Sklearn and others.

2) Step 2 Installing Dataset


This model will differentiate between people wearing and not wearing masks so We installed our dataset. The next step is labelling
the data. The data which has been collected labelled into two groups; with and without a mask. After the data has been labelled, it is
grouped into those two groups.
Step 1 – IMPORT ALL
THE LIBRARIES

Step 2 - Dataset
installing.

Step 3– Data Pre-


processing.

Step 4-Testing the


Model.

Step 5 – Applying
Model in camera.

Step 6 – Running and


checking the output.

Fig 3. Flowchart

3) Step 3 Data Pre-processing


Data pre-processing is divided in four steps which are resizing image as we know more the smaller size of image better will be the
model so we will resize images to 224 x 224 pixels, converting image into array, pre-processing input using MobileNetV2 and last
is performing hot encoding on labels.
The next will be splitting the data.

Final Step: Implementing the model:


Step 4: Testing the model
Step 5: Applying camera in the model
Step 6: Running and checking the output

The model implemented in the video. The video needs to read from frame to frame, for the face detection algorithm to work. If a
face is been detected, then it proceeds to the next step. From the frames that detected the containing faces, reprocessing will be
carried out which would be including resizing the image size, converting to the array, pre-processing input using MobileNetV2. The
next step is to predict the input data from the model which is saved. Predicting the input image which has been processed using a
model built earlier. The video frame will also be labelled according to whether that the person is wearing a mask or not and also
predictive percentage. It will also start beeping if person is not wearing mask.

IV. RESULTS AND DISCUSSIONS


A. A system that can detect the face mask on a person’s face.
B. The system detects the percentage as per the mask covering the face of a person and can help to identify safety level based on
this percentage.
C. It can be used in crowded places to reduce the amount of people wearing masks by interfacing the system in a CCTV camera.
D. This System will help to maintain the norms of Social Distancing and Wearing Face mask at places where there is a public
gathering.
E. It will help to create access points at public places where entry would be permitted only when the person wears a face mask.

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 819
International Journal for Research in Applied Science & Engineering Technology (IJRASET)
ISSN: 2321-9653; IC Value: 45.98; SJ Impact Factor: 7.538
Volume 10 Issue I Jan 2022- Available at www.ijraset.com

V. FUTURE SCOPE
1) To Deploy this system at locations of Mass populations remotely so as to maintain the observations of rules and regulations in a
strict manner.
2) To integrate the system with a GSM module so that it can raise an alert to the authorities if mass violation happens.

VI. CONCLUSION
In this project, a machine learning model is created for face mask detection using Python, Keras, and OpenCV. We developed the
face mask detector model for detecting whether if the person is wearing a mask or not. We trained the model using Keras with
network architecture. Training the model was the first half of our project and testing it using the webcam using OpenCV the second
half. This system can therefore be used in real-time applications and places where required face mask detection for safety purposes
due to outbreak of covid-19.

REFERENCES
[1] Sammy V. Militante College of Engineering & Architecture University of Antique Sibalom, Antique, Philippines.
Real-Time Facemask Recognition with Alarm System using Deep Learning
2020 11th IEEE Control and System Graduate Research Colloquium (ICSGRC 2020), 8 August 2020, Shah Alam, Malaysia
[2] Riya Chiragkumar Shah Department of Computer Science and Engineering Nirma University S G highway, Ahmedabad – 382481,
Rutva Jignesh Shah Department of Computer Science and Engineering Nirma University S G highway, Ahmedabad – 38
Detection of Face Mask using Convolutional Neural Network.
[3] Gokul Sudheesh Kumar and Sujala D. Shetty Department of Computer Science, Birla Institute of Technology & Science, Pilani, Dubai Campus, Academic
City, Dubai, U.A.E.
Application Development for Mask Detection and Social Distancing Violation Detection using Convolutional Neural Networks
[4] Abdellah Oumina, Noureddine El Makhfi , PMIC Laboratory, Faculty of Science and Technology Al-Hoceima, Abdelmalek Essaadi University, Tetouan,
MoroccoMustapha Hamdi
Control The COVID-19 Pandemic: Face Mask Detection Using Transfer Learning
[5] Sammy V. , Nanette V. Dionisio College of Arts and Sciences University of Antique Sibalom, Antique, Philippines
Deep Learning Implementation of Facemask and Physical Distancing Detection with Alarm Systems
2020 the third International Conference on Vocational Education and Electrical Engineering (ICVEE)
Jonathan S. Talahua Jorge Buele P.Calvopiña and José Varela-Aldás, Facial Recognition System for People with and without Face Mask in Times of the
COVID-19 Pandemic, Published: 18 June 2021 MDPI, Basel, Switzerland.

©IJRASET: All Rights are Reserved | SJ Impact Factor 7.538 | ISRA Journal Impact Factor 7.894 | 820

You might also like