<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Real-Time Face Mask Detection using OpenCV and Deep Learning</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Hruthik S. Upendra</string-name>
          <email>hruthikhsu07@gmail.com</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Shruti Suman</string-name>
          <email>shrutisuman23@gmail.com</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sai S. Vishnu</string-name>
          <email>vishnu.yadavalli007@gmail.com</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jaya Dharani</string-name>
          <email>jayadharani245@gmail.com</email>
        </contrib>
      </contrib-group>
      <abstract>
        <p>The outbreak of the COVID-19 pandemic has brought the entire global health system to a standstill. It is now critical to stop the virus from spreading.Wearing a mask, washing our hands frequently, and keeping social distances have all become the main focus around the world. World Health Organization (WHO) highly recommends wearing a mask covering the mouthandnoseto tackle the transmission of the novel coronavirus. In this research study, the Haar-Cascade algorithm, also known as the Voila-Jones algorithm, and OpenCV library classifiers are implemented to find whether someone is wearing a mask or not. The dataset used has 3835 images comprising of human faces with and without masks. The results show that the trained model is 98% accurate in face mask detection. This study is serviceable in real-time applications which stand in need of face mask detection, mainly in densely populated places like educational institutions, airports, and public places.</p>
      </abstract>
      <kwd-group>
        <kwd>1 COVID-19</kwd>
        <kwd>Coronavirus</kwd>
        <kwd>Face mask detection</kwd>
        <kwd>Voila-Jones algorithm</kwd>
        <kwd>Open Computer Vision (OpenCV)</kwd>
        <kwd>Deep learning</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Covid illness (COVID-19) is an irresistible sickness brought about by extreme intense respiratory
condition Covid 2 (SARS-CoV-2). The newfound Covid had influenced everybody across the globe
and upset the economy of numerous nations.SARS-CoV-2, according to many studies throughout the
world, spreads by air and can easily spread over large distances in poorly ventilated areas and
crowded settings. Coronavirus affects various individuals in unexpected ways. The majorityof
infected patients will experience mild to severe illness. and recover without hospitalization. Most
typical symptoms include fever, dry cough, and tiredness. Other symptoms may include aches and
pains, sore throat, diarrhoea, and ability to sense taste and smell. Severe cases may lead to some
serious symptoms like shortness of breath, chest pain or pressure and sometimes loss of speech.
Typically, it requires 5–6 days for somebody who contracted the infection for side effects to show, but
it can take up to as long as 14 days [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Besides, even people with no symptoms can transmit the
infection which makes it hard to prevent people from getting infected. As directed by World Health
Organisation (WHO) wearing a mask and following social distancing plays a key role in preventing
massive spread of disease. Many studies have proved that wearing a mask can help prevent virus
spread. The effectiveness of wearing N95 mask in preventing virus transmission is 91%, whereas
surgical mask has 68% of effectiveness. Wearing mask can reduce the chance of getting disease.
Accordingly, the usage of masks and hand sanitizers have demonstrated to be effective in avoiding the
spread of the infection. Hence, a face mask detecting system is required which will alert the people
and helps in preventing the pandemic. We will explore real-time face mask detection using deep
learning and OpenCV in this paper.
      </p>
      <p>Deep learning is subbranch of machine learning that works with algorithms that are inspired
by the human brain. Deep learning helps in breakdown of problems in many fields. Deep learning
offer image detection, image classification and Convolutional Neural Networks (CNN). The
Convolutional Neural Networks (CNN) are mainly used in computer detection and classification
tasks. In this paper Deep learning techniques are used to differentiate faces wearing a mask and not
wearing a mask. Convolutional Neural Networks (CNN) are used to include the efficient number of
Convolutional Neural Layers for accurate detection.</p>
      <p>OpenCV is a library of programming functions which mainly aimed at real time computer vision,
Machine Learning and Image processing. The computer vision mainly aims at manipulating and
retrieve data from a real time source. It can be used in Autonomous driving vehicles. OpenCV is used
for detection of faces, objects, and handwritings. It plays a key role in detection of face with and
without mask.</p>
      <p>By summarising we firstly create a CNN for detection of facial images and then employee
Deep learning algorithms for detection of faces with and without masks using Tensor flow and Open
CV libraries.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Background</title>
    </sec>
    <sec id="sec-3">
      <title>2.1. OpenCV</title>
      <p>Open CV is a library of programming functions which is mainly aimed at real-time computer
vision, Machine Learning, and Image processing. Initially, OpenCV was written in C++ language and
supports multicore processing. These algorithms are also bindings in Python, Java, MATLAB. It
mainly focuses on image processing, video capturing, face detection. Open CV has the advantage of
hardware acceleration of the underlying heterogeneous compute platform. Open CV has access to
nearly 2,500 algorithms for different computer vision techniques. Open CV is a cross-platform library
i.e., it can operate on any operating system.
2.2.</p>
    </sec>
    <sec id="sec-4">
      <title>TensorFlow</title>
      <p>TensorFlow is an opensource library for machine learning. It is a Python friendly library for
numerical computations that makes machine learning easy and faster. TensorFlow is particularly used
in training and deployment of deep neural networks. TensorFlow is a symbolic mathematical
representation of data flow and differential programming.
2.3.</p>
    </sec>
    <sec id="sec-5">
      <title>Keras</title>
      <p>Keras is an open source library for Artificial Neural Networks. It provides a python interface for
ANN. It also acts as an interface for Tensor Flow library. Keras is designed to enablequick
experimenting with deep neural networks. Keras contains a few Neural organization building squares
like layers, targets, actuation, capacities, analyzers, and a large group of apparatuses with picture and
text information for the execution of profound neural organization codes. Keras additionally upholds
for Convolutional and repetitive neural organizations. It is additionally used to productize the
profound learning models on cell phones.</p>
    </sec>
    <sec id="sec-6">
      <title>3. Methodology</title>
    </sec>
    <sec id="sec-7">
      <title>3.1. Data Collection</title>
      <p>The first step in detecting face mask is to collect data to train the model for real-time face mask
detection. For this, images of people wearing masks and people not wearing masks were required.
3835 images of both wearing mask and without mask were acquired through sources like Google and
Bing and through Kaggle datasets and RMFD datasets. The used dataset comprises of 1916 pictures
of individuals wearing the veil and 1919 pictures of individuals don't wearing the cover.</p>
      <p>The detection of face mask can be described in two steps as follows: 1. Face Recognition and 2.
Mask Detection. For implementing face mask recognition, machine learning object detection
algorithm called Viola-Jones algorithm and Haar feature-based cascade classifiers are applied using
OpenCV. Face detection algorithm was introduced by Paul Viola and Michael Jonesin 2001 in their
paper, “Rapid Object Detection using a Boosted Cascade of Simple Features”. For real-time face
detection to be done in a video, we need to perform face detection for every frame in the video. Face
detection is shown in figure3.</p>
      <p>Now, after the detection of face on the image, it is preprocessed and resized to 224x224 pixels
dimensions. Further, OpenCV spretrainedHaar course classifiers are utilized for mouth and nose
identification which characterizes if an individual is wearing a cover. In the event that the mouth and
nose are distinguished, the individual isn't wearing a veil, thus whether a cover is not really set in
stone.</p>
    </sec>
    <sec id="sec-8">
      <title>4. Results</title>
      <p>Python programming language is used for implementing the real-time face mask detection using
OpenCV and achieved 98% validation accuracy. This is the most noteworthy rate after several tests
performed with a batch size 32 and 20 repetitions of Epochs. The results below illustrates the
accuracy and loss performance of the trained model.
accuracy
macro avg
weighted avg</p>
    </sec>
    <sec id="sec-9">
      <title>5. Conclusion and Future work</title>
      <p>This paper presents a study on real-time face mask detection using OpenCV and deep learning
techniques and based on the results obtained, it is a noteworthy method for easy detection of
facemask, however, there are a very few limitations which can be easily overcome in future work.
The proposed method is very useful for real-time applications which stand in need of face mask
detection, mainly in densely populated places like educational institutions, airports, and public places.
In future, using various deep learning techniques and IOT applications we can further implement
mask detection along with contactless temperature check, which detects proper wearing of mask and
gives entry access only if mask was wore properly and if the body temperature is normal and warns us
if mask was not wore properly or no mask was wore and high body temperatures and thus can prevent
the indoors spread of the virus and implement the directed safety guidelines for prevention of
Covid19.</p>
    </sec>
    <sec id="sec-10">
      <title>6. References</title>
      <p>and Pattern Recognition. CVPR 2001, Kauai, HI, USA, 2001, pp. I-I, doi:
10.1109/CVPR.2001.990517.
[15] Viola, P., Jones, M.J. Robust Real-Time Face Detection. International Journal of</p>
      <p>ComputerVision 57, 137–154(2004). https://doi.org/10.1023/B:VISI.0000013087.49260.fb
[16] Open Computer Vision [Online]. Available on: https://opencv.org/
[17] Yi-Qing Wang, An Analysis of the Viola-Jones Face Detection Algorithm, Image Processing</p>
      <p>On Line, 4 (2014), pp. 128–148. http://dx.doi.org/10.5201/ipol.2014.104
[18] Yu, P., Zhu, J., Zhang, Z., &amp; Han, Y. (2020). A Familial Cluster of Infection Associated With
the 2019 Novel Coronavirus Indicating Possible Person-to-Person Transmission During the
Incubation Period. The Journal of infectious diseases, 221(11), 1757–1761.
https://doi.org/10.1093/infdis/jiaa077
[19] Chavez S, Long B, Koyfman A, Liang SY. Coronavirus Disease (COVID-19): A primer for
emergency physicians. Am J Emerg Med. 2020 Mar 24:S0735-6757(20)30178-9. doi:
10.1016/j.ajem.2020.03.036. Epub ahead of print. PMID: 32265065; PMCID: PMC7102516.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Coronavirus</given-names>
            <surname>Update</surname>
          </string-name>
          (Live) [online]. Available on: https://www.worldometers.info/coronavirus/ last accessed:
          <volume>17</volume>
          /01/
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2] World Health Organization. Accessed on:
          <fpage>21</fpage>
          -
          <lpage>Jan2021</lpage>
          . [Online]. Available on: https://www.who.int/health-topics/coronavirus/
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>P.</given-names>
            <surname>Dawson</surname>
          </string-name>
          et al.,
          <source>“Loss of Taste and Smell as Distinguishing Symptoms of COVID-19”, Clinical Infectious Diseases June</source>
          <year>2020</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>4</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.1093/cid/ciaa799
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>L.</given-names>
            <surname>Morawska</surname>
          </string-name>
          , “
          <article-title>How can airborne transmission of COVID-19 indoors be minimised?”</article-title>
          , Environment International vol.
          <volume>142</volume>
          ,
          <year>September 2020</year>
          ,
          <volume>105832</volume>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>7</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.1016/j.envint.
          <year>2020</year>
          .105832
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>V.</given-names>
            <surname>Balachandar</surname>
          </string-name>
          et al.,
          <source>“COVID-19: emerging protective measures”</source>
          ,
          <source>European Review for Medical and Pharmacological Sciences</source>
          vol.
          <volume>24</volume>
          (
          <issue>6</issue>
          ), pp.
          <fpage>3422</fpage>
          -
          <lpage>3425</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.26355/eurrev_202003_
          <fpage>20713</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>T.</given-names>
            <surname>Galbadage</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Peterson</surname>
          </string-name>
          , R. Gunasekera, “
          <string-name>
            <surname>Does</surname>
          </string-name>
          COVID-19 Spread Through Droplets Alone?”, Frontiers in Public Health, vol.
          <volume>8</volume>
          ,
          <string-name>
            <surname>April</surname>
            <given-names>2020</given-names>
          </string-name>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>4</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.3389/fpubh.
          <year>2020</year>
          .00163
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wang</surname>
          </string-name>
          et al.,
          <source>“Masked Face Recognition Dataset and Application” [preprint]</source>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>3</lpage>
          ,
          <year>2020</year>
          . https://arxiv.org/pdf/
          <year>2003</year>
          .09093.pdf
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>D.</given-names>
            <surname>Oran</surname>
          </string-name>
          , E. Topol,
          <article-title>Prevalence of Asymptomatic SARS-CoV-2 Infection: A Narrative Review</article-title>
          ,
          <source>Annals of Internal Medicine</source>
          ,
          <year>June 2020</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>7</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.7326/M20-3012
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Bai</surname>
            <given-names>Y</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yao</surname>
            <given-names>L</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wei</surname>
            <given-names>T</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tian</surname>
            <given-names>F</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jin</surname>
            <given-names>DY</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chen</surname>
            <given-names>L</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wang</surname>
            <given-names>M</given-names>
          </string-name>
          .
          <source>Presumed Asymptomatic Carrier Transmission of COVID-19. JAMA. 2020 Apr</source>
          <volume>14</volume>
          ;
          <volume>323</volume>
          (
          <issue>14</issue>
          ):
          <fpage>1406</fpage>
          -
          <lpage>1407</lpage>
          . doi:
          <volume>10</volume>
          .1001/jama.
          <year>2020</year>
          .2565. PMID: 32083643; PMCID: PMC7042844
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Song</surname>
          </string-name>
          et al.,
          <string-name>
            <surname>“</surname>
          </string-name>
          COVID-19 Treatment: Close to a Cure?
          <article-title>- A Rapid Review of Pharmacotherapies for the Novel Coronavirus”</article-title>
          [preprint], pp.
          <fpage>1</fpage>
          -
          <lpage>25</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.20944/preprints202003.
          <fpage>0378</fpage>
          .v1
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>Coronavirus</given-names>
            <surname>Incubation Period</surname>
          </string-name>
          [online]. Available on: https://www.worldometers.info/coronavirus/coronavirusincubationperiod/, last accessed:
          <volume>23</volume>
          /01/
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>D.</given-names>
            <surname>Oran</surname>
          </string-name>
          , E. Topol,
          <article-title>Prevalence of Asymptomatic SARS-CoV-2 Infection: A Narrative Review</article-title>
          ,
          <source>Annals of Internal Medicine</source>
          ,
          <year>June 2020</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>7</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.7326/M20-3012
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>T.</given-names>
            <surname>Dbouk</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Drikakis</surname>
          </string-name>
          , “
          <article-title>On respiratory droplets and face masks”</article-title>
          ,
          <source>Physics of Fluids</source>
          <volume>32</volume>
          ,
          <issue>063303</issue>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>11</lpage>
          ,
          <year>2020</year>
          . https://doi.org/10.1063/5.0015044
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>P.</given-names>
            <surname>Viola</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Jones</surname>
          </string-name>
          ,
          <article-title>"Rapid object detection using a boosted cascade of simple features,"</article-title>
          <source>Proceedings of the 2001 IEEE Computer Society Conference on Computer Vision</source>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>