0% found this document useful (0 votes)
240 views40 pages

B.Tech, Computer Science & Engineering: Project Report Face Mask Detection Using Opencv Python

This document is a project report on developing a face mask detection system using OpenCV and Python. The system aims to detect whether a person is wearing a face mask or not in order to help reduce the spread of COVID-19. It presents a method that uses TensorFlow and OpenCV to identify face masks in images. The system draws a bounding box on detected faces to classify if the person is wearing a mask or not. If a person without a mask is identified in the database, an email can be sent to notify them. The project was submitted in partial fulfillment of a B.Tech degree in computer science at Galgotias University, India under the supervision of Dr. Nitin Mishra.

Uploaded by

Aditya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
240 views40 pages

B.Tech, Computer Science & Engineering: Project Report Face Mask Detection Using Opencv Python

This document is a project report on developing a face mask detection system using OpenCV and Python. The system aims to detect whether a person is wearing a face mask or not in order to help reduce the spread of COVID-19. It presents a method that uses TensorFlow and OpenCV to identify face masks in images. The system draws a bounding box on detected faces to classify if the person is wearing a mask or not. If a person without a mask is identified in the database, an email can be sent to notify them. The project was submitted in partial fulfillment of a B.Tech degree in computer science at Galgotias University, India under the supervision of Dr. Nitin Mishra.

Uploaded by

Aditya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Project Report

On
Face Mask Detection using opencv python
Submitted in partial fulfillment of the
requirement for the award of the degree of

B.Tech ,Computer Science & Engineering

Under Supervision

Dr. Nitin Mishra Sir,


Professor

Submitted By:
Subodh Kumar
ADM NO -18SCSE1010125
ENR NO:18021011373
Shristi Kiran
ADM NO-18SCSE1010580
ENR NO:18021011806

SCHOOL OF COMPUTING SCIENCE AND ENGINEERING,


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING,
GALGOTIAS UNIVERSITY, GREATER NOIDA, INDIA

December, 2021

1
SCHOOL OF COMPUTING SCIENCE AND
ENGINEERING
GALGOTIAS UNIVERSITY, GREATER NOIDA
CANDIDATE’S DECLARATION

We hereby certify that the work which is being presented in the project, entitled “Face
Mask Detection Using Opencv Python”in partial fulfillment of the requirements for
the award of the submitted in the School of Computing Science and Engineering of
Galgotias University, Greater Noida, is an original work carried out during the period of
july 2021 to dec 2021 , under the supervision of , Dr Nitin Mishra Department of
Computer Science and Engineering/Computer Application and Information and Science,
of School of Computing Science and Engineering , Galgotias University, Greater
Noida .

Subodh kumar (18scse1010125)


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

2
CERTIFICATE
The Final Project Viva-Voce examination of SUBODH KUMAR has been held on
_________________ and his/her work is recommended for the award Of computer
science and engineering.

Signature of Examiner(s) Signature of Supervisor(s)

MR NITIN MISHRA
Signature of Project Coordinator Signature of Dean

Date: November, 2013


Place: Greater Noida

3
TABLE OF CONTENT:

Title Page No:

ACKNOWLEDGEMENT I

STUDENT’S DECLARATION II

ABSTRACT VI

LIST OF FIGURE V

Chapter 1: Introduction 7
1.1: Introduction 8
1.2: Formulation of Problem 9
1.2.1: Tool and Technology Used 11

Chapter 2: Literature Survey 12


Chapter 3: Implementation 17

3.1: Module Description 24

Chapter 4: Experiment and results 30

Chapter 5: Conclusion and Future Scope 35

5.1: Conclusion 35

5.2: Future Scope 35

Reference 36-40

4
List of Figures

S.No. Title Page No.


1 Death Pie Chart 9
1.2 Two Phase Covid-19 Detector 10
3.1 Algorithm for Face Mask 18
3.2 Framework for Face Mask 23
3.3 Advantage of Face Mask 24
3.4 Loss and accuracy on Covid-19 Datasheet 27
3.5 Flow Chart of the project 28
3.6 Face with or without Mask 29
4.6 Multiple face in a Single Frame 34

5
Abstract
This report proposes a Face Mask Detection Using OpenCV. This pandemic is
causing a worldwide emergency in healthcare. This virus particularly spreads via
droplets which emerge from someone infected with coronavirus and poses a risk to
others.The risk of transmission is highest in public places. one of the satisfactory
ways to live safe from getting inflamed is carrying a face mask in open territories as
indicated with the aid of the arena fitness business enterprise (WHO) on this task, we
endorse a method which employs TensorFlow and OpenCV to hit upon face mask on
people.A bounding container drawn over the face of the person describes weather the
man or woman is carrying a mask or no longer.If a person’s face is saved within the
database, it detects the name of the person that isn't carrying face masks and an e-
mail might be sent to that individual caution them that they are not sporting a masks
as a way to take precautions .if name not saved in database then we directly imposes
live web camera for detecting the person’s whether he/she mask wearing or not. If a
person’s face is saved within the database, it detects the name of the person that isn't
carrying face masks and an e-mail might be sentto that individual caution them that
they are not sporting a masks as a way to take precautions. Many businesses and
organization need to adapt and protect an infected person by detecting whoever does
not wear masked face.

Keywords – Tensorflow, Opencv ,Covid 19, image processing ,mask, no mask,


pandemic, safety, computer vision.

6
Chapter1: Introduction

The pandemic had a huge effect on human lives. The Covid-19 result in the lack of
10millions and damaged the lives of billions of humans. The virus spreads through
close contact of humans and in crowded/overcrowded places. Among them cleaning
hands, maintaining a safe distance, wearing a mask, refraining from touching eyes,
nose, and mouth are the main, where wearing a mask is the simplest one.
Unfortunately, people are not following these rules properly which is resulting in
speeding the spread of this virus. The solution can be to detect the people not
wearing mask and informing their authorities.Its negative result turned into felt by
nearly all business establishments for example like education system, religion,
tourism, employment, entertainment, and different industries face the losses due to
this pandemic. According to World Health Organization, 56.5 million people get
infected with virus and 1.44 million people loss their life in 2020 because of the virus
came in 2019.From the very basic hygiene requirements to the treatments in the
hospitals, people are doing all they could for his or her personal and the society’s
protection; face masks are one of the private shielding gadget. Humans put on face
masks once they step out in their houses and authorities strictly ensure that people are
carrying face mask even as they may be in companies and public places After the one
person get infected, it almost takes fourteen days to the virus to grow in the human
and affect them and within the interval, it flare to almost every body who's come in
contact with that affected person. So, itis very hard to stop the spread of coronavirus
among peoples. Coronavirus flare through droplets produced from coughing and
sneezing through an affected person. This transmit the virus to any person who come
indirect contact with the person affected by corona virus because of this, the virus
spreads easily among the persons. If the national lockdowns being raised, it turn out
to be very difficult to record and control the virus. Face mask detection is an
7
effective method used to stop the virus among peoples.To display that people are
following this primary safety principle, a strategy need to be advanced. The spread of
COVID-19 virus has reduced but it is still not over. If everyone follows all the safety
measures, then it can come to an end. This will help in lowering the cases to such a
level that COVID19 virus can vanish from everywhere. The first step to apprehend
the presence of a masks on the face is to detect the face, which makes the method
divided into two components: to locate faces and to detect masks on the ones faces.
There are no efficient face mask detection Applications to come across to check
weather person wearing mask or not. This will increase the demand for an green
machine for detecting face masks on humans during transportation, indensely
populated regions, in residencial and other businesses to keep the safety This venture
makes use of device learning type using openCv and Tensorflow to hit upon
facemasks on people.

1.1 Introduction
The present scenario of COVID-19 demands an efficient face mask detection
application. The main goal of the project is to implement this system at
entrances of colleges, airports, hospitals, and offices where chances of spread
of COVID-19 through contagion are relatively higher. Reports indicate that
wearing face masks while at work clearly reduces the risk of transmission. It
is an object detection and classification problem with two different classes
(Mask and Without Mask). A hybrid model using deep and classical machine
learning for detecting face mask will be presented. A dataset is used to build
this face mask detector using Python, OpenCV, and TensorFlow and Keras.
While entering the place everyone should scan their face and then enter
ensuring they have a mask with them. If anyone is found to be without a face
mask, beep alert will be generated. As all the workplaces are opening. The

8
number of cases of COVID-19 are still getting registered throughout the
country. If everyone follows the safety measures, then it can come to an end.
Hence to ensure that people wear masks while coming to work we hope this
module will help in detecting it.

Fig 1.1: Cumulative death cases reported by the world health organization (WHO) from
different regions globally are shown in this pie chart.

1.2 Formulation of Problem


A face masks detector machine can be carried out to check this.Face masks detection
method to identify whether a person is sporting a mask or now not.The face mask
detection is a technique to find out whether the person is wearing a mask or not. In
this project We will build a real-time system to detect whether the person on the
webcam is wearing a mask or not. We will train the face mask detector model using
Keras and OpenCV.. We will develope the face mask detector model for detecting
whether person is wearing a mask or not. We will train the model using Keras with
network architecture. Training the model is the first part of this project and testing
using webcam using OpenCV is the second part. The dataset we are working on
consists of 1376 images with 690 images containing images of people wearing masks
and 686 images with people without masks. we will test the results of face mask
9
detector model using OpenCV.The proposed model can be integrated with computer
or laptop cameras allowing it to detect people who are wearing masks and not
wearing masks. The model has been put together using deep learning and classical
machine learning techniques with opencv, tensor flow and keras.

Fig 1.2: Two-phase COVID-19 face mask detector

In order to train a custom face mask detector, we need to break our project into two
10
distinct phases, each with its own respective sub-steps (as shown by Figure 1 above):
1. Training: Here we’ll focus on loading our face mask detection dataset from
disk, training a model (using Keras/TensorFlow) on this dataset, and then
serializing the face mask detector to disk

2. Deployment: Once 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

1.2.1 Tool and Technology Used


Category: Machine Learning
Programming Language: Python
Tools & Libraries: OpenCV,keras
Front End: NA
Back End : python

11
Chapter2: Literature Survey

In[1]This paper gives an efficient option to screen social distancing practices in


public regions in which it is very tough to display manually for one-of-a type
modules have been advanced for individual detectionsocial distancing recognition,
face detection and face mask category.It presents statistics augmentation strategies to
deal with the lack of dataset inside the network.

[2] Face detection is achieved and with the help of the two labels which were
declared one for coloration and the other for name, faces within the photo are
categorized as with mask or without mask. Accuracy percentage is shown in white
shade on the top of the image.

[3] This smart device routinely opens the door handiest if humans wear face masks
and notify folks who does no longer wear mask. It acts as clever door which
routinely opens and closes the door and it's miles incorporated with a cellular app
which ship notifications to proprietor. The software program advanced within the
assignment is ready detecting the face with mask or without mask which identifies
someone is sporting face masks and gives us alert (through cellular app). This device
is incorporated with a cellular app. cell app let us to realize if someone enters home
when human beings are not bodily found in their domestic.

[4] In this paper, they have analyzed 4 extraordinary steps of masked face detection
and their overall performance. Distance from digicam being extra dependable and
correct step in comparison to other steps. Eye line detection is straightforward to
enforce but it leads to fake detections in bad decision pix as intensity tiers aren't
genuinely distinguishable. Eye detection is reliable but it's miles liable to fake eye

12
detection. Facial part detection is robust and time eating step. In sure cases, facial
component detection may not detect face while person is carrying masks and
therefore this is the problem of facial part detection step. even as lot of studies goes
on inside the field of computer imaginative and prescient and gadget studying, for
detection of numerous activities, these proposed steps will without a doubt deliver
insight to some of the feasible methods to discover if character is wearing masks or
now not. To further enhance the accuracy of those steps, combination of various
functions can be implemented and overall performance can be improved.

[5] This paper offered a narrative and meta-analytic overview masking all the
existing facemask detection algorithms, thinking about the context of Covid-19.The
shortcomings of the present algorithms had been reviewed, and the future challenges
were outlined. although a considerable quantity of studies has been targeted on
growing an green facemask detection set of rules, they specially focused on the
identical set of troubles neglecting some different significant issues. This paper
highlighted those shortcomings, which includes, retaining picture-decision all
through detection process, shortage of wealthy dataset, express classifications, and
others.

In [6] the authors have developed a method to identify how a person is wearing the
face mask. They were able to classify three categories of facemask-wearing condition
namely correct facemask-wearing, incorrect facemask- wearing, and no facemask-
wearing. This method achieved over 98% accuracy in detection.

In [7], the researchers proposed a method for the identification of faces using
Generalized Intersection over Union (GIoU) based on Mask R-CNN. They proposed
this method to reduce the background noise by correctly identifying the face instead

13
of bounding box which adds noise to the face features and reduces the accuracy of
detection.

Detection of face mask is completely based on python and linking with database so
also based on python. By adding firebase library and sending a json data of number
of people present, number of people taken responsible to wear mask or number of
people without wearing the mask [8]. This value will reflect in app and real time
database needs library files to be imported in the device and create a project in
firebase database.

The proposed method is presented to generate the accurate face segmentation masks
from arbitrary image size. The proposed model also shows the recognizing non-
frontal faces. Multiple facial marks in a single frame can be detected [9].

For any arbitrary, The circuit face segmentation and detection using semantic
segmentation on any arbitrary. To perform the unmanned semantic segmentation of
human face. This method reduces the problem of erroneous predictions and find
applications in latest tasks such as facial part detection is also the task[10].

Once the device detects number of people entering and detect whether those people
wearing face mask in accurate way and if someone is detected with no face mask
then alert notification will be sent [11].

Detection of face mask is completely based on python and linking with database so
also based on python. By adding firebase library and sending a json data of number
of people present, number of people taken responsible to wear mask or number of
people without wearing the mask [12].

14
In [13] the authors have employed a GAN-based network using two discriminators
for the removal of face mask from a face and reconstruct the face without the face
mask using the CelebA dataset.

The WHO strongly recommends wearing a facemask in public gatherings and outside
because it blocks the transmission of the virus through the nasal or oral cavity [14]

Although vaccines of coronavirus have been invented and their mass distribution has
started in early December 2020, they only reduce the complications and morbidity of
Covid-19 rather than eradicating the virus. Hence, one of the most efficient and safest
ways to protect an Individual from this virus is to wear a face mask [15]

Facemasks (i.e.,cottonfabrics,surgical,N-95) provide from 50%to95% protection


against the Covid-19 virus [16].

Another method of successful detection of facemask is using Residual Neural


Network (ResNet) which is a very deep CNN. After the outbreak of Covid-19,
ResNet and ResNet-50 both are seen being used in facemask detection algorithms. It
is observed that DL-based algorithms are best suited in case of object detection
earlier [17].

in [18] they improved the YOLO algorithm for detecting the face in a video sequence
and compared the accuracy of detecting to the traditional approach. They also used
the FDDB dataset for training and testing out the model.

The improvement of YOLO model also has been done by Zhao, et al [19]. They

15
improved YOLO model to detect the pedestrian which address two issues such as
leverage real-time saliency through surveillance camera and extract the detail of
distinguished feature.

In 2011, the researchers proposed converting from RGB to YCbCr or HSV to find
skin region. After that, they were calculated with the pixels of skin areas and the
number of pixels of pictures [20].

In 2017, the ROI areas were processed with Principal Component Analysis (PCA) to
create the feature extraction and used KNN, MLP and SVM algorithms for creating
some models to predict the outputs [21].

16
Chapter3: Implementation

Dataset Collection: The dataset was collected from Kaggle Repository and was split
into training and testing data after its analysis.

Training a model to detect face masks: A default OpenCV module was used to
obtain faces followed by training a Keras model to identify face mask.

Detecting the person not wearing a mask: A open CV model was trained to detect
the names of the people who are not wearing masks by referring the database.

A face masks detector machine can be carried out to check this. Face masks detection
method to identify whether a person is sporting a mask or now not. The face mask
detection is a technique to find out whether the person is wearing a mask or not. In
this project We will build a real-time system to detect whether the person on the
webcam is wearing a mask or not. We will train the face mask detector model using
Keras and OpenCV.. We will develope the face mask detector model for detecting
whether person is wearing a mask or not. We will train the model using Keras with
network architecture. Training the model is the first part of this project and testing
using webcam using OpenCV is the second part. The dataset we are working on
consists of 1376 images with 690 images containing images of people wearing masks
and 686 images with people without masks. we will test the results of face mask
detector model using OpenCV.The proposed model can be integrated with computer
or laptop cameras allowing it to detect people who are wearing masks and not
wearing masks. The model has been put together using deep learning and classical
machine learning techniques with opencv, tensor flow and keras.

17
First a base model is generated. This is done my using Keras . First a base model is
generated and a head model is generated on top of that. The generated version is then
trained with the labeled dataset by way of splitting it into portions. One portion
incorporates 75 percentage photographs and it's far used for training. The closing
component includes the remaining 25 percent of pictures and is used for testing the
version accuracy. After the model is trained, it is able to be used for detection of
facemask on human faces. A person without the background. This face is given
because the enter to the model which we skilled in advance. This outputs weather
there is a mask or not. Another model is educated with the faces of humans. The
images used for the training of the model are provided with the name and email
address of that person because the labels of those snap shots. that is performed by the
usage of Open CV. while an input image is given to the CV version, it detects the
face of someone and asks the consumer to provide the name and e mail address of
that man or woman so one can be saved in the database. The output of the primary
version is given because the input to this version. This face can be in comparison
with the folks gift in the database. And if his face matches, then a bounding field will
be drawn over his face along with his name on it and an email and Sms could be sent
to him that he isn't always wearing a masks. Else, only the phrases "mask" may be
gift underneath the bounding box if the individual is sporting a masks and "No mask"
if the person is not carrying one. that is done by means of the usage of OpenCV.
When an input image is given to the CV model, it detects the face of a person and
asks the user to provide the call and e mail address of that man or woman so as to be
stored within the database. The output of the first model is given as the enter to this
model. This face could be compared with the humans present in the database. And if
his face suits, then a bounding box can be drawn over his face along with his call on
it and an email and Sms can be sent to him that he isn't always sporting a mask. Else,
simplest the phrases "masks" can be gift under the bounding field if the person is

18
wearing a mask and "No mask" if the character isn't always carrying one.

THE PROPOSED METHOD

The proposed method consists of a cascade classifier and a pre-trained CNN which
contains two 2D convolution layers connected to layers of dense neurons. The
algorithm for face mask detection is as follows:

Fig 3.1

A.Data Processing

Data preprocessing involves conversion of data from a given format to much


more user friendly, desired and meaningful format. It can be in any form like
tables, images, videos, graphs, etc. These organized information fit in with an
information model or composition and captures relationship between different
entities . The proposed method deals with image and video data using Numpy
and OpenCV.

a) Data Visualization: Data visualization is the process of transforming abstract

19
data to meaningful representations using knowledge communication and insight
discovery through encodings. It is helpful to study a particular pattern in the
dataset . The total number of images in the dataset is visualized in both categories
– ‘with mask’ and ‘without mask’. The statement categories=os.listdir(data path)
categorizes the list of directories in the specified data path. The variable
categories now looks like: [‘with mask’, ‘without mask’] Then to find the number
of labels, we need to distinguish those categories using labels=[i for i in
range(len(categories))]. It sets the labels as: [0, 1] Now, each category is mapped
to its respective label using label dict=dict(zip(categories,labels)) which at first
returns an iterator of tuples in the form of zip object where the items in each
passed iterator is paired together consequently. The mapped variable label dict
looks like: f‘with mask’: 0, ‘without mask’: 1g

b) Conversion of RGB image to Gray image: Modern descriptor-based image


recognition systems regularly work on grayscale images, without elaborating the
method used to convert from color-to-grayscale. This is because the
colortograyscale method is of little consequence when using robust descriptors.
Introducing nonessential information could increase the size of training data
required to achieve good performance. As grayscale rationalizes the algorithm
and diminishes the computational requisites, it is utilized for extracting
descriptors instead of working on color images instantaneously . Fig. Conversion
of a RGB image to a Gray Scale image of 100 x 100 size We use the function
cv2.cvtColor(input image, flag) for changing the color space. Here flag
determines the type of conversion . In this case, the flag cv2.COLOR
BGR2GRAY is used for gray conversion. Deep CNNs require a fixed-size input
image. Therefore we need a fixed common size for all the images in the dataset.
Using cv2.resize() the gray scale image is resized into 100 x 100.

20
c) Image Reshaping: The input during relegation of an image is a three-
dimensional tensor, where each channel has a prominent unique pixel. All the
images must have identically tantamount size corresponding to 3D feature tensor.
However, neither images are customarily coextensive nor their corresponding
feature tensors . Most CNNs can only accept fine-tuned images. This engenders
several problems throughout data collection and implementation of model.
However, reconfiguring the input images before augmenting them into the
network can help to surmount this constraint. The images are normalized to
converge the pixel range between 0 and 1. Then they are converted to 4
dimensional arrays using data=np.reshape(data,(data.shape[0], img size,img
size,1)) where 1 indicates the Grayscale image. As, the final layer of the neural
network has 2 outputs – with mask and without mask i.e. it has categorical
representation, the data is converted to categorical labels.

B. Training of Model
a) Building the model using CNN architecture:
CNN has become ascendant in miscellaneous computer vision tasks The current
method makes use of Sequential CNN. The First Convolution layer is followed
by Rectified Linear Unit (ReLU) and MaxPooling layers. The Convolution layer
learns from 200 filters. Kernel size is set to 3 x 3 which specifies the height and
width of the 2D convolution window. As the model should be aware of the shape
of the input expected, the first layer in the model needs to be provided with
information about input shape. Following layers can perform instinctive shape
reckoning . In this case, input shape is specified as data.shape[1:] which returns
the dimensions of the data array from index 1. Default padding is “valid” where

21
the spatial dimensions are sanctioned to truncate and the input volume is non-
zero padded. The activation parameter to the Conv2D class is set as “relu”. It
represents an approximately linear function that possesses all the assets of linear
models that can easily be optimized with gradient-descent methods. Considering
the performance and generalization in deep learning, it is better compared to
other activation functions. Max Pooling is used to reduce the spatial dimensions
of the output volume. Pool size is set to 3 x 3 and the resulting output has a shape
(number of rows or columns) of: shape of output = (input shape - pool size + 1) /
strides), where strides has default value (1,1) [15]. As shown in fig, 4, the second
Convolution layer has 100 filters and Kernel size is set to 3 x 3. It is followed by
ReLu and MaxPooling layers. To insert the data into CNN, the long vector of
input is passed through a Flatten layer which transforms matrix of features into a
vector that can be fed into a fully connected neural network classifier. To reduce
overfitting a Dropout layer with a 50% chance of setting inputs to zero is added
to the model. Then a Dense layer of 64 neurons with a ReLu 17 activation
function is added. The final layer (Dense) with two outputs for two categories
uses the Softmax activation function. Fig. Convolutional Neural Network
architecture The learning process needs to be configured first with the compile
method . Here “adam” optimizer is used. categorical crossentropy which is also
known as multiclass log loss is used as a loss function (the objective that the
model tries to minimize). As the problem is a classification problem, metrics is
set to “accuracy”.

b) Splitting the data and training the CNN model: After setting the blueprint to
analyze the data, the model needs to be trained using a specific dataset and then
to be tested against a different dataset. A proper model and optimized train test
split help to produce accurate results while making a prediction. The test size is

22
set to 0.1 i.e. 90% data of the dataset undergoes training and the rest 10% goes
for testing purposes. The validation loss is monitored using ModelCheckpoint.
Next, the images in the training set and the test set are fitted to the Sequential
model. Here, 20% of the training data is used as validation data. The model is
trained for 20 epochs (iterations) which maintains a trade-off between accuracy
and chances of overfitting.

METHODOLOGY
System design The major requirement for implementing this project using python
programming language along with Deep learning ,Machine learning , Computer
vision and also with python libraries. The architecture consists of Mobile Net as
the backbone, it can be used for high and low computation scenarios. We are
using Algorithm in our proposed system. Implementation: We have four modules
Datasets Collecting : We collect no of data sets with face mask and without
masks. we can get high accuracy depends on collecting the number of images .
Datasets Extracting: We can extract the features using mobile net v2 of mask and
no mask sets Models Training: We will train the the model using open cv,keras
(python library). Facemask Detection : We can detect Pre processing image and
also detect via live video . If people wear mask, it will permit them, if not then it
will give the buzzer to wear mask to prevent them from virus transmission.

23
Fig 3.2 Proposed framework for the face mask and social distancing.

BENEFITS
1. Manual Monitoring is very difficult for officers to check whether the peoples
are wearing mask or not. So in our technique, We are using web cam to detect
peoples faces and to prevent from virus transmission.
2. It has fast and high accuracy
3. This system can be implemented in ATMs, Banks etc
4. We can keep peoples safe from our technique.

24
3.1 Module Description

PYTHON: Python's simplicity, related to its easily readable code, gives


programmers confidence in the projects they work on. It's stable, flexible, and gives
developers access to a variety of tools that make their jobs easier. Machine Learning
projects rely on complex algorithms, leaving very little room for error.

OPENCV: OpenCV is a great tool for image processing and performing computer
vision tasks. It is an open-source library that can be used to perform tasks like face
detection, objection tracking, landmark detection, and much more. It supports
multiple languages including python, java C++.OpenCV provides a real-time
optimized Computer Vision library, tools, and hardware. It also supports model
execution for Machine Learning (ML).

TENSORFLOW: TensorFlow is an end-to-end open source platform for machine

25
learning.It is an open source artificial intelligence library, using data flow graphs to
build models. It allows developers to create large-scale neural networks with many
layers. TensorFlow is mainly used for: Classification, Perception, Understanding,
Discovering, Prediction and Creation.

Dataset: Data collection is the process of gathering and measuring information from
countless different sources. In order to use the data we collect to develop practical
artificial intelligence (AI) and machine learning solutions, it must be collected and
stored in a way that makes sense for the business problem at hand.

Train a model to catch face masks:We will build a real-time system to detect
whether the person on the webcam is wearing a mask or not. We will train the face
mask detector model using Keras and OpenCV.

Detect the individual not wearing face mask:model was educated to discover the
names of the people who are not sporting mask by referring the database.

Numpy,cv2:OpenCV is a widely usedopen-source library for computer vision. It


includes several ready to use computer vision algorithms. Python is becoming the
standard programming language for AI and NumPy. provides data structures used to
deploy OpenCV with Python.

Existing Problem-
The existing system deals with CNN (convolutional neural network) in the face mask
detection models, they use clustering, classification, max pooling to train the

26
machine on what is what. The CNN trains the machine with the help of dataset,
around 20% of the images in dataset are used to train the machine and the remaining
80% is used for testing the results. The face mask detection model empathizes with
the problems faced by people around the globe due to COVID-19. This system helps
in a small way to stop the pandemic from spreading and festering into our lives
further. The Person Identification model or the face recognition model as it is
popularly called, uses the face recognition library of python to compare images by
similarity detection technique.

Issues in existing system:


In these existing systems it was impossible for the machine to know who is not
wearing a mask and the real-world application for these existing systems were
minimal.

Drawbacks in existing system


The major limitations of existing schemes are as follows: -
CNN used in existing system are slow and resource hungry, which makes the training
process slow.
The existing scheme does not detect multiple faces.
The existing system does not detect faces from all angles.

27
28
WORKFLOW DIAGRAM:

Fig 3.1: FlowChart of the project

29
Fig 3.2: Person With Mask and Without Mask.

Fig 3.3 Face Mask Detection With ML.


30
Chapter4: Experiment and results

Fig 4.1

Fig 4.2
31
Fig 4.3: Dataset with mask

Fig 4.4: Dataset with mask and no mask

32
RESULTS:

By preserving a reasonable proportion of different classes, the dataset will partition


into training and testing set. The dataset will comprises of 1315 samples in total
where 80% will be used in training phase and 20% will get used in testing phase. The
develop architecture will trained for 10 epochs since further training results will
cause overfitting on the training data. Overfitting generally occurs when a model
learns the unwanted patterns of the training samples. Hence, training accuracy
increases but test accuracy decreases.

Fig 4.3: When The Person Not Wearing the Mask . A bounding box drawn over the
face of the person describes weather the person is wearing a mask or not. If a
person’s face is stored in the database, it detects the name of the person who is not
wearing face mask.

33
Mask:

Fig 4.4: When The Person Wearing the Mask . A bounding box drawn over the face
of the person describes weather the person is wearing a mask or not. If a person’s
face is stored in the database, it detects the name of the person who is wearing face
mask.

34
Fig:4.5: when a person Identifies the not wearing Mask And those details not in the
database it try’s Match faces in the database. A bounding box drawn over the face of
the person describes weather the person is wearing a mask

Fig 4.6 It detect multiple faces also in a single frame

35
Chapter 5: Conclusion and Future Scope
The work proposed in the system focuses on the important challenge faced by the
world during the current times due to the ongoing COVID-19 pandemic. The
proposed research work has successfully combined the face mask detection model
with the person identification model, which is also be able to send mail notifications
to the registered people on our platform who are not wearing a mask. Also, this
research work has successfully detected multiple people without wearing a mask or
with a mask in a single frame of video. This third eye technology focuses on the
complicated work of detecting multiple people at once to ensure that people stay safe
in these troubled times by ensuring that they follow the guidelines which are issued
by the government.

5.2: Future Scope

With the growing quantity of COVID cases all around the global, a machine to
update human beings to check masks on the faces of humans is significantly wanted.
This system satisfies that need. This machine may be employed in public places like
railway stations and department shops. it is going to be of a top notch help in
corporations and big establishments where there will be quite a few workers. This
gadget may be of a high-quality assist there as it is easy to attain and save the
information of the personnel working in that organisation and will very clean locate
the folks who are now not sporting the masks and a mail will sent to that respective
man or woman to take Precautions not sporting masks, if there data already stored in
system.

36
REFRENCE:

[1] Wuttichai Vijitkunsawat, Peerasak Chantngram on” Machine Learning


Algorithms for Face Mask Detection” doi: 10.1109/InCIT5058.2020.9310963

[2] Susanto Febri ,Alwan Putra , Riska Analia ,Ika Karlina Laila Nur
Suciningtyas” Face Mask Detection For Preventing the Spread of COVID-19” doi:
10.1109/ESCI50559.2021.9396783

[3] Wei Bu∗†, Jiangjian Xiao†, Chuanhong Zhou∗, Minmin Yang‡, Chengbin
Peng† DOI:10.1109/TSP52935.2021.9522677

[4] Sahana Srinivasan ,Rujula Singh R ,Ruchita R Biradar ,Revathi “Face Mask
Detection on Surveillance video datasets” DOI: 10.1109/ICCIS.2017.8274819

[5] Ravi Kishore Kodali and Rekha Dhanekula” FACE MASK DETECTION
USING DEEP LEARNING” doi: 10.1109/ESCI50559.2021.9396783

[6] Baluprithviraj.K.N ,Bharathi.K.R ,Chendhuran.S” Artificial Intelligence


based Smart Door with Face Mask Detection”

[7] Gayatri Deore, Ramakrishna Bodhula,Dr. Vishwas Udpikar, Prof. Vidya


More” Masked Face Detection Approach in Video Analytics” Doi:
10.1109/CASP.2016.7746164

[8] Ian Goodfellow, Yoshua Bengio, and Aaron Courville, “Deep Learning” MIT
37
Press, 2017

[9] Andrew G. Howard, Menglong Zhu, Bo Chen and Dmitry


Kalenichenko,”MobileNets: Efficient Convolution Neural Networks for Mobile
Vision Application”, Computer Vision and Pattern Recognition, 2017

[10] World Health Organization (WHO) “WHO Coronavirus Disease (COVID-19)


Dashboard” https://covid19.who.int/, [Online; accessed 13 Jan 2021].

[11] Kaihan Lin, Huimin Zhao, JujianLv(&)Jin Zhan, Xiaoyong Liu, Rongjun
Chen, Canyao Li, and Zhihui Huang, "Face Detection and Segmentation with
Generalized Intersection over Union Based on Mask R- CNN",Advances in Brain
Inspired Cognitive System J. Ren et al. (Eds.): BICS 2019, LNAI 11691, pp. 106–
116, 2020

[12] N. Ud Din, K. Javed, S. Bae and J. Yi, "A Novel GAN- Based Network for
Unmasking of Masked Face," in IEEE Access, vol. 8, pp. 44276-44287, 2020, doi:
10.1109/ACCESS.2020.2977386.

[13] Wijara IGPS, Widiartha I, Arjarwani SE, “Pornographic Image Recognition


Based on Skin Probability and Eigenporn of Skin ROIs Image”,Telecommunication
Compute Electron Control, 2015.

[14] Karavarsamis S, Ntamos N, Blekas K and Pitas I, “Detecting pornographic


images by localizing skin ROIs”, International Journal Digit Crime Forensics, pp. 39-
53, 2016

38
[15] Sneha Sen, Harish Patidar, “Face Mask Detection System for COVID_19
Pandemic Precautions using Deep Learning Method”, Journal of Emerging
Technologies and Innoative Research (JETIR), vol. 7, issue 10, pp.16-21

[16] Khaoula Karimi, “Secure Smart Door Lock System based on Arduino and
Smartphone App”, JARDCS, Vol.12 issue 0, pp.407-414, 2020

[17] Manasee Mishra, Piyusha Majumdar; Social Distancing During COVID-19:


Will it Change the Indian Society? (2020)

[18] Marco Cristan, Alessio Del Bue, Vittorio Murino, Fraccesco Setti And
Alessandro Vinciarelli The Visual Social Distancing Problem , 2020

[19] C. Zhao and B. Chen, “Real-time pedestrian detection based on improved


YOLO model,” in 2019 11th International Conference on Intelligent Human-
Machine Systems and Cybernetics (IHMSC), Hangzhou, China, 2019, pp. 25-28, doi:
10.1109/IHMSC.2019.10101

39
[20] Coronavirus Disease (COVID-19): Vaccines. Accessed: Jun. 2, 2021.
[Online]. Available: https://www.who.int/news-room/q-a-detail/ coronavirus-disease-
(covid-19)-vaccines

[21] J. Howard et al., ‘‘An evidence review of face masks against COVID19,’’
Proc. Nat. Acad. Sci. USA, vol. 118, no. 4, 2021. [Online]. Available:
https://www.pnas.org/content/118/4/e2014564118

40

You might also like