Facemask Detection To Prevent COVID-19 Using YOLOv4 Deep Learning Model
Facemask Detection To Prevent COVID-19 Using YOLOv4 Deep Learning Model
Abstract- The on-going global Covid-19 pandemic has impacted donning a face mask, it is not worn in a way that covers both
everyone’s life. World Health Organization (WHO) and their nose and mouth. Thus, they endanger others around them.
Governments all over world have found that social distancing and A lot of this carelessness has led to the subsequent second
donning a mask in public places has been instrumental in wave, third wave, and so on in many countries. In India today,
reducing the rate of COVID-19 transmission. Stepping out of
people still refuse to wear masks properly while stepping out.
homes in a face mask is a social obligation and a law mandate that
is often violated by people and hence a face mask detection model While our healthcare system is overwhelmed and stepping out
that is accessible and efficient will aid in curbing the spread of of our homes can be a dangerous act, even if it’s an essential
disease. Detecting and identifying a face mask on an individual in need. Proposed work assisting all persons in making sure that
real time can be a daunting and challenging task but using deep people abide by the basic rule, i.e., to wear a face mask in
learning and computer vision, establish tech-based solutions that public at all times, for which come up with a design of face
can help combat COVID-19 pandemic. In this paper, YOLOv4 mask detection model using the SOTA deep learning technique
deep learning model is designed and applied deep transfer [2]. Goal is to find out who is not wearing a facial mask in
learning approach to create a face mask detector which can be public places and not abiding rules with the help of a model.
used in real time. GPU used was Google Collab to run the
As stated WHO, respiratory droplets and any type of physical
simulations and to draw inferences. Proposed implementation
considered three types of data as input such as image dataset, contact are two ways the coronavirus spreads, and to prevent
video dataset and real time data for face mask detection. the virus's spread, medical masks are best and only solution.
Performance parameters are tabulated and obtained mean Mask is important for two reasons: virus spreads directly from
average precision of 0.86, F1 score 0.77 for image dataset, 90 % the infected person’s sneezes or cough, and if he/she is masked,
accuracy for video dataset. And real time face mask detector with they will prevent themselves from transmitting to others.
accuracy of 95%, it is successfully able to identify a person with natural spread of the disease is rampant. No one anticipated that
and without facemask and report if they are wearing a face mask would be engulfed by a worldwide pandemic, but with power
or not. of technology, innovate to prevent spread of disease and
Keywords—Convolutional Neural Network (CNN), Artificial hopefully see an end to it. With ongoing crisis, many
Intelligence (AI), Machine learning (ML), Video Surveillance, companies and governments have used power of technology,
Computer Vision (CV),YOLOv4, Facemask detection. particularly artificial intelligence (AI), to help combat the
disease. Seen robots delivering food, medicine, etc. to infected
I. INTRODUCTION individuals in hospitals. AI has been extensively used to help
predict origin of disease and also help to find cure, and many
COVID-19 pandemic has instilled fear among people as this are using it to detect COVID-19 through X-rays and CT scans.
disease can be transmitted through the respiratory system. This AI is even used in building tracking software and wearable tech
virus has killed more than a million people around the globe, to make sure people are abiding by their quarantine rules. AI
and it is expected to rise and continue in same way, leading to and technology have had a significant impact in combating the
the death of many more people. India is on the verge of a disease. The use of AI and DL in healthcare applications is
second wave despite a large-scale vaccination drive [1]. growing rampant, but hasn’t been able to eradicate human
Vaccinating the whole population will take a lot of time, labor. However, as time progresses, AI will be used in
perhaps years, and there is no evidence of reinfection or long- mainstream applications and become an integral part of
term protection against COVID-19. It can be prevented by healthcare systems and governments around the world. This
using safety measures. For example, maintain social distance, work makes use of deep learning to detect masks to prevent the
wash your hands regularly, and wear a mask at all times. A spread of coronavirus. Proposed implementation is aimed at
proper mask that covers mouth and nose is a very important helping government to take action against those not wearing
method to prevent this. A mask of any type gives 98% masks. Used a deep transfer learning approach to go about the
protection against virus droplets spreading through their problem. Transfer learning is an approach in deep learning
mouth. However, we observe that a lot of people in public where knowledge can be transferred from pre-trained, highly
places don’t wear their masks properly, and even if they are efficient models trained by researchers, leading to high
efficiency and reducing the computational complexity [5].
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Artificial Intelligence and Smart Energy (ICAIS-2022)
IEEE Xplore Part Number: CFP22OAB-ART; ISBN: 978-1-6654-0052-7
Also made use of python along with the cross-platform is another type of algorithm that is used mainly in two-stage
computer vision library, OpenCV, which helped to develop detection schemes [9].
real-time computer vision applications. TensorFlow and keras
provide a python interface for artificial neural networks [6] [7]
[10].
II. MOTIVATION, PROBLEM ANALYSIS AND METHODOLOGY
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Artificial Intelligence and Smart Energy (ICAIS-2022)
IEEE Xplore Part Number: CFP22OAB-ART; ISBN: 978-1-6654-0052-7
Figure 4 shows the block diagram of proposed implementation, by creating a random fixed-size batch of the input training data
the process is split into multiple parts as follows. and providing it to the model to do prediction and keep
modifying weights. The dataset is made to pass through the
A. Acquiring the Dataset
model for multiple iterations until the required accuracy is
The process begins by finding or creating an appropriate reached. At the end of training, fine-tuned weights file that
dataset, which consists of multiple images of people. The when implemented to carry out testing should give high-
quality of dataset has a major contribution towards final accuracy results.
efficiency of model as, in this phase, it feeds our model with
all possible scenarios it needs to carry out detections on while G. Testing phase
testing and later in real-time implementation. The image Once the model has reached desired accuracy in training phase,
dataset used in this implementation includes images of people model is saved and implemented on testing dataset to
wearing different types of masks, with multiple people in a determine how well the model performs on unseen data and
frame with and without masks. It also included people sitting images that would give an idea about its performance in real-
in different poses with masks on. Number of variations the time implementation. In this phase, a random fixed-size batch
model covers while training directly impacts the accuracy of of input testing data is created and provided to the model to
detection through model. carry out prediction based on saved weights from model
calculated while training. Multiple performance parameters are
B. Cleaning the Dataset
also calculated during this phase, which suggests
It is the process of ensuring data is correct, consistent, and improvements required if any.
usable. This step involves keeping only the meaningful and
required parts of the dataset that are relevant to the final H. Realtime implementation
prediction that the model needs to be trained on. This is critical Once fine-tuning of the model is done, the model is tested for
for the working of the model. real-time implementation, thereby carrying out predictions on
live videos and predicting if a person in the frame is masked or
C. Data Pre-Processing
not.
A major part of the processing is data labelling process, to get
dataset ready for training. I. Dataset Specifications
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Artificial Intelligence and Smart Energy (ICAIS-2022)
IEEE Xplore Part Number: CFP22OAB-ART; ISBN: 978-1-6654-0052-7
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Artificial Intelligence and Smart Energy (ICAIS-2022)
IEEE Xplore Part Number: CFP22OAB-ART; ISBN: 978-1-6654-0052-7
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Artificial Intelligence and Smart Energy (ICAIS-2022)
IEEE Xplore Part Number: CFP22OAB-ART; ISBN: 978-1-6654-0052-7
show that the model was able to detect masked people correctly
with an accuracy of 0.95 and 0.99.
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the Second International Conference on Artificial Intelligence and Smart Energy (ICAIS-2022)
IEEE Xplore Part Number: CFP22OAB-ART; ISBN: 978-1-6654-0052-7
REFERENCES
[1] Sneha Sen et al.,“Face Mask Detection System for COVID_19 Pandemic
Precautions using Deep Learning Method”,International Journal of
Emerging Technologies and Innovative Research, Vol.7, Issue 10, pp.
16-21.
[2] https://www.researchgate.net/publication/347439579_Social_Distance_
Monitoring_and_Face_Mask_Detection_Using_Deep_Neural_Network
[3] I. B. Venkateswarlu et al.,“Face mask detection using MobileNet and
Global Pooling Block,” IEEE 4th Conference on Information &
Communication Technology (CICT), 2020, pp. 1-5.
[4] https://www.researchgate.net/publication/344239546_Comparative_Stu
dy_of_Deep_Learning_Methods_in_Detection_Face_Mask_Utilization
[5] G. Jignesh Chowdary et al.,“Face Mask Detection using Transfer
Learning of InceptionV3” arXiv:2009.08369,2020.
[6] https://www.researchgate.net/publication/344725412_Covid19_Face_M
ask_Detection_Using_TensorFlow_Keras_and_OpenCV.
[7] A. Biswas et al., “Classification of Objects in Video Records using
Neural Network Framework,” International Conference on Smart
Systems and Inventive Technology (ICSSIT), 2018, pp. 564-569.
[8] M. R. Nehashree et al., “Simulation and Performance Analysis of Feature
Extraction and Matching Algorithms for Image Processing
Applications,” International Conference on Intelligent Sustainable
Systems (ICISS), 2019, pp. 594-598.
[9] R. K. Meghana et al.,“Background-modelling techniques for foreground
detection and Tracking using Gaussian Mixture Model,” International
Conference on Computing Methodologies and Communication
(ICCMC), 2019, pp. 1129-1134.
[10] C. V. Krishna et al., “A Review of Artificial Intelligence Methods for
Data Science and Data Analytics: Applications and Research
Challenges,” International Conference on I-SMAC (IoT in Social,
Mobile, Analytics and Cloud) (I-SMAC) I-SMAC (IoT in Social, Mobile,
Analytics and Cloud) (I-SMAC), 2018, pp. 591-594.
[11] N. Jain et al., “Performance Analysis of Object Detection and Tracking
Algorithms for Traffic Surveillance Applications using Neural
Networks,” Third International conference on I-SMAC (IoT in Social,
Mobile, Analytics and Cloud) (I-SMAC), 2019, pp. 690-696.
[12] C. Kumar B et al., “Performance Analysis of Object Detection Algorithm
for Intelligent Traffic Surveillance System,” Second International
Conference on Inventive Research in Computing Applications (ICIRCA),
2020, pp. 573-579.
[13] M. Rohith et al., “Comparative Analysis of Edge Computing and Edge
Devices: Key Technology in IoT and Computer Vision Applications,”
International Conference on Recent Trends on Electronics, Information,
Communication & Technology (RTEICT), 2021, pp. 722-727.
[14] P. Pradhyumna et al.,“Graph Neural Network (GNN) in Image and Video
Understanding Using Deep Learning for Computer Vision Applications”
Second International Conference on Electronics and Sustainable
Communication Systems (ICESC),2021,pp. 1183-1189.
[15] E. Shreyas et al., “3D Object Detection and Tracking Methods using
Deep Learning for Computer Vision Applications,” International
Conference on Recent Trends on Electronics, Information,
Communication & Technology (RTEICT), 2021, pp. 735-738.
[16] Jacob, I. et al., “Design of Deep Learning Algorithm for IoT Application
by Image based Recognition.” Journal of ISMAC 3, no. 03 (2021): 276-
290.
Authorized licensed use limited to: National University of Singapore. Downloaded on August 25,2022 at 16:06:25 UTC from IEEE Xplore. Restrictions apply.