Wearing face mask detection using deep learning during COVID-19 pandemic

Document Type : Article


Faculty of Mechanical Engineering, Tarbiat Modares University, Tehran, Iran


During the COVID-19 pandemic, wearing a face mask has been known to be an effective way to prevent the spread of COVID-19. In lots of monitoring tasks, humans have been replaced with computers thanks to the outstanding performance of the deep learning models. Monitoring the wearing of a face mask is another task that can be done by deep learning models with acceptable accuracy. The main challenge of this task is the limited amount of data because of the quarantine. In this paper, we did an investigation on the capability of three state-of-the-art object detection neural networks on face mask detection for real-time applications. As mentioned, here are three models used, SSD, two versions of YOLO i.e., YOLOv4-tiny, and YOLOv4-tiny-3l from which the best was selected. In the proposed method, according to the performance of different models, the best model that can be suitable for use in real-world and mobile device applications in comparison to other recent studies was the YOLOv4-tiny model, with 85.31% and 50.66 for mAP and FPS, respectively. These acceptable values were achieved using two datasets with only 1531 images in three separate classes, “with mask”, “without mask”, and “incorrect mask”.


1. "Coronavirus disease (COVID-19): masks", https:// www.who.int/news-room/q-a-detail/coronavirusdisease- covid-19-masks (2020).
2. Rahman, M.M., Manik, M.M.H., Islam, M.M., et al. "An automated system to limit COVID-19 using facial mask detection in smart city network", 2020 IEEE International IOT, Electronics and Mechatronics Conference (IEMTRONICS), pp. 1-5 (2020). DOI: 10.1109/IEMTRONICS51293.2020.9216386.
3. Zhang, K., Zhang, Z., Li, Z., et al. "Joint face detection and alignment using multitask cascaded convolutional networks", IEEE Signal Process. Lett., 23, pp. 1499- 503 (2016).
4. Cabani, A., Hammoudi, K., Benhabiles, H., et al. "MaskedFace-Net - a dataset of correctly/incorrectly masked face images in the context of COVID-19", Smart Heal., 19, 100144 (2020).
5. "Dataset of face images  ickr-faces-HQ (FFHQ)" (2022), https://github.com/NVlabs/ffhq-dataset. 
6. Nieto-Rodriguez, A., Mucientes, M., and Brea, V. "System for medical mask detection in the operating room through facial attributes", Iberian Conference on Pattern Recognition and Image Analysis, pp. 138|145 (2015). DOI: 10.1007/978-3-319-19390-8-16.
7. Loey, M., Manogaran, G., Taha, M., et al. "A hybrid deep transfer learning model with machine learning methods for face mask detection in the era of the COVID-19 pandemic", Measurement, 167, 108288 (2021).
8. Roy, B., Nandy, S., Ghosh, D., et al. "MOXA: A deep learning based unmanned approach for real-time monitoring of people wearing medical masks", Trans.Indian Natl. Acad. Eng., 5, pp.  509-518 (2020).
9. "Moxa3k dataset", https://shitty-bots-inc.github.io /MOXA/index.html (2020).
10. Waghe, S. "Medical masks dataset", https://www .kaggle.com/shreyashwaghe/medical-mask-dataset (2020).
11. Jignesh Chowdary, G., Punn, N.S., Sonbhadra, S.K., et al. "Face mask detection using transfer learning of Inceptionv3", Big Data Analytics, pp. 81-90 (Springer International Publishing, 2020).
12. Prajnasb, "Observations", https://github.com/ prajnasb/observations (2020).
13. Das, A., Ansari, M.W., and Basak, R. "COVID- 19 face mask detection using tensor flow, keras and opencv", 2020 IEEE 17th India Council International Conference (INDICON), pp. 1-5 (2020). DOI: 10.1109/INDICON49873.2020.9342585.
14. Ottakath, N., Elharrouss, O., Almaadeed, N., et al. "ViDMASK dataset for face mask detection with social distance measurement", Displays, 73, 102235 (2022).
15. Larxel, "Face mask detection", https://www.kaggle.com/andrewmvd/face-maskdetection (2020).
16. Krizhevsky, A., Sutskever, I., and Hinton, G. "ImageNet classification with deep convolutional neural networks", Neural Inf. Process. Syst., 25, pp. 84-90 (2012).
17. Girshick, R., Donahue, J., Darrell, T., et al. "Regionbased convolutional networks for accurate object detection and segmentation", IEEE Trans. Pattern Anal. Mach. Intell., 38, pp. 142-158 (2016).
18. Dalal, N. and Triggs, B. "Histograms of oriented gradients for human detection", IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2005), 2 (2005).
19. Lowe, D.G. "Object recognition from local scaleinvariant features", Proceedings of the Seventh IEEE International Conference on Computer Vision, 2, pp. 1150-1157 (1999).
20. Viola, P. and Jones, M. "Rapid object detection using a boosted cascade of simple features", Proceedings of the 2001 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR 2001, pp. 511-518 (2001).
21. Ren, S., He, K., Girshick, R., et al. "Faster RCNN: Towards real-time object detection with region proposal networks", IEEE Trans. Pattern Anal. Mach. Intell., 39, pp. 1137-1149 (2015).
22. Redmon, J., Divvala, S., Girshick, R., et al. "You only look once: unified, real-time object detection", IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 779-788 (2016).DOI: 10.1109/CVPR.2016.91.
23. Liu, W., Anguelov, D., Erhan, D., et al. "SSD: single shot multibox detector", European Conference on Computer Vision, pp. 21-37 (2016).DOI: 10.1007/978-3-319-46448-0-2.
24. Redmon, J. and Farhadi, A. "YOLOv3: an incremental improvement", arXiv Prepr. arXiv1804.02767 (2018).
25. Adarsh, P., Rathi, P., and Kumar, M. "YOLOv3- tiny: Object detection and recognition using one stage improved model", 2020 6th International Conference on Advanced Computing and Communication Systems (ICACCS), pp. 687-694 (2020).
26. Lin, T.-Y., Maire, M., Belongie, S., et al. "Microsoft coco: common objects in context", European Conference on Computer Vision (eds. Fleet, D., Pajdla, T., Schiele, B. and Tuytelaars, T.), pp. 740-755 (Springer International Publishing (2014).
27. Bochkovskiy, A., Wang, C.-Y., and Liao, H.-Y.M. "YOLOv4: Optimal speed and accuracy of object detection", arXiv Prepr. arXiv2004.10934 (2020).
28. Asghar, M.Z., Albogamy, F.R., Al-Rakhami, M.S., et al. "Facial mask detection using depthwise separable convolutional neural network model during COVID-19 pandemic", Front. Public Heal., 10 (2022).