DEEP LEARNING BASED MASK DETECTION IN SMART HOME ENTRIES DURING THE EPIDEMIC PROCESS

: In this study, "smart home" systems were designed against Covid-19 virus, which negatively affects life all over the world, and viruses that may become epidemics later. Our homes need to be more hygienic and safe than yesterday. One of these hygiene rules is the masks that cover our nose and mouth. It is very important to use a mask to prevent further spread of the virus. Whether or not the people in smart homes are wearing masks at home will be diagnosed with the deep learning method. Hosts will be warned if they do not have masks. Brightness level control card and illuminator have been added to smart home entrances to better identify people's faces. With PID, the illumination level is fixed at the desired value, and with IOT technology, people can follow the illumination level at the smart home entrance from the mobile application. recording on the studies and developed deep learning systems. Systems operating with such accuracy rates


INTRODUCTION
It is observed that smart home technology, which entered our lives together in the 1980s, reached a large audience in a short time and with rapid acceleration with the opportunities it offers. Every individual wants to make their life easier and therefore the demand for developing technology is increasing. The developing technology and industry offers us new opportunities every day. Technologies that make life easier have penetrated even our most private spaces, homes. With smart home technology, it is now possible for us to do the work that needs to be done at home without leaving our place. At the same time, although we are far from home, the temperature, light, etc. in the house. By observing the parameters, the desired environment is created by intervening in these parameters through technologies such as Wi-Fi and Bluetoot (İNAL, Kamil;AKCAYOL 2009;Kuncan and Çaça 2019;TASTAN 2019)In addition, there are systems that can inform us of any negative situation that may occur in the rooms of the house while we are not at home. This system is a mobile service robot that travels around the house in times of electrical failure or when there is no home electricity. It provides informing the landlord via text message by visiting all the rooms for any problems that may occur in the house(Güven and Acı 2019).
Malware can infiltrate almost any device. There are also software developed against such attacks. The person or opinions that develops the malware has increased noticeably lately. Thanks to a mobile application developed, it has been observed that the instant information of the devices connected to the internet network is transferred to an external hardware by infiltrating the internet network at home without the knowledge of the user. With the occurrence of this leak, it has been determined that the security cameras in your house serve other people (Sivaraman et al. 2016). Necessary studies are also carried out to prevent attacks by malicious people. It has been observed that a security measure has been taken by using the Elliptic Curve Cryptography method in order to protect the network security and prevent cyber attacks on smart homes (Santoso and Vun 2015).
There are multiple classes under the title of artificial intelligence. One of these classes is deep learning. Deep learning class of artificial intelligence will be used in this study. Deep learning is a system with inputs and outputs like all artificial intelligence systems. The most important feature that distinguishes deep learning from other classes is the difference in the number of layers in between. Data entering from the input layer enters the hidden layers and from there it travels to the output layers. Each hidden layer is the output of the previous one (Şeker, Diri, and Balık 2017). The reason for the high accuracy rates of deep learning systems is the number of hidden layers with appropriate competence. The structure of Deep Learning is shown in figure 1.1. We should be prepared to encounter deep learning in many areas that touch our lives. Deep learning, which is a subclass of artificial intelligence, is used in different studies such as required person safety and increasing production speed. In order to ensure our security, face recognition systems have had to touch our lives. Face recognition accuracy rate reaches 92.1% in a real-world video recording on the studies and developed deep learning systems. Systems operating with such accuracy rates can offer us a safer environment (Ya et al. 2017). In addition, deep learning, which touches our lives from different areas, this time appears with the license plate recognition system with deep learning using the mask regional convolutional neural network model. With this system, vehicle owners who are searched by authorized persons can be found easily. Within this system, the rate of correctly identifying the license plates of vehicles is 98.46% (Bayram 2019). At the same time, we can perceive the mood of a friend, by looking at the face of your spouse or friend. Deep learning can also do this. In real time, it can identify the state of a person or people using mimics on their faces(Salur and Aydın 2018).

Materials to be Used in Preparing the Light Level Required for Mask Detection
Just as we humans cannot recognize the people in front of us in the dark, they will not be able to perform face recognition in places where there is not enough light on the cameras. Since we know and foresee this, it is aimed to increase the accuracy and stability level of the thesis study. With deep learning, the face recognition process of people entering or leaving home by keeping the brightness level of the areas where face recognition will be made will be easier. Esp8266 NodeMCU, GY-30-

Materials to be Used for Mask Detection
During the Covid-19 outbreak, masks are detected, ensuring the health and comfort of smart home residents. With this control measure, it is predicted that people will find a little more peace at home. With the camera to be placed at the entrances of the smart houses, it will be diagnosed whether it is masked or not. The environment required for diagnosis is very important. Just as people cannot distinguish who is coming in the dark, cameras are not expected to detect people or objects where the light intensity is poor. Object or person detection should be considered at the lighting level of the environment. If the environment is not sufficiently illuminated, the accuracy and stability percentage of the system will be low. This should be paid attention to. Mini pc, GTX 1050Ti Video Card, 450 Watt Power Supply, Video Card Slot, Camera, Monitor, Mouse and Keyboard were used for this diagnosis. The materials used are given in Figure 2.2.

PID
Each of the Proportional, Integral and Derivative gains that form the basis of the PID system affect the system separately.
Although the proportional controller contributes downward to the rise time, it has no effect on the continuous regime error. Integral controller; It resolves the regime error but distorts the transient regime response(ÇEVEN and ALBAYRAK 2020). If it is a derivative controller; It increases the stability of the system, reduces overshoot and positively contributes to the transient response. These controllers that act on closed loop are represented by coefficients. These coefficients are symbolized as Kp, Kd, Ki. As can be seen in the block diagram of the PID system in Figure 2.3, it consists of Proportional Gain, Derivative and Integral circuits.
The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLIV-4/W3-2020, 2020 5th International Conference on Smart City Applications, 7-8 October 2020, Virtual Safranbolu, Turkey (online) The error value is the difference between the input value and the time-varying feedback value..
Controllers in the PID system, which are frequently used in industrial areas, should answer many problems. It is for this reason that many efforts have been made and different methods have been found. The most widely used method in the implementation of PID systems is the Ziegler and Nichols method. In this thesis, Ziegler and Nichols method is used.

Ziegler ve Nichols Yöntemi
Discovered by two engineers John Ziegler and Nathaniel Nichols in 1942, this method is still used today. Due to the underlying difficulty of finding the transfer function of many systems, researchers or practitioners have tended to find the most stable Kp, Kd, Ki controller coefficients by trial method. For this reason, this method continues its usefulness with basic or minor changes(Coşkun and Terzioğlu 2011).

Methods Used for Mask Detection
In this study, SSD (Single Shot MultiBox Detector) is used as a deep learning method. It is preferred in object detection because it is faster than other algorithms such as SSD, Faster R-CNN, R-FCN. Although SSD has an algorithm that has difficulties in recognizing small objects, it is preferred because of its high speed(BAŞESKİ 2018). The SSD uses the VGG16 architecture found in its original article. SSD architecture is given in figure  2.4. The first network layers are based on a standard VGG16 architecture used for high detection quality. Although the input layer shown in Figure 2.4 is specified as 300x300, the desired input sizes can be selected in the SSD method. That's why there is also a 512x512 version. Structures that help detection have been added to the SSD. These structures are the Conv4_3 layers in 38x38x512 size after the VGG16 architecture and the Conv6-Conv7 layers in 19x19x1024 size right behind them. The additional convolution layers shown in Figure 2.4 again and represented by arrows coming out of the layers transmit us to the NMS layer where the object to be detected is and where it is decided. At the end of this process, the decision emerges (Ma et al. 2018).
In addition, SSD offers an algorithm that significantly reduces the image data it has and detects objects by going to the summary from the general lines of the image and minimizing the use of filters. It gives high accuracy results by using every data in the presented image effectively. It gives more reliable results compared to the geographic transformation method, which is the deep learning method used in the past (Liu et al. 2016). Even if a small region of the object to be detected is visible, the SSD can detect the object. While doing this, it also uses the sliding window method as it does the convolution and pooling method and uses the part of the receiver areas behind the filter as a search window(BAŞARIR 2019).
It is not known what the object to be detected is or where it is in the field of view. These requested data are tried to be found by using the filters found from the data during the training of the SSD and the necessary structures from the SSD's own architecture. It may take a long time to train algorithms such as SSD and to create the data set. These times are so long that sometimes you may have to use your computer only for these trainings. These trainings require high power graphics cards. Again, these trainings take days with high power graphics cards..

EXPERIMENTAL RESULT
In this study, the entrance door of the house was chosen for the experiments. A camera and a system that adjusts the light level of the environment are installed at the entrance door of the house. Experimental studies were carried out in different light levels of the area at the entrance of the house. Two people were assigned for the experimental studies that continued at certain times of the day. As it is known, we cover our head, face, hands and neck with various accessories in order to maintain our body temperature and not to get sick during the winter months. Therefore, the closed areas make it difficult to detect the face with the help of the camera. Accordingly, ten different experimental types were determined in the tests, with clothes suitable for summer and winter environments. The accuracy and stability of the real-time system were tested with the specified test types. In addition, since the types and colors of masks to be used by people may vary, four different mask colors and two types of masks have been tried in experimental studies. Precision-Recall (PR) curve was used to determine the accuracy of experimental studies. There are two determinations in this study. These detections are face and mask detections. The results obtained from this method are given in Figure 3.1. Looking at the graphic in Figure 3.1, 89.6% success in face detection and 91.9% success in mask detection is seen.

Figure 3.1 Precision-Recall Results Graphic
The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLIV-4/W3-2020, 2020 5th International Conference on Smart City Applications, 7-8 October 2020, Virtual Safranbolu, Turkey (online) Test faces are given in Figure 3.2.

Figure 3.2. Test Faces
High accuracy was found in the test results of the specified test types performed at certain times of the day. Confidence in the system has increased in experiments with different seasonal clothing and objects that make the detection of face and mask difficult. Examples from experimental studies are given in Figure 3.3.

Figure 3.3. Experimental Study Examples
In addition, the circuit drawing of Proteus, which is the control card of the ambient lighting level, is shown in Figure 3.4. Located at the entrance of smart homes, this system eliminates the inability to recognize the mask due to insufficient lighting level. At the same time, the lighting level information is transmitted instantly via the mobile application so that the smart home owners can follow it. The main screen written for the mobile application is given in figure 3.5.

EVALUATİON AND RESULTS
During the Covid-19 outbreak, the scientific world announced that our homes are the safest place. Authorities stated that they should stay at home on every platform and should not leave the houses unless necessary. When we stay at homes during this epidemic, it is aimed to bring human health together with technology by making homes even safer. In the process of combating Covid-19, it was planned to combat the epidemic by developing smart home technology.
As a result of the experiments, a new one has been added to the measures to be taken from the Covid-19 outbreak of smart home residents. With this importance, it was made with the mask diagnosis of guests or family members who came to their The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLIV-4/W3-2020, 2020 5th International Conference on Smart City Applications, 7-8 October 2020, Virtual Safranbolu, Turkey (online) homes. The reliability of the system has been tested using different mask types, colors and different seasonal clothing. If those who do not have masks or if they are used incorrectly, the landlord was warned and these people were prevented from entering the house. Since the use of masks prevents the spread of the virus, people at home have been safer with this system.
This study is designed to work in coordination with smart home systems easily. By entering the modem, which is the emitter organ of the internet to which smart home systems are connected, the brightness level control of the smart home entrances can be followed. On the other hand, mask detection can be performed by installing the necessary software on any computer in the smart home.