Skip to main content

Advertisement

Log in

Face mask recognition using a custom CNN and data augmentation

  • Original Paper
  • Published:
Signal, Image and Video Processing Aims and scope Submit manuscript

Abstract

In 2019, the COVID-19 disease spread worldwide, and the World Health Organization recommended using masks for everyone. Using a mask is one of the ways to prevent the transmission of the coronavirus. Naturally, there was a need to distinguish people wearing masks from people without masks automatically. Artificial intelligence can be used to indicate masked from unmasked individuals if needed. In this regard, machine learning models and convolutional neural networks have been employed to design an effective model for mask recognition. This problem represents a supervised learning and binary classification problem, where one group is masked, and the other is unmasked. The proposed model has been implemented using the Python programming language, and PyTorch has been utilized for its development. The custom model includes four convolutional layers for extracting image features and four fully connected layers for the artificial neural network part, distinguishing a masked person from an unmasked person. A dataset of approximately 12,000 face mask recognition images was utilized for training the model, resulting in an accuracy of 99.95% during the training phase and 99.02% during the testing phase. In addition to the competitive accuracy achieved in training and testing, the proposed model has consistently demonstrated outstanding performance across multiple metrics. The average precision, recall, and F1 score, exceeding 99%, further highlight the exceptional capabilities of our model. These results are particularly notable compared to the findings reported in other articles, reaffirming the effectiveness and superiority of our proposed approach.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5

Similar content being viewed by others

References

  1. Sangeetha, T., Miruthula, V., Kavimalar, C., Aakash, V.: Face mask detection and social distancing using machine learning with haar cascade algorithm. Sentim. Anal. Deep Learn.: Proceedings of ICSADL 2022, 987–999 (2023)

    Article  Google Scholar 

  2. Razavi, M., Alikhani, H., Janfaza, V., Sadeghi, B., Alikhani, E.: An automatic system to monitor the physical distance and face mask wearing of construction workers in COVID-19 pandemic. SN Comput Sci 3, 1–8 (2022)

    Article  Google Scholar 

  3. Zhang, J., Han, F., Chun, Y., Chen, W.: A novel detection framework about conditions of wearing face mask for helping control the spread of COVID-19. Ieee Access 9, 42975–42984 (2021)

    Article  Google Scholar 

  4. Jignesh Chowdary, G., Punn, N.S., Sonbhadra, S.K., Agarwal, S.: Face mask detection using transfer learning of inceptionv3, In: Big Data Analytics: 8th International Conference, BDA 2020, Sonepat, India, December 15–18, 2020, Proceedings 8, 2020: Springer, pp. 81–90.

  5. Al-Rammahi, A.H.I.: Face mask recognition system using MobileNetV2 with optimization function. Appl. Artif. Intell. 36(1), 2145638 (2022)

    Article  Google Scholar 

  6. Dey, S.K., Howlader, A., Deb, C.: MobileNet mask: a multi-phase face mask detection model to prevent person-to-person transmission of SARS-CoV-2, In: Proceedings of International Conference on Trends in Computational and Cognitive Engineering: Proceedings of TCCE 2020, 2020: Springer, pp. 603–613.

  7. Deng, H., Zhang, J., Chen, L., Cai, M.: Improved mask wearing detection algorithm for SSD, In: Journal of Physics: Conference Series, 2021, vol. 1757, no. 1: IOP Publishing, p. 012140.

  8. Wang, Z., Wang, P., Louis, P.C., Wheless, L.E., Huo, Y.: Wearmask: Fast in-browser face mask detection with serverless edge computing for covid-19, arXiv preprint arXiv:2101.00784, 2021.

  9. Loey, M., Manogaran, G., Taha, M.H.N., Khalifa, N.E.M.: Fighting against COVID-19: A novel deep learning model based on YOLO-v2 with ResNet-50 for medical face mask detection. Sustain. Cities Soc. 65, 102600 (2021)

    Article  Google Scholar 

  10. Jiang, X., Gao, T., Zhu, Z., Zhao, Y.: Real-time face mask detection method based on YOLOv3. Electronics 10(7), 837 (2021)

    Article  Google Scholar 

  11. Wakarekar, M.M., Gurav, U.: Image processing and deep neural networks for face mask detection. In: Advancements in smart computing and information security: first international conference, ASCIS 2022, Rajkot, India, November 24–26, 2022, Revised Selected Papers, Part II, pp. 187–200. Springer, Berlin (2023)

    Google Scholar 

  12. Kandan, C.M., Vidhya, K.: Face mask detection and recognition with high accuracy on live streaming video using improved Yolo V4 and comparing with convolutional neural network. In: Advanced Communication and Intelligent Systems: First International Conference, ICACIS 2022, Virtual Event, October 20–21, 2022, Revised Selected Papers, pp. 673–681. Springer, Berlin (2023)

    Chapter  Google Scholar 

  13. Xiao, C., Chang, L.: Facial mask detection system based on YOLOv4 algorithm, In: 2022 IEEE International Conference on Artificial Intelligence and Computer Applications (ICAICA), 2022: IEEE, pp. 1032–1035.

  14. Kumar, A., Kalia, A., Verma, K., Sharma, A., Kaushal, M.: Scaling up face masks detection with YOLO on a novel dataset. Optik 239, 166744 (2021)

    Article  Google Scholar 

  15. Sharma, V.: Face mask detection using YOLOv5 for COVID-19, California State University San Marcos, 2020.

  16. Fan, X., Jiang, M.: RetinaFaceMask: A single stage face mask detector for assisting control of the COVID-19 pandemic, In: 2021 IEEE international conference on systems, man, and cybernetics (SMC), 2021: IEEE, pp. 832–837.

  17. Mohan, P., Paul, A.J., Chirania, A.: A tiny CNN architecture for medical face mask detection for resource-constrained endpoints, In: Innovations in Electrical and Electronic Engineering: Proceedings of ICEEE 2021: Springer, 2021, pp. 657–670.

  18. Omar, I., Rasha, A.: Automated real-time mask availability detection using neural network. Int. J. Comput. Dig. Syst. 10, 1–6 (2021)

    Google Scholar 

  19. Ge, S., Li, J., Ye, Q., Luo, Z.: Detecting masked faces in the wild with lle-cnns, In: Proceedings of the IEEE conference on computer vision and pattern recognition, 2017, pp. 2682–2690.

  20. Rahman, M.M., Manik, M.M.H., Islam, M.M., Mahmud, S., Kim, J.-H.: An automated system to limit COVID-19 using facial mask detection in smart city network, In: 2020 IEEE International IOT, Electronics and Mechatronics Conference (IEMTRONICS), 2020: IEEE, pp. 1–5.

  21. Pooja, S., Preeti, S.: Face mask detection using AI, Predictive and Preventive Measures for Covid-19 Pandemic, pp. 293–305, 2021.

  22. Xiao, J., Wang, J., Cao, S., Li, B.: Application of a novel and improved VGG-19 network in the detection of workers wearing masks, In: Journal of Physics: Conference Series, 2020, vol. 1518, no. 1: IOP Publishing, p. 012041.

  23. Prasad, S., Li, Y., Lin, D., Sheng, D.: Maskedfacenet: A progressive semi-supervised masked face detector, In: Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, 2021, pp. 3389–3398.

  24. Jian, W., Lang, L.: Face mask detection based on Transfer learning and PP-YOLO, In: 2021 IEEE 2nd international conference on big data, artificial intelligence and internet of things engineering (ICBAIE), 2021: IEEE, pp. 106–109.

  25. Boulos, M.M.: Facial recognition and face mask detection using machine learning techniques,” 2021.

  26. Meivel, S., Devi, K.I., Maheswari, S.U., Menaka, J.V.: Real time data analysis of face mask detection and social distance measurement using Matlab,” Materials today. Proceedings, 2021.

  27. Prusty, M.R., Tripathi, V., Dubey, A.: A novel data augmentation approach for mask detection using deep transfer learning. Intellig-Based Med. 5, 100037 (2021)

    Article  Google Scholar 

  28. Yu, J., Zhang, W.: Face mask wearing detection algorithm based on improved YOLO-v4. Sensors 21(9), 3263 (2021)

    Article  Google Scholar 

  29. Yang, G. et al, Face mask recognition system with YOLOV5 based on image recognition, In: 2020 IEEE 6th International Conference on Computer and Communications (ICCC), 2020: IEEE, pp. 1398–1404.

  30. “FaceMaskDetection.” https://github.com/AIZOOTech/FaceMaskDetection (accessed.

  31. Ieamsaard, J., Charoensook, S.N., Yammen, S.: Deep learning-based face mask detection using yolov5, In: 2021 9th International Electrical Engineering Congress (iEECON), 2021: IEEE, pp. 428–431.

  32. Deng, J., Guo, J., Ververas, E., Kotsia, I., Zafeiriou, S.: Retinaface: Single-shot multi-level face localisation in the wild,” In: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2020, pp. 5203–5212.

  33. Singh, S., Ahuja, U., Kumar, M., Kumar, K., Sachdeva, M.: Face mask detection using YOLOv3 and faster R-CNN models: COVID-19 environment. Multimed. Tools Appl. 80, 19753–19768 (2021)

    Article  Google Scholar 

  34. Alganci, U., Soydas, M., Sertel, E.: Comparative research on deep learning approaches for airplane detection from very high-resolution satellite images. Remote Sens. 12(3), 458 (2020)

    Article  Google Scholar 

  35. Roy, B., Nandy, S., Ghosh, D., Dutta, D., Biswas, P., Das, T.: MOXA: A deep learning based unmanned approach for real-time monitoring of people wearing medical masks. Trans. Indian National Acad. Eng. 5, 509–518 (2020)

    Article  Google Scholar 

  36. “face mask 12k images dataset.” https://www.kaggle.com/datasets/ashishjangra27/face-mask-12k-images-dataset (accessed.

Download references

Author information

Authors and Affiliations

Authors

Contributions

P. Fazeli and S.Z. Tale wrote the main manuscript text and prepared the figures and tables. M.J. Parseh reviewed the manuscript. P. Fazeli and S.Z. Tale wrote the main manuscript text and prepared the figures and tables. M.J. Parseh reviewed the manuscript.

Corresponding author

Correspondence to Mohammad Javad Parseh.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Fazeli Ardekani, P., Tale, S.Z. & Parseh, M.J. Face mask recognition using a custom CNN and data augmentation. SIViP 18, 255–263 (2024). https://doi.org/10.1007/s11760-023-02717-6

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11760-023-02717-6

Keywords

Navigation