AI-based System for the Detection and Prevention of COVID-19

The COVID-19 pandemic has had catastrophic consequences all over the world since the detection of the first case in December 2019. Currently, exponential growth is expected. In order to stop the spread of this pandemic, it is necessary to respect sanitary protocols such as the mandatory wearing of masks. In this research paper, we present an affordable artificial intelligence-based solution to increase the protection against COVID-19, covering several relevant aspects to facilitate the detection and prevention of this pandemic: noncontact temperature measurement, mask detection, automatic gel-dispensing, and automatic sterilization. Our main contribution is to provide high-quality, real-time learning and analysis. To achieve this goal, we used a deep convolutional neural network (CNN) based on MobileNetV2 architecture as the learning algorithm and Advanced Encryption Standard (AES) as an encryption protocol for sending secure data to notify hospital staff. The experimental results show the effectiveness of our model by providing 99.7% accuracy in detecting masks with a runtime of 1.54 s. Keywords—Face mask detection; coronavirus; COVID-19; deep learning; MobileNetV2; AES


I. INTRODUCTION
The world faces a serious pandemic named COVID-19 as a result of the new SARS-CoV-2 virus, which began in China in late December 2019.This epidemic spread quickly beyond China on February 25, 2020 for the first time [1]. By January 20, 2022, the total number of identified cases was 338 807 207 while 5 581 841 individuals had passed away worldwide [2]. The most common symptoms of COVID-19 are fever, headache and loss of smell, muscle pains, and dry cough. In the most severe forms, the onset of acute respiratory distress syndrome leads to death, especially in people who are more fragile because of their age or comorbidities [3]. Coronavirus infections are frequent in humans and in most cases, they are transmitted directly (from one person to another) by respiratory droplets. However, they are also transmitted indirectly by surfaces [4]. To reduce the spread of this disease, many protective and safety measures have been taken by the authorities such as mandatory wearing of an indoor mask, physical distancing, self-isolation, limitation of citizen movement within a country"s borders and abroad, closure of non-essential workplaces and educational institutions, and finally reduction of public transport and restriction of domestic and international travel [5]. Overall, the sanitary protocols of preventing COVID-19 have shown positive results in reducing the spread of the virus [6].
Consequently, we propose a new system of access control in compliance with health protocols. In this article, we present an intelligent system to help organizations comply with COVID-19 security rules and reduce the spread of the pandemic. We focus on the most common internal measures, such as the distance between people, which should be at least 1.5 to 2 meters. Equally crucial is wearing a mask and washing hands with hydro alcoholic gel. Finally, people with a temperature above 38°C should stay at home and receive health care, and should not go to work or school or interact with others outside the home.
Our system is designed to help the fight against this pandemic by monitoring the wearing of masks to reduce the spread of viruses [7]. Moreover, this system detects the fever of people without making contact. The room is sterilized daily and automatically when an abnormal temperature is detected. Gel is distributed without the need to touch the dispenser since COVID-19 could be transmitted by a plastic surface. Finally, the algorithm used in this work detects mask-wearing at 99.7% efficiency.
The remainder of this paper is organized as follows: The second section explores some related works and similar approaches to COVID-19 detection. In the third section, we outline our suggested method for COVID-19 detection and prevention. Then, in the fourth section, we describe the materials and methods used in the experiment, including the results of the evaluation. In the fifth section, we offer the conclusion.

II. RELATED WORK
It has become increasingly important to consider some methods of COVID-19 prevention and detection to limit and restrict the rapid spread of the epidemic virus. In their works, several researchers have proposed numerous approaches to detect COVID-19 and protect persons from this virus.
The authors in [8] have proposed a portable non-contact method to screen the health status of people wearing masks through analysis of respiratory characteristics. In their work, they proposed the use of a device which consists of a thermal camera FLIR ONE and an Android phone. This work is based on face detection in a video stream to capture technical breathing data. Then, the deep learning algorithm Gated www.ijacsa.thesai.org Recurrent Unit (GRU) is applied to the respiratory data to obtain the result of medical screening. While this method can help to combat the current epidemic of COVID-19, the proposed algorithm is not stable in the respiratory status measurement because of the effects of different types of masks.. In another work [9], the authors focus on the workflow based on the detection of COVID-19 from image classification using the deep learning model"s convolutional neural network (CNN), they provided a pre-processing pipeline aimed at removing the sampling bias and improving the image quality. The results show that the CNN algorithm based on a Visual Geometry Group (VGG19) model provides better COVID-19 detection results against pneumonia for the ultrasound images. This work enables quick, accessible, affordable, and reliable identification of COVID-19 and helps to slow the transmission of COVID-19 infection. However, the used database requires a large number of images for better identification.
Jordi Laguarta and all, in [10] built a data collection pipeline of COVID-19 cough recordings between April and May 2020. They created the largest balanced COVID-19 audio cough to develop an intelligent speech-processing framework that leverages acoustic biomarker feature extractors to prescreen COVID-19 from cough recordings.
In [11], the authors proposed a mask-wearing detection system. This system recognizes whether or not a person is wearing a mask based on the transfer learning technique. The ResNet-50 model is based on YOLO v2 (deep learning algorithm), which gives an accuracy of 81% of mask detection. The major drawback of this work is that the authors did not give details about the confusion matrix of the proposed algorithm.
Regarding temperature detection, there are several variant Arduino-based solutions. For instance, in [12], IoT systems for security monitoring based on temperature detection were presented. However, the used sensor does not give accurate results. In this context, in [13], the authors present a comparison between three types of sensors to measure temperature without making contact. According to the obtained results, the thermal camera Lepton gives the most accurate value with a minimum error rate.
To summarize, the previously cited works were carried out to design and deploy COVID prevention and detection systems. However, we deduce that these systems perform poorly for small and unvaried datasets because of the great variety of masks and the differing of symptoms from one person to another.
To remedy the problems mentioned above, our main objective is to offer a COVID-19 detection and prevention system based on deep learning for the detection of maskwearing. We provide an effective and intelligent solution with a secure monitoring process based on the MobileNetV2. Moreover, because of the sensitivity of transmitted results to doctors, we need to ensure confidentiality. In fact, to provide secure end-to-end service, data are encrypted based on symmetric cryptography using AES (advanced encryption algorithm).

III. OVERVIEW OF THE PROPOSED SCHEME
The pandemic of COVID-19 is spreading rapidly every day. This disease has become a major threat to people"s lives as it often causes death. Therefore, we base our research on the prevention and detection of this disease in the field of work and the health sector.
In this section, we provide an overview of our proposal to achieve the previously presented goals. We start by defining the system model containing the elements of our solution, where we implement specific algorithms. Indeed, we present an intelligent solution for the detection of and prevention from coronavirus. Our proposed model consists of the following subsystems, illustrated in Fig. 1.
Our model is useful in buildings such as hospitals, clinics, and company headquarters. Indeed, we contribute the design of an intelligent system to detect and prevent COVID-19 based on the use of deep learning algorithms to classify people with and without mask, and an algorithm for non-contact temperature detection. Our solution is based on the extraction of significant face parameters such as eyes and nose, followed by the application of the CNN algorithm based on MobileNetV2 architecture. Then, to detect the temperature, we apply an algorithm that generates a thermal image and measures the temperature. After detecting an abnormal temperature value, we use an encryption algorithm to send the result to the hospital. These results are decrypted using an open-source application. Furthermore, to clean hands when entering the building, we use a system that allows the automatic contactless distribution of alcohol gel. Finally, for the automatic sterilization phase, we ensure our system is equipped with high quality cleaning products to sterilize the room every day and following the detection of abnormal temperature. Fig. 2 presents a flowchart of the COVID-19 detection and prevention process, beginning with the presence of a person. First, he/she must practice social distancing, which at minimum is equal to 1.5 meters. After that, she/he moves on to the next step of mask detection.
If the person is not wearing a mask or not covering their nose, an audible signal is sent to warn him to wear the mask correctly and repeat the test. Otherwise, he/she must leave. If the mask is worn correctly, the second step is processed to measure the temperature without contact. For this task, the thermal sensor will be triggered using an infrared sensor to measure the temperature.
In the event that this person has a body temperature above normal, the door remains closed and an audible signal informs this person to go to the waiting room for five minutes and then repeat a second temperature measurement test. For this duration of waiting, we used a timer which is triggered by a sensor after entering the waiting room. After the second test, if the person's temperature remains high, a signal is displayed informing them to exit and wait for the ambulance service. As soon as the sensor detects the exit of a person, an audible message informs the other persons to leave. After three minutes, the sterilization is triggered automatically using a cleaning product against the virus. However, if the personis wearing the mask correctly and the temperature does not exceed the normal degree, then the door opens and it goes to the gel-dispensing stage. For this step, if the sensor detects the presence of a hand at a distance of less than 7 cm, the gel is dispensed automatically. Otherwise, if the distance is greater than 7 cm, the system remains closed.

A. Mask Detection Algorithm
For our mask detection algorithm, we rely on MobileNetV2, which is a convolution optimization for convolutional neural networks. This small, low latency, low power model is adjusted to meet the resource constraints of a variety of use cases. MobileNetV2 is a highly efficient architecture that can be applied to embedded devices with limited computing capacity. Used for feature extraction, facial recognition, and object detection, it is based on separable indepth convolution as the base unit. This convolution has two layers: deep convolution and point convolution (1 * 1 convolution) [14].
An inverted residual structure is used to allow the network to calculate the activations (ReLU) more efficiently, and to retain more information after activation. These connections are between the bottleneck layers.
MobileNetV2 architecture contains the fully convolutional initial layer with 32 filters, followed by 19 bottleneck residual layers [15]. Algorithm 1 presents the steps of the proposed system.

Train the model
We use OpenCV (Open Source Computer Vision Library) to detect faces in an image [16]. This software is a very popular algorithm that is used to detect one or more faces in the image (Fig. 3). www.ijacsa.thesai.org

B. Fever Detection Module
For the detection of fever, we propose the temperature detection process following Algorithm 2.  The flowchart illustrated by Fig. 4 summarizes the mask and temperature detection. When the person wears the mask properly and his temperature does not exceed 38°C, the door opens automatically followed by the automatic alcohol geldispensing step to clean hands from viruses. Alternatively, if the sensor detects an abnormal temperature with a false mask port, then the door remains closed.

C. Automatic Gel Dispenser
For the gel dispenser, we use a specific sensor that measures the distance between a body and the used component. As presented above, if a person places their hand less than 7 cm in front of the sensor, the gel will be automatically dispensed without touching it. We use this contactless system to clean the person"s hands from viruses before entering the building to reduce the transmission of this epidemic.

D. Message-Sending System
For this task, after detecting the temperature using the thermal sensor and verifying that it exceeds normal temperature, a message is sent quickly to the hospital. This message contains the location of the company headquarters and the degree of detected abnormal temperature. To secure the sending of the message against malicious attacks, our system is based on the AES-CBC-256 algorithm. AES guarantees that sensitive data is only accessible for authorized users to read.

E. Automatic Sterilization System
To curb the spread of this epidemic, our system is based on high quality cleaning products. Therefore, the automatic sterilization system uses a water pump to dispense the cleaning products against the virus. The purpose of sterilization is to reduce the population of microorganisms, facilitate cleaning, protect personnel when handling instruments, and avoid contamination of the environment.

IV. EXPERIMENTS AND RESULTS
We describe in this section the detailed realization of our proposed system. Fig. 5 introduces the architecture of the detection and prevention system, subdivided into four subsystems. For the mask port and temperature detection system, we chose a Raspberry Pi 4 model b card. This card is equipped with a 1.5 GHz processor and 8 Go RAM. We chose a USB-type camera to allow better resolution of 8 megapixels for mask detection against a 5 megapixel camera. For www.ijacsa.thesai.org contactless fever detection, we chose MLX90614 thermal sensor for its advantages of low cost and small size. As previously described, when the system has checked that the person is wearing the mask correctly and his temperature does not exceed the normal degree, then the door opens, and an SG 90 servo motor is used to switch to the automatic gel distribution system. To this end, we have chosen the SG 90 servo motor as an ultrasonic sensor and an Arduino Nano board equipped with a microprocessor. For the detection of the body, we propose using ATMega328, and for the messagesending phase, we chose an Arduino mega 2560 card equipped with a microprocessor: ATMega2560 and a GSM SIM 800L V2 module. The GSM module SIM800L V2 starts and searches the network automatically, and has low energy consumption. It can be directly connected to Arduino which has 5V level [17]. If the module receives a signal via serial communication from the USB port with the Raspberry Pi, it sends directly to the hospital an encrypted message containing the location of the company headquarters and the abnormal temperature of the person.This encryption is determined by the AES algorithm. For the automatic sterilization system, we used a speaker, a mini water pump, an ultrasonic sensor, and an Arduino Nano board.
The experiments are conducted in the Anaconda environment (version 5.2.0) using Python language. The experimental configuration computer is an Intel i5-3317U processor at 1.70 GHz with 6 GB of RAM. We present in the following section the results of each module.

A. Mask Detection Camera 1) MobileNetV2implementation
: To develop the model, we must first import the required functions from the Keras ML library. Keras is a deep learning API written in Python. Keras enables rapid experimentation which is able to move from idea to result as quickly as possible. The basic data structures of Keras are layers and models [18]. All layers used in the MobileNetV2 model are implemented using Keras.
2) Database description: The dataset [19] consists of 3833 images in which 1915 images are people who are wearing face masks and the remaining1918 images are people who are not wearing face masks. This large number of images is used to train and test our algorithm to improve the performance of the model. Fig. 6 contains mainly a front face pose with different mask colors.
First, each image is converted from RGB (red, green, blue) to a grayscale image that contains a single-color channel (the "grayscale" of each pixel). The images are then resized to reduce the complexity and computational power of the MobileNetV2 model.
In this algorithm, we used the cv2.cvt Color function to convert the RGB image to grayscale, and the cv2.resize function to resize our image to the dimensions (img_size, img_size). Our img_size parameter was set to 224, so that each image becomes a 224*224 square image. The prepared image is added to the "data" list and the class label is added to the "labels" list. To optimize the training time and reduce the complexity of the model, we convert the "data" list into a more efficient NumPy array, and then we divide the array by 255, which normalizes the pixel range between 0 and 1. In the proposed model, we used TensorFlow to reshape the data (image) in data processing.
TensorFlow is an open-source interface developed by Google researchers to perform deep learning and other statistical and predictive analysis workloads. It is designed for running advanced analytics applications for users such as predictive modelers and data scientists [20,21].

3) Simulation results:
The evaluation of our proposal is based on different metrics, where the confusion matrix, the false positive (FP), the true positive (VP), and the true negative (TN) rates are calculated. Fig. 7 presents the confusion matrix. This matrix is in the form of a table which is often used to describe the performance of our classification model on the set of images with and without masks. Our algorithm detects with a true positive 1569 out of 1574 images with masks, and detects with a true negative 1569 out of 1574 images without masks. The first intuitive indicator of success is precision. It is the quantitative relationship between correctly predicted positive observations and total predicted positive observations [22].
The formula (1) is used to calculate the precision of our algorithm, where our method achieves an accuracy of up to 99.7%. Accuracy = TP + TN / TP + FP + FN + TN * 100 (1) Moreover, Recall or Sensitivity is the quantitative relationship of positive observations correctly predicted, or all observations within the actual class-yes [23]. It is calculated following Equation (2). Our model reaches a Recall equal to 99.68%.

Recall = TP / TP + FN * 100
(2) The F1 score (Equation (3)) is used to assess a two-class system. It is a method which combines the precision of the model and the recall rate. It is defined as the harmonic mean of the model accuracy and the recall rate, where the result retrieved from our model is. F1 score = 99.69%. F1 Score = 2*(Recall * Accuracy) / (Recall + Accuracy) (3) Fig. 8 illustrates the contrast between loss of training and corresponding validation to the dataset. One of the main reasons for obtaining this precision resides in Average Pooling [24].
A much higher number of neurons and filters can cause a decrease in performance. The optimized values of the filters and the size of the pool allow the main part (face) of the image to be filtered in order to detect the presence of a face.
The system is able to effectively detect faces which are partially obscured either with a mask, hair, or a hand. It considers the degree of occlusion over four regions -nose, mouth, chin, and eyesto differentiate an annotated mask from a face covered by a hand. MobileNetV2 works best for all types of masks, thereby introducing the effectiveness of the proposed model in detecting masked faces. We improve our model using the Adam optimizer. Table I illustrates the results of comparing different related work methods in terms of precision. The work presented in [12] used the Medical Masks Dataset (MMD). The authors of [11] obtained an average test precision equal to 81% using YOLO v2 with ResNet-50, where in [25] the authors use the CNN model, which achieves a validation precision of 96% for the detection of facial mask. In [26], the authors use Real-World Masked Face Recognition Dataset (RMFRD) in their work. They obtained a test accuracy equal to 97% using ResNet-50.
By analyzing the performance of MobileNetV2 in the management of all types of masks, we find that our model is the most efficient and fast, where it achieves a mask detection accuracy of 99.7% thanks to its optimized architecture that contains inverted residuals and linear bottlenecks. On the webcam stream (as shown in Fig. 9) of using the MobileNetV2, the classification results are displayed on a label above the visual rectangle.

B. Fever Detection Module
For fever detection, we used MLX90614 non-contact sensor [27]. This infrared (IR) temperature sensor can be used to measure the temperature of particular objects ranging from -70°C to 380°C. It includes two built-in devices: one is infrared thermopile detector (detection unit) and the other is DSP signal conditioning device (computing unit). The sensor uses IR rays to measure the temperature of the object without making any physical contact, and it communicates with the microcontroller using the I2C protocol. The sensor measures both the object temperature and the ambient temperature to calibrate the object temperature value. The detection results are shown in Fig. 10. As evident in this figure, if the infrared sensor detects the presence of the hand, then the MLX90614 will automatically measure the temperature and the result obtained below the visual rectangle. We conducted the test on 130 students from our school by using an IR thermometer with the MLX90614. Table II summarizes our assessment. The results show that there is an average difference between the two sensors of 2.5°C for measuring a person"s temperature. Our system only has two errors of incorrect temperature measurement. To conclude, our system helps us to reduce the spread of this pandemic.  Fig. 11 illustrates the functional prototype for the detection of mask wear and fever. 589 | P a g e www.ijacsa.thesai.org

C. Automatic Gel Dispenser
For this module, we used the ultrasonic sensor. We send a high pulse of 10μs to the trigger pin of the sensor. Then, this sensor sends a series of eight ultrasonic pulses at 40 KHz (inaudible to the human ear). The ultrasounds propagate in the air until touching an obstacle and then return in the other direction towards the sensor. After that the sensor detects the echo and triggers the measurement. Finally, the signal on the echo pin of the sensor remains high. This allows for the duration of the round trip of the ultrasound to be measured and thus the distance to be determined [28]. The Equation (4) calculates the distance. Distance = (pulse duration (in μs) / 2) / 29.1 (4) Using Proteus 8 Professional software, we obtained the results presented in Fig. 12. In fact, if the ultrasonic sensor detects the presence of a body, then the servo motor turns to distribute the alcohol gel.

D. Message-Sending System
After an abnormal temperature detection, the system sends a signal to the message-sending system via USB communication. This message is based on Arduino Mega 2560 board and GSM SIM 800LV2 module. If this signal is received, then the module has to send an encrypted message quickly to the hospital from the SIM card. This message contains the location of the company headquarters and the abnormal temperature level of the person.
For the decryption phase, we used an open-source application called CrypTool [29]. Its use is simple: when receiving the encrypted message, the receiver must put it in the field message encrypt with the secret code of 24 bit. Then, the message will be decrypted automatically after 1s.

E. Automatic Sterilization System
To reduce the transmission of COVID-19 [30], we have built a smart contactless system to automatically sterilize the room. In this regard, our system is based on ultrasonic sensor, water pump, speaker, push button, and Arduino Nano. Fig. 14 show the experimental results.
In fact, after that the ultrasonic sensor detects the exit of the person, the sound message will be triggered to inform other people to exit. After three minutes, the Arduino board will send a signal to the water pump to automatically dispense the cleaning product. For the sterilization phase each day, we have provided our system with a push button to control the start of cleaning product dispensing. www.ijacsa.thesai.org

V. CONCLUSION
In this article, we present an intelligent temperature and mask detection system. The main objective is to improve internal security against COVID-19 by ensuring a detection and prevention method.
To achieve this goal, we applied a deep convolutional neural network based on the MobileNetV2 architecture. We used a real database composed of masked and unmasked images. Moreover, we use AES-CBC-256 as the encryption protocol to ensure security and privacy information users. The MLX90614 is implemented as a contactless temperature detection sensor. The results show that by using OpenCV, Keras, and TensorFlow, our MobileNetV2 architecture operates with a maximum accuracy of 99.7% and a runtime of 1.53s. The maximum contactless temperature detection distance must not exceed 2cm.
For future work, we will improve our algorithm to detect false mask-wearing, to identify building personnel wearing their masks, and record their temperature every day.