Software Implementation of the Algorithm for Recognizing Protective Elements on The Face

: pp. 155 - 160
Lviv Polytechnic National University
Lviv Polytechnic National University, Computer Engineering Department

The quarantine restrictions introduced during COVID-19 are necessary to minimize the spread of coronavirus disease. These measures include a fixed number of people in the room, social distance, wearing protective equipment. These restrictions are achieved by the work of technological control workers and the police. However, people are not ideal creatures, quite often the human factor makes its adjustments. That is why in this work we have developed software for determining the protective elements on the face in real time using the Python scripting language, the open software libraries OpenCV v4.5.4, TensorFlow v2.6.0, Keras v2.6.0 and MobileNetV2 using the camera.

The training program uses a prepared set of photos from KAGGLE — with a mask and without a mask. This set has been expanded by the authors to include different types of masks and their location. Using TensorFlow, Keras, MobileNetV2, a model is created to study the neural network by analyzing images. The generated neural network uses a model to determine the masks. You can preview the learning result of the network — it is presented as a graphic file. A program that uses the connected camera is then launched and the user can test the operation.

This model can be easily deployed on embedded systems such as Raspberry Pi, Google Coral, and become a hardware and software automated system that can be used in crowded places — airports, shopping malls, stadiums, government agencies and more.

  1. World Health Organization. Transmission of SARS-CoV-2 – implications  for  infection  prevention  precautions:  Scientific brief. July,                       2020.              Available          at: 2019-nCoV-Sci_Brief-Transmission_modes-2020.3-eng.pdf (Accessed: 18 November 2021).
  2. D. M. Morens, Gregory K. Folkers, and Anthony S. Fauci. What    is    a    Pandemic?    August,    2009.               Available    at: (Accessed: 18 November 2021).
  3. Henderi, A. Setiani Rafika, H. L. Hendric Spits Warnar, M. A. Saputra. An Application of Mask Detector For Prevent Covid- 19 in Public Services Area. Henderi et al 2020 J. Phys.: Conf. Ser. 1641 012063. doi:10.1088/1742-6596/1641/1/012063
  4. G. K. Jakir Hussain, R. Priya, S Rajarajeswari, P. Prasanth, N. Niyazuddeen. The Face Mask Detection Technology for Image Analysis in the Covid19 Surveillance System. G K Jakir Hussain et al 2021 J. Phys.: Conf. Ser. 1916 012084. doi:10.1088/1742-6596/1916/1/012084.
  5. S. J. Russel, P. Norvig, Artificial Intelligence: A Modern Approach, 3rd ed., Upper Saddle River, New Jersey 07458, 2010, pp. 727–737. ISBN-13: 978-0-13-604259-4. Available at: 3rd-edition.pdf (Accessed: 18 November 2021).
  6. C. Ranjan, Understanding Deep Learning Application in Rare Event  Prediction,  1st  ed.,  USA,  2020,  pp.  13–15.  ISBN: 9798586189561. Available at: nding_Deep_Learning_Application_in_Rare_Event_Prediction (Accessed: 18 November 2021).
  7. G.  Kudrayvtsev,  Fundamentals  of  Computer  Vision,  May, 2020, pp.14-16. Available  at: o3xo1HlCncj/view (Accessed: 18 November 2021).
  8. J. Minichino, J. Howse, Learning OpenCV 3 Computer Vision with Python, 2nd ed., Birmingham, 2015, pp.209-228. ISBN 978-1-78528-384-0. Available at:         (Accessed:         18 November 2021).
  9. T. Hope, Ye. S. Resheff, I. Lieder, Learning TensorFlow: A Guide to Building Deep Learning Systems, O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472, pp.23-40.      ISBN:      978-1-491-97851-1.      Available      at: TO_BUILDING_DEEP_LEARNING_SYSTEMS  (Accessed: 18 November 2021).
  10. A. Gulli, S. Pal, Deep Learning with Keras: Implemented neural networks with Keras on Theano and TensorFlow, Birmingham, 2017, pp.88 – 100. ISBN: 978-1-78712-842-2. Available at: uJhyA911 (Accessed: 18 November 2021). 
  11. M. Sandler, A. Howard, M. Zhu, A. Zhmoginov and L. Chen, "MobileNetV2: Inverted Residuals and Linear Bottlenecks," 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition,      2018,        pp.           4510-4520, doi: 10.1109/CVPR.2018.00474.
  12. R. Zhang, TensorFlow 2 Tutorial, 2020, pp.4-12. Available at:      (Accessed:      18 November 2021).
  13. G. Garrido, P. Joshi, OpenCV 3.x with Python By Example, 2nd ed., Birmingham, January, 2018. ISBN: 978-1-78839-690-5. Available at: (Accessed: 18 November 2021).