Development of Mask Classification and Wearing Detection Program with Image Processing Technology

Main Article Content

Worawit Fankam-ai
Suphachai Wongnaphawiset
Sahawut Kitiya
Nongnuch Ketui


Development of mask classification and wearing detection program with image processing technology which is purpose to classify and detect wearing masks. There are three steps 1) data set preparation 2) model training and 3) mask classification and wearing. Our research collected datasets with 4 classes; class 1: non-wearing mask, class 2: surgical mask, class 3: cloth mask, and class 4: N95 mask. Our mask classification and wearing detection experiment, two algorithms which are YOLOv4 on Tensorflow and YOLOv5 on Pytorch are compared with 2,311 datasets. We found that the average of accuracy (mAP) of the YOLOv5 (0.9943) is better than the YOLOv4 (0.9057) while the YOLOv5 can classify the cloth mask with the maximum F1-score at 0.9995. Twelve persons are set in the real situation with webcam. The result shown that the YOLOv5 model can correctly detect the 11 persons (0.91%).


Download data is not yet available.

Article Details

Research Article


P. Intra, “Filtration efficiency of surgical masks, fabric masks and N95/KN95/FFP1/FFP2 masks available for use during the COVID-19 pandemic in Thailand,” (in Thai), Thai Sci. Technol. J., vol. 29, no. 5, pp. 904–918, 2021.

R. C. Gonzalez and R.E. Woods, Digital Image Processing, 3rd ed. Upper Saddle River, NJ, USA: Pearson Prentice Hall, 2008.

J. Wu, “Introduction to convolutional neural networks,” National Key Lab for Novel Software Technology, Nanjing University, Nanjing, China, Accessed: Jan. 20, 2022. [Online]. Available:

J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, “You only look once: Unified, real-time object detection,” in Proc. IEEE Conf. Comput. Vision and Pattern Recognit. (CVPR), Las Vegas, NV, USA, 2016, pp. 779–788.

J. Redmon and A. Farhadi, “Yolov3: An incremental improvement,” arXivLabs: experimental projects with community collaborators, Apr. 8, 2018. Accessed: Jan. 20, 2022. [Online]. Available:

A. Bochkovskiy, C.-Y. Wang, H.-Y. M. Liao, “Yolov4: Optimal speed and accuracy of object detection,” arXivLabs: experimental projects with community collaborators, Apr. 2020. Accessed: Jan. 20, 2022. [Online]. Available:

YOLOv5: The friendliest AI architecture you'll ever use, Ultralytics Company, Aug. 2013. [Online]. Available:

H. Adusumalli, D. Kalyani, R. K. Sri, M. Pratapteja, and P. V. R. D. P. Rao, “Face Mask Detection Using OpenCV,” in Proc. 3rd Int. Conf. Intell. Commun. Technol. and Virtual Mobile Networks (ICICV), Tirunelveli, India, Feb. 2021, pp. 1304–1309.

S. Teboulbi, S. Messaoud, M. A. Hajjaji, and A. Mtibaa, “Real-Time implementation of ai-based face mask detection and social distancing measuring system for COVID-19 prevention,” Scientific Program., vol. 2021, Sep. 2021, Art. no. 8340779.

S. Sethi, M. Kathuria, and T. Kaushik, “Face mask detection using deep learning: An approach to reduce risk of Coronavirus spread,” J. Biomed Inform., vol. 120, Aug. 2021, Art. no. 103848.

H. Goyal, K. Sidana, C. Singh, A. Jain, and S. Jindal. “A real time face mask detection system using convolutional neural network,” Multimedia Tools Appl., vol. 81, no. 11, pp. 14999–15015, May 2022.