Multiple Linear Regression and Deep Learning in Body Temperature Detection and Mask Detection

Received July 28, 2021 Revised Aug 23, 2021 Accepted Dec 21, 2021 In the new normal era, many activities began to operate again, and people had to follow health protocols including wearing masks and checking the temperature. This study tested a tool in which artificial intelligence was embedded to help carry out health protocols. This tool connects RaspberryPi, Thermalcam, PiCamera, ultrasonic sensors with Multiple Linear Regression and DeepLearning algorithms. This tool aims to detect body temperature and use a mask. The system will check whether the person is wearing a mask or not, using the DeepLearning method. The system will check body temperature and the distance between humans and the tool, the data is entered in the regression formula to get more accurate results. The processed system results will be displayed on the monitor screen if detected using a mask and the normal temperature will be green, if it is detected as inappropriate it will be red and give a warning sound. The data is sent to the server and displayed via the web. We found that this tool succeeded in detecting body temperature with a distance of 1 to 3 meters with an average MSE temperature is 0.18, the reading accuracy using a mask is 94.71%, and the reading accuracy is not using a mask is 97.70%.


INTRODUCTION
Image processing in artificial intelligence (Artificial Intelligence) is a computer science that studies how to apply human vision to a computer system [1], intending to simplify and speed up human work [2]. The coronavirus outbreak has lasted more than a year to date (March 2021) [3] [4], and has claimed more than 2 million lives [5].
Coronavirus outbreaks can require humans to apply their intelligence to simplify and speed up human work [6], Coronavirus is a virus that can infect the respiratory system, inflammation of severe respiratory infections, such as pulmonary tuberculosis (TBC), pneumonia, Severe Acute Respiratory Syndrome (SARS) and Middle-East Respiratory Syndrome (MERS) [7] [5]. Coronavirus infection can be indicated by various symptoms, including flu, such as runny nose, headache, cough, sore throat, and fever or symptoms of severe respiratory tract infection, such as high fever with a temperature above 37 degrees Celsius, cough, shortness of breath and chest pain [8]. Under these symptoms, the coronavirus can easily spread through the nose or mouth of humans, when they cough, sneeze or even talk [9]. It is also possible for someone to become infected with COVID-19 when they accidentally inhale air from outside that carries the virus. Therefore, it is highly recommended to keep your distance, wear a mask, and wash your hands [10].
In this new normal era, many activities began to operate again, such as offices, malls, etc. This creates a potential mass crowd. The public must follow health protocols as recommended by the government, including wearing masks and checking the temperature to anticipate the spread of the coronavirus. Therefore, this study tested a tool in which image processing and artificial intelligence are embedded that can detect the use of masks, detect body temperature, and give warning sounds automatically, to help carry out health protocols according to government recommendations. This tool connects a Raspberry Pi, Thermal Camera (amg8833), Pi Camera, the ultrasonic sensor with Multiple Linear Regression and Deep Learning algorithms, is useful for reading accurate body temperature in the range of 1 to 3 meters, can detect the use of masks, and can provide warnings in the form of sound "use a mask" or "high body temperature" or "use a mask and high body temperature" automatically according to the reading of the device.

RESEARCH METHOD 2.1. Raspberry Pi
Raspberry Pi in previous research was used as a microcontroller that connects a camera and runs an image detection program, this research aims to access dangerous places or places that can only be accessed through small holes, the raspberry pi and camera are designed using wheels, becoming a robot a small car with communication via local wifi that can run and detect anything in the surrounding room using a camera and image processing, so people can check first using this robot before entering a room that is considered dangerous. Raspberry can also run a variety of programs including research programs, office, games, and as a media player to high-resolution video [11].

Thermal Camera
Thermal camera amg8833 in previous research is connected using an atmega328 microcontroller used to detect animals, this tool aims to realize the search and rescue of small animals in urban areas and indoor animal monitoring functions using temperature detection. The advantages of the amg8833 device are small size, low power consumption, low cost, wireless communication, and portability. This temperature detector is the latest generation 8x8 thermal infrared sensor from Panasonic, its performance is higher than its predecessor. The sensor only supports I2C and has a configurable interrupt pin that fires when each pixel is higher or lower than a preset threshold [12].

Ultrasonic Sensor
The ultrasonic sensor in the previous study was connected using a raspberry pi, used for automatic measurement of corn plant height and monitoring the growth of corn, whether it was healthy or there was a problem, so that preventive measures could be taken more quickly and precisely. The ultrasonic sensor detects the distance using ultrasonic waves at a frequency of 40Hz from the transmitter and the receiver will wait for the wave to return, after the wave is returned from the reflection by any object, generate the required time and convert it to distance [13].

Thermogun
The thermogun in previous studies was used as a comparison between the amg8833 and mlx906144 sensors to detect the non-contact temperature in animals, while the thermogun itself is a precision tool but requires direct contact with animals and cannot be calibrated, while the amg8833 and mlx906144 which allow non-contact temperature detection. [14].

Pi Camera
The Pi camera in previous studies was used to analyze variations in the length of transistors, microlens optical systems, and photodiodes. The purpose of using these measurements is to show irregularities at the microscopic level and relate them to signal variations measured as pixel nonuniformities used for the unique identification of discrete image sensors. The pi camera's sensor has a high quality 8 megapixels specially designed for the Raspberry Pi and features a fixed focus lens [15].

Multiple Linear Regression
In this study, the multiple linear regression method was used to improve the accuracy of the thermal camera sensor readings. Later this method will be tested using 6 different people, each person is taken 20 data, with a total of 120 test data from 6 people. Linear regression is a method of modeling the relationship between the dependent variable Y and one or more independent variables called X. One of the uses of linear regression is to make predictions based on previously available data. The relationship between these variables is called a linear regression model. Based on the use of independent variables, linear regression is divided into two categories, namely linear regression and multiple linear regression [16]. To use this method, the researcher uses 2 independent variables, namely temperature data from thermal cam sensor readings and distance data from ultrasonic sensor readings, and then uses 1 related variable, namely temperature data generated using a thermogenic. This data collection takes approximately 1 week, the data collection process is carried out randomly on 10 different people, each person is taken 45 data for each variable, the first variable (ultrasonic sensor) the data obtained, namely the distance data of the device on people are taken one by one with a distance range from 50 cm to 300 cm ( Fig. 1), the second variable (thermal cam) data obtained is the temperature reading data that is still not accurate, data collection according to the distance specified in the first data collection, and the third variable using a thermogenic, a tool that can check body temperature by shooting at body parts, the data obtained is accurate temperature data, data collection according to the distance specified in the first data collection (Fig. 2). After the data is collected, the data is processed using this method and will produce the formula Y = a + b1x1 + b2x2 which is expected to improve the accuracy of thermal camera readings.  Figure 1 is the process of taking body temperature data which is a related variable, using a thermogenic tool, the tool will shoot at the body with a distance range of 50 cm to 300 cm.  Figure 2 is the process of taking distance data using an ultrasonic sensor and body temperature data using a thermal camera sensor, both data are independent variables. The data collection was carried out simultaneously, first, the tool will check the distance and then check the body temperature with a distance range of 50 cm to 300 cm. Deep learning in previous studies was used as a method for processing and detecting sound, the sound being processed is the Arabic alphabet pronunciation classification which requires high accuracy in learning to read the Qur'an. Thus, techniques for processing pronunciation and training from processed data require a special approach. To solve this problem, a padding-based method and a deep learning convolution neural network are proposed to evaluate the pronunciation of the Arabic alphabet. Voice data from six school children were recorded and used to test the performance of the proposed method. The results also show that the proposed method can distinguish Arabic letters that are difficult to pronounce. Deep Learning is a branch of machine learning consisting of advanced abstract data modeling algorithms that use a set of hierarchical and deeply distributed non-linear transformation functions to process data. Techniques and algorithms in deep learning can be used for supervised learning, unsupervised learning, and semi-supervised learning in various applications, such as image recognition, speech recognition, text classification, etc. The deep learning model used is based on an artificial neural network using a hard library and scikit-learn for mask detection [17].

Deep Learning
To use this method, researchers collect data on images of people using masks and images of people not wearing masks, this data collection takes approximately 1 week. Researchers collected image data from google search results, obtained as many as 686 images of people not wearing masks and 690 images of people using masks, because images of people using masks are not widely available on Google, the researchers edited the image by adding or closing the face image with a mask image. Before processing the image using this method, the face is labeled or boxed and labeled "no mask" or "with mask" first to notify the computer that will study the image that the image has "no mask" or "with mask" information. After all have new labels, enter the deep learning method to process images, the data is divided into 3 parts, namely train, test, and testing data with a ratio of 6:1 for train and test and the rest is for testing, for example in image data using masks there are 690 data, divided into three parts into 500 train data, 100 test data, and 90 testing data. Here's a deep learning model diagram. (Fig. 3).

Tool workflow
In figure 4 explains the workflow of the temperature detection and mask detection tool, first turn on the tool, the second tool will display the camera and thermal camera readings on the monitor or tv screen, the three tools immediately check whether there are people and the person is wearing a mask or not, fourth, after being detected, it just enters the measurement of the distance between the person and the tool using an ultrasonic sensor, the fifth measures the person's body temperature using a thermal cam amg8833, the sixth the distance and temperature reading data enters the multiple linear regression formula to get the calibration results or the expected temperature readings, seventh, if a temperature <38 degrees Celsius is detected and it is detected using a mask, the display shown is green, while if it does not match it will be displayed in red and a warning will be given in the form of a sound "use a mask" or "high body temperature" or "use a mask and body temperature" height" automatically according to the reader and tools. The eight data are sent to firebase and the data is displayed using the web. are used to providing an audible warning. Furthermore, connecting a monitor or tv is useful for displaying the results of temperature detection and mask detection readings, firebase is used to store data, and is displayed using the web.   Figure 7 on the left is a reading from an 8x8 pixel thermal camera sensor that has been bicubic interpolated, bicubic interpolation is useful for smoothing the detection color obtained from bilinear interpolation or nearest-neighbor interpolation, and then the color format is changed to the inferno which means it is getting yellower the reading is getting hotter and vice versa, the bluer the reading is, the colder the temperature detected. The right side is the reading from the pi camera sensor which is connected to the deep learning method, the meaning of the green box is that an object is detected by a person using a mask, and if the color changes to red, it means that the object is detected not using a mask.   Figure 9 is an image of the reading of the tool when the object of the person is not facing the camera, when the object of the person is not facing the camera the tool can still detect that the person is wearing a mask or not.  Figure 10 is an image of the reading of the tool when people cover part of their face using their hands, as if they were wearing a mask, but the tool can detect that the object is not wearing a mask.  Figure 8 is the result of reading data that is displayed using the web, the data displayed is temperature hazard level data, temperature data that has been calibrated, original temperature data of the tool, mask usage data, distance data, and date data when detecting. The data displayed on the web allows it to be big data for clustering, classification, etc.

Testing
The test was carried out using 6 different people, each person taking 20 temperature data, 20 distance data, 20 data using masks, and 20 data not using masks. In the data collection process, everyone does not only stand straight, but goes back and forth, head tilted, people who move a lot, and lighting is influential. Figure 13 is the first person sample, comparing the temperature of the regression results and the actual temperature with different distances, the green color is the regression temperature graph and the blue color is the actual temperature graph. The diagram shows the difference and after calculating this chart has an MSE (Mean Squared Error) of 0.12.  In table 1 shows the average results from the first person to the 6th person, it can be concluded that the average MSE temperature is 0.18, the average reading accuracy using a mask is 94.71, and the average reading accuracy is not using a mask is 97.70.  Figure 14 is the average accuracy of reading masks from the first person to the sixth person, the green color is the accuracy of reading using a mask and the blue color is the accuracy of reading not using a mask.  Figure 15 is the average MSE temperature, from the first person to the sixth person there is no significant difference, the highest difference is only 0.1, the average MSE temperature is 0.18.

DISCUSSION
A body temperature detection tool and detection of the use of masks using multiple linear regression methods and deep learning methods. This tool has advantages when compared to temperature detection tools at airports, namely, it can detect the use of masks, can give a warning sound, and has an affordable price or a much cheaper price, so other researchers or the public can easily duplicate this tool. or build and redevelop this tool, then when compared to temperature detection in the mall which must stand at a specified distance, this tool has the advantage that it does not have to stand at the same distance, but can stand anywhere with a maximum distance of 3 meters. For the drawbacks of this tool, namely hardware limitations, this tool takes 2 to 3 seconds to detect until the results and warning sounds, the tool can process faster if using hardware that has high specifications, cannot detect 2 objects of different people or more, if there are 2 people objects in the frame then the tool will read the highest temperature in the frame, the tool requires sufficient lighting to detect the use of a mask, if the light is low or very dim it will greatly affect the accuracy of detection. This tool uses a raspberry pi and connects 3 sensors including a thermal camera sensor (amg8833) to detect body temperature, an ultrasonic sensor to determine the distance of the tool to objects (people), and a pi camera sensor to capture images of people to be detected using the deep learning method. whether the person is wearing a mask or not. However, the readings from the thermal camera sensor are still far from expected, this sensor has a reading difference with the thermogenic 8˚C to 10˚C which means it is very far from what is expected, this sensor also has a drawback that it can only read 8x8 pixels, can read up to a distance of 7 meters but even at close range, the tool is not accurate, in fact, this sensor is not specifically designed to read the temperature of the human body, but this sensor is used on air conditioners to detect room temperature, why researchers use this sensor because the price is not too expensive and can it develop into a body temperature detection device at an affordable price. Therefore, the researchers used multiple linear regression to calibrate the readings from the thermal camera sensor. To perform calibration using multiple linear regression it takes 2 independent variables (X) and 1 related variable (Y), the first independent variable is distance data from ultrasonic sensor readings, but the distance sensor used has measurement limitations, only accurate in the range 1 to 3 meters, and this sensor can read the distance of any object in front of it, the second independent variable is data body temperature from the thermal camera sensor readings, and the related variable is body temperature reading data using a thermogenic. After the data is processed using the multiple linear regression method produces a value, b1 value, and b2 value. Where the value of a = 26.83741554, the value of b1 = -0.00966282 and the value of b2 = 0.324591334. The multiple linear regression equation is Y = a + b1x1 + b2x2. After getting the value of the constant (a) and the value of the regression coefficient (b), so that the multiple linear regression equation becomes: Y = 26.83741554 + -0.00966282*X1 + 0.324591334*X2 + e. changes, then the temperature reading (Y) is 26.83741554, the value of e changes according to the distance value.
The tool will start doing calculations if there is a person object in front of it, the tool will detect whether the person is wearing a mask or not, then enter the multiple linear regression calculation. After the tool can detect body temperature with the expected accuracy and can detect the use of masks, the tool will provide a safety warning in the form of a green display if the body temperature is below the high-temperature range of <38˚C and is detected using a mask, if the tool detects it is not as expected then will give a red display warning and a warning sound "use a mask" or "high body temperature" or "use a mask and high body temperature" automatically according to the reading of the tool, the data is displayed directly using the monitor then the data is sent to the server (firebase) and displayed using the web, the data sent to the server allows it to be reprocessed if it is worthy of being a big data or early warning. Suggestions from researchers to speed up readings using a raspberry pi with 8Gb of ram [19], because the ram currently used is only 2Gb of ram, using a more precise thermal sensor with pixels much larger than 8 x 8, the researcher suggests using a thermal camera sensor ( mlx90640) with 32 x 24 pixels much larger than those used today or using a thermal sensor that has higher specifications, using a camera with a higher resolution and can adjust lighting or can detect in the dark, researchers suggest using a raspberry pi sensor camera night (ov5647) which is a camera that can be used when it is dark.

CONCLUSION
Makers of tools that can detect people who wear masks or not automatically have been able to detect automatically, with an accuracy of reading people using masks 94.71%, and reading people not wearing masks with an accuracy of 97.7%. Improved accuracy of temperature readings has improved, being accurate in the range of 1 to 3 meters with an average MSE temperature of 0.18. The tool can automatically give voice warnings with sounds emitted "use a mask", "high body temperature", and "use a mask and high body temperature".