Professional Documents
Culture Documents
Detection
Submitted in partial fulfillment of the requirements of the
degree
BACHELOR OF ENGINEERING IN COMPUTER
ENGINEERING
By
Supervisor
Prof. Ranjita Asati
1
CERTIFICATE
This is to certify that the Mini Project entitled “ Real-Time Face Mask
Detection ” is a bonafide work of Nikita Dubey (Roll no. 66), Lalit Vinde (Roll
no. 72), and Neha Sargar (Roll no. 75) submitted to the University of Mumbai
in partial fulfillment of the requirement for the award of the degree of “Bachelor
2
Mini Project Approval
Examiners
1………………………………………
(Internal Examiner Name & Sign)
2…………………………………………
(External Examiner name & Sign)
Date :
1. Acknowledgments 5
2. Abstract 6
3. Introduction 6
4. List of figures 7
5. Problem Statement 8
6. Literature survey 8
7. Flowchart 11
11. Conclusion 19
12. References 19
4
Acknowledgments
We would like to express a deep sense of thanks and gratitude to our project
guide prof. Ranjita Asati for constantly guiding us throughout this project. Her
constructive advice and constant motivation have been responsible for the successful
completion of this project.
We have been greatly benefitted from your valuable guidance, encouragement,
and kind of guidance provided to us throughout this project which often helped us to
develop the project successfully.
Submitted By,
Nikita Dubey, Roll No.: 66
Lalit Vinde, Roll No.: 72
Neha Sargar, Roll No.: 75
Under the guidance of
Ranjita Asati
5
2. Abstract
Changes in the lifestyle of everyone around the world. In those changes wearing
a mask has been very vital to every individual. Detection of people who are not
wearing masks is a challenge due to the Outbreak of the Coronavirus pandemic
which has created a large number of populations. This particular project has a
technique of detecting people’s faces and segregating them into two classes: the
individuals with masks in addition to people without masks is done together with the
help of associated image processing and deep learning. With the help of this project,
a person who is intended to monitor the people can be seated in a remote area and
still can monitor efficiently and give instructions accordingly. Various libraries of
python such as OpenCV, Tensor flow, and Keras, Gtts, Os, flask are being used. In
Deep Learning Convolution Neural Networks is a class of Deep Neural Networks
that is used to train the models used for this project.
3. Introduction
The ongoing crisis arises a severe need for protection mechanisms, face masks
being the primary one. Studies have proved that wearing a face mask significantly
reduces the risk of viral transmission as well as provides a sense of protection. In
such a condition, computers come to our rescue. In this project, with the help of a
graphic user interface using a flask, an application is created. Which will scan each
face using a webcam and voice assistant to give the output. A pre-trained model is
proposed to automate the process of identifying people who are not wearing masks.
The images are trained on a Teachable machine https://teachablemachinewith
google.com/ whose code is getting exported and the result is usually returned in a
dialog of "Plz wear a mask"
6
4. List of Figures
7
5. Problem Statement :
● Our goal is to train a custom deep learning model to detect whether a person is
or is not wearing a mask using OpenCV, TensorFlow, Keras, voice assistant,
and Gui.
● The proposed model is trained and tested on known and then on unknown data
for maximum accuracy. The project will scan each face and give us the output
by using a voice assistant.
6. Literature Survey :
8
Understanding the machine learning workflow
We all can define the machine learning workflow in 3 stages.
1. Gathering data
2. Data pre-processing
3. Researching the model that will be best for the type of data
4. Training and testing the model
5. Evaluation
9
7. Flowchart :
10
Fig 4. Flow chart of train neural model
11
Fig 5. Flow chart to do prediction from the trained model
12
8. Algorithm and Process Design:
1. Collect the images of faces with mask and without a mask in RGB format
2. Label these images as with mask or without mask whichever class they belong
to.
and combined these three dimensions identify the color intensity value at a
particular pixel,
Example:
one pixel having R, G, B value as 255, 127, 0 respectively
if we divide those intensity value by 255 we get
R = 255/255 = 1
G = 127/255 = 0.498 = 0.5
B = 0/255 = 0
3. and have some additional hidden layers in between to recognize the pattern
from the image.
1. As we successfully created a model and all our images are well labeled, we
are ready to train our model
14
3. as our batch size is 6 images for we start feeding the data to the neural
network in a batch of 16.
4. After feeding all 16 images of one batch the model will yield a prediction, At
the time of training, the model doesn’t know the pattern in our images so it
will predict so badly.
● We find the partial derivation of all weights and biases which get
encountered while backtracking the path and make use of the chain rule
● Then negate the sign of the slope(partial derivation) and multiply it
with the learning ratio in our case it is 0.001
● and then it gets added to the weight
6. We repeat steps 3 and 4 till the whole data set gets fed to the model.
7. We set the number of epochs as 50, so go to step 2 till 50 echo gets completed.
Algorithm to do prediction:
15
9. Details of Hardware & Software:
● Hardware:
This project uses the internal web camera to capture the input from the user,
therefore, there are specific hardware requirements which are as follows
○ A computer with Webcam access and Speaker: The application requires
access to the webcam to monitor the user and a speaker to give the warning
to the users.
○ 8GB or more RAM: Since this application uses webcam and processes
images continuously it is preferable that enough RAM is available for
smooth and fast processing and to avoid lagging.
● Software:
○ Numpy - 1.19.2, opencv-python == 4.0.1 and Pillow == 8.0.1:
For making image processing efficient and less complex.
○ Flask-1.1.2: Main back-end framework.
○ Threading: Inbuilt Python module for enabling multithreading
○ Tensorflow: we will implement the Python script to train a face mask
detector on our dataset using TensorFlow.
○ OpenCV: OpenCV is an open-source library for computer vision and image
processing. It representing the image in the form of an array where each cell
represents the color intensity value.
○ Numpy - Python library used for working with arrays. It also has functions
for working in the domain of linear algebra, Fourier transform, and matrices.
○ OS: The OS module in Python provides functions for interacting with the
operating system.
○ Gtts: a Python library and CLI tool to interface with Google Translate’s
text-to-speech API.
16
10. Results and analysis
17
Fig 7. 2nd HTML page with mask
18
11. Conclusion
This project has implemented real-time detection of masks through image training
with a deep neural network model and OpenCV, TensorFlow, Keras. We have
developed a web
application using Flask as a back-end server and HTML, CSS, and Bootstrap4 as
front-end
technologies. We have used OpenCV, TensorFlow, and Keras to train the model in
Python. The application enables the user to detect their face and predict if they are
wearing the mask or not.
This model has been trained various times to get an accurate prediction. Through
this project, we had come across new techniques like the Training model using
Tensorflow, Keras, Teachable machine and learned web development technologies
like Flask and implementation of Python as the main programming language.
This specific project was created on the basics of our basic learning of deep
learning. We want to extend this project by training this project with different models
present in deep learning which will improve the flexibility and accuracy of these
models. After which it can be deployed on the larger platform.
12. References
[1] https://www.ijert.org/covid-19-facemask-detection-with-deep-learning-and-
computer-vision
[2] Raza Ali, Saniya Adeel, Akhyar Ahmed Face Mask Detector July 2020.
[3] Amit Chavda, Jason D'souza, Sumit Badgujar Multi-Stage CNN Architecture for
Face Mask Detection September 2020.
[4] A FACEMASK DETECTOR USING MACHINE LEARNING AND
IMAGE PROCESSING TECHNIQUES. Amrit Kumar Bhadani, Anurag
Sinha, Department of computer science and IT, Student, Amity University
Jharkhand. Engineering Science and Technology an International Journal,
November
2020.
[5] https://youtube.com/playlist?list=PLhhyoLH6IjfxVOdVC1P1L5z5azs0XjMsb
[6] https://youtu.be/T9KfYaS9hwQ
[7] https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_
tutorials.html
19