Implementation of Face Mask Detection Using Phyton Programming Language

Since the beginning of the pandemic in 2019, people in Indonesia have been required to wear masks. Although until now the pandemic has ended, the need to use masks is still very much needed such as to maintain health, avoid air pollution and others. In detecting mask users, an application is needed that can help human work. Currently, the Python programming language is widely used to build applications in the field of computer vision, one of which is this face mask detection application. This application will detect mask users, whether they are wearing a mask or not. This developed application uses the Yolo model using the Face Mask Detection dataset developed by Larxel, where the Yolo model can work on the dataset provided. The test results show that the Yolo model can recognize mask users with an accuracy value above 90%. The second experiment was carried out to detect several faces of mask users, the Yolo model can recognize mask users or not with an average accuracy value of 91.75%. For future research, it is also expected to use other models besides Yolo and make comparisons of several models and make improvements to the problems that exist in each model and use


I. INTRODUCTION
The Covid-19 pandemic has hit almost all over the world since 2019, since then the development of people exposed to the graph shows an increase. The government issued a policy that every citizen must comply with health protocols such as wearing masks, maintaining distance, washing hands and avoiding crowds. Some people seem unable to comply with these health protocols.
The use of masks during activities is one way we can prevent the spread of the Covid-19 virus, of course, by continuing to carry out other health protocols. One form of spreading the Covid-19 virus is through droplets or splashes from the respiratory tract. Analysis results from [1] and researches [2] revealed that wearing a mask can reduce the spread of the COVID-19 virus transmitted through droplets.
On May 17, 2022, President Joko Widodo has given leeway to the public regarding the use of masks outdoors [3]. However, on July 11, 2022, President Joko Widodo again announced to the public regarding the use of masks, residents are required to wear masks both outdoors and indoors. This is because Covid-19 cases in Indonesia are increasing again, especially the BA.4 and BA.5 variants [4].
To be able to provide awareness of the use of masks, the government conducts raids in crowded places against residents who are not orderly in wearing masks. This is certainly done to reduce the spread of the Covid-19 virus.
Computer vision is a derivative of Artificial Intelligence where computers can pull details and other data of interest from images or videos using specialized algorithms. Computer vision can be extended to many applications, with varying degrees of accuracy, based on the use case. In detecting mask wearers on campus, computer vision is used by taking pictures of students focused on the framed part of the face to check for mask use. From the image data taken, it is matched with the data set that has been given [5].
Currently, there are several research results related to mask users, but there is still no complete large-scale mask user dataset containing face, race, age, and gender. In addition, there is no unified dataset that can be utilized to check mask users. [6].
YOLO is a popular framework that is used to detect objects in real time and will find bounding boxes to track the objects to be captured. YOLO has high speed, accuracy and detectability for real-time processing. YOLO will detect faces (masked or not) and then use a Convolutional Neural Network (CNN) algorithm to classify them into two categories [5]. There are many studies related to the use of the YOLO model for several different cases such as those conducted by the following researchers [7]- [14] II. RELATED WORKS

A. Masks
At the beginning of the pandemic in Indonesia, people had difficulty getting masks, but now masks are easily available and are a daily necessity for the community. Masks are respiratory protection aids used to protect oneself from harmful substances in the free air. Masks are used to protect users from harmful substances, not to eliminate a disease. In the field of medicine, masks are very important to be used by medical personnel in carrying out their duties. The types of masks used are [15] 1. Masks for health workers (medical personnel) Masks for healthcare workers consist of: a. Surgical mask Surgical masks are prioritized only for sick people and medical personnel. Even though they are healthy, medical personnel must wear surgical masks when on duty because of their frequent contact with patients and to protect health workers from all germs or viruses. Surgical masks can filter air better than cloth masks. b. N95 Mask N95 masks are able to filter air by 95% or more, usually used for medical personnel who perform highrisk actions from virus transmission.

Masks for non-health workers
One type of mask used for non-health workers is cloth masks. WHO requires the use of cloth masks to consist of three layers. Cloth masks can filter air by 60% so they are not recommended for use by medical personnel. Cloth masks can be washed repeatedly but can only be used for 3-4 hours. [16].

B. Computer Vision
We as humans will be able to clearly and easily recognize and distinguish various object features because our brains have been trained to recognize a series of images. Contrary to the human brain, a computer only views an image as an array of values so to recognize the image, a process must be done.
Image processing algorithms are used by computer vision to examine and comprehend an image's visuals. An example of computer vision is identifying mask wearers, computer vision will accurately categorize and filter millions of images uploaded by users [17].
Computer vision has grown tremendously over the years, due to the increasing demand for devices such as drones, autonomous and semi-autonomous vehicles, smartphones and the increasing adoption of Industry 4.0. Companies are beginning to invest in developing picture recognition to analyze data produced from image sources as a result of the development of computer vision. This can be used for medical image analysis, face detection for security, identifying objects in autonomous cars and so on.

C. How Image Recognition works
A matrix of numerical values will be represented as a digital image. The values represent data related to the image's pixels. In matrix format, the intensity of various pixels, averaged to a single value, is represented. The intensity and placement of various pixels within the image are the data sent to recognition. The algorithm will map the relationships and patterns in the following photos using this information before beginning the learning process. After that, the system's performance on the test data is validated. The neural network's intermittent weights have been altered to increase the accuracy of the system's picture recognition capabilities.

D. Use of Image Recognition
The use of image recognition can be applied to: 1. Manufacturing Image recognition in manufacturing is used to inspect production lines, monitor the quality of the final product, monitor workers and so on.

Autonomous vehicle
The ability of autonomous cars to recognise activity on the road and take appropriate action [10].

Drone
Drones that have been equipped with image recognition are able to provide monitoring of activities in certain areas.

Military Surveillance
Image recognition can help military surveillance in border areas, this is to prevent infiltration from other countries in rescue efforts.

E. Convulational Neural Network (CNN)
Convolutional Neural Network (CNN) is a development of Multilayer Perceprton (MLP) that is made to process data in two dimensions. CNN is a type of Deep Neural Network (DLP), so it is often used with image data [18]. Kunihiko Fukushima, a researcher at the NHK Broadcasting Science Research Laboratories in Kinuta, Setagaya, Tokyo, Japan, came up with the idea for CNN. He called it NeoCognitron at the time. Then a researcher from AT&T Bell Laboratories, New Jersey, USA finalized the NeoCognitron concept with his research on number recognition and handwriting, the concept was named LeNet.
In 2012, the ImageNet Large Scale Visual Recognition Challenge competition was held with the champion Alex Krizhevsky with the work of applying Deep Learning methods to CNN. The CNN method proved successful in outperforming other Machine Learning methods such as SVM.
The way CNN works is almost the same as MLP, but in CNN each neuron is presented in two dimensions while in MLP each neuron is only one dimension. CNN has parameters that are useful for automatically learning the features in the image to find the best features in the image and is used to filter images that have abstract information in each layer [13].

F. Yolo
You Only Look Once (YOLO) is a single convolutional network that simultaneously predicts multiple bounding boxes and the class probabilities for those boxes [19]. YOLO has several benefits compared to other object detection methods such as being very fast, not requiring a complex pipeline and YOLO only runs the neural network on new images at test time. There are disadvantages to YOLO such as the need for a powerful and sophisticated computer architecture, so that during the training process for longer specifications it will take a very long time.
YOLO can learn generalizable object representations. When trained and tested on natural images, YOLO was able to outperform other detection methods such as Region Convolutional Neural Network (R-CNN) and Deformable Parts Model (DPM). YOLO is very unlikely to fail when applied to a new domain as it is highly generalizable. YOLO is a good choice for real time detection by minimizing the loss of accuracy. YOLO can detect multiple objects, predict the class created and identify the location of the object [20].

Fig. 2 Face mask detection framework
Here is the framework of face mask detection A camera to detect people's faces, the camera will capture the person's face, face mask detection will process the image with the Yolo Model. Yolo will process the image and will use the dataset as a data center for mask users. After processing, it will predict whether the person is wearing a mask or not. If the person is not wearing a mask, the without mask result will appear and if the person is wearing a mask, the with mask result will appear.

A. Application For Experiments
In this research, the author uses an application that can be used to detect mask wearers using the Phyton programming language. Here are some functions that can be used for experiments

B. Dataset
The dataset used is a public dataset, namely the Face Mask Detection dataset from Larxel downloaded from the website https://www.kaggle.com/ with a total data of 853 image data. The dataset contains data on mask users, not using masks and using the wrong masks. Here is an example of the dataset used:

C. Experiment
The process of experimentation and model testing begins with taking pictures using a webcam, the images obtained are carried out the face mask detection process with the Yolo model. The train process is carried out based on the dataset used so that Yolo will predict the image. The results of the prediction are "without_mask" and "with_mask" with the accuracy value. The following are the experimental results of the application made: Detection result without mask Detection results using masks Fig. 4 Face detection results using masks and not Based on the experimental results above, it can be seen that the application can detect the faces of people who use masks or without masks with an accuracy value of 94% for faces without masks and 93% for faces using masks. This application is also tested to detect the faces of many people. Here are the detection results using several people objects: Based on the experimental results using several objects of people's faces, the application can detect the faces of mask users or not with an average accuracy value of 91.75%. Based on the experimental results above, it can be seen that the developed application can work as needed so that it can provide information results and accuracy values from the face detection process.

V. CONCLUSIONS
The implementation of face mask detection using the Python programming language can be used to detect the face of a mask user either using a mask or not using a mask. The model used for detection is Yolo. Based on the results of the experiments that have been carried out, it can be seen that the application can work well. The application provides information related to using a mask or not using a mask with the accuracy value obtained. The Yolo model can also be applied to detect multiple facial objects. The average accuracy value of multiple object detection is 91.75%. For future research, it is also expected to use other models besides Yolo and make comparisons of several models and make improvements to the problems that exist in each model and use real time data.