{'fraction_non_alphanumeric': 0.02767627554472865, 'fraction_numerical': 0.00933820544051969, 'mean_word_length': 4.895093737534903, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Convolutional Neural Network-enabled IoT framework to verify COVID-19 hygiene conditions and authorize access to facilities

COVID-19 has infected several million of individuals while claiming numerous lives. This fact raised the need to apply the measure to prevent its transmission. The use of disinfection products, wearing masks, and avoiding touching doors are important measures to avoid its spread. Thus, this work proposes a framework supported by a Convolutional Neural Network (CNN) model checking the hygienic conditions of the individuals requiring authorization to access facilities. The experimental work takes IoT devices with sensors to check: whether the users have disinfection product in their hands and a trained model to check whether individuals are also wearing masks. The achieved results highlighted the effectiveness of the proposed framework.


Introduction
COVID-19, a pandemic caused by the novel coronavirus chain SARS-CoV-2, has spread around the world, infecting several million individuals and claiming approximately 500,000 lives [1]. Most recovery plans to return to usual life boil down to testing populations to identify those who are infected and who have been vaccinated against the virus [2]. However, any test can have false-positive or false-negative results, making early detection of disease hindering

Introduction
COVID-19, a pandemic caused by the novel coronavirus chain SARS-CoV-2, has spread around the world, infecting several million individuals and claiming approximately 500,000 lives [1]. Most recovery plans to return to usual life boil down to testing populations to identify those who are infected and who have been vaccinated against the virus [2]. However, any test can have false-positive or false-negative results, making early detection of disease hindering and challenging society's progress toward normally [3,4]. Testing is essential, but it is necessary to combine this approach with technology that uses sensors to track anomalies and avoid further contamination of the environment [5,6]. In the face of a pandemic, time is of the essence, and researchers must find new ways to improve the diagnosis of the disease and monitor its progression [7].
WHO (World Health Organization) is encouraging governments around the world to ensure effective surveillance and identify infected persons to have control over the severity of the impact of the COVID-19 pandemic [8]. Internet of Things (IoT) can play a significant role in mitigating the effects of the COVID-19 outbreak and gradually provide a return to previous normality [9].
Due to these facts, governments have implemented many protection and safety measures, such as the mandatory wearing of inner masks, social distancing, isolation, self-isolation, and restrictions on citizens [10]. In addition, COVID-19 has brought daily lives to life as there are many changes in behaviors ranging from the workplace to social relationships, sports and leisure, habits and activities [11].
IoT represents a technological paradigm that includes a network of machines and devices that can efficiently interact with each other [12]. IoT has attracted a lot of attention in many industries worldwide and is expected to become an integral part of future technologies [13] due to to access to internet, hardware costs, and mass use of smartphones, wearables, and other "smart" products capable of collecting data [14,15,16]. IoT is a promising technology for interconnected computing devices that transmit data over a network without any human intervention [17]. Recently, IoT has attracted a lot of attention in the healthcare, and Public sector [18]. It is a hybrid of medical devices and software applications connected to healthcare IT systems [19].
Gheisari [20] discussed the role of wearable technology in the diagnosis and prevention of COVID-19. [21] presented a combined architecture of convolutional neural network (CNN) and recurrent neural network (RNN) to diagnose COVID-19 from chest X-rays.
Moshayedi et al. [22] have also applied a Raspberry Pi as a component of a SCADA Zonal based system for agricultural plant monitoring and in [23] they also discussed the pros and cons in the use of Deep Learning algorithms [23].
Due to limited healthcare infrastructures, monitoring COVID-19 is a global challenge. Thus, this work aims to contribute to avoid spread of Covid-19 to maintain safe environments by monitoring data from IoT sensors devices.

Proposed Framework
This work adopts the following three-tier architecture, where the key benefit of the three-tier architecture is that each layer can be independently developed by different teams and updated or extended as needed without impacting other layers, as each layer runs on its own infrastructure.
The architecture is divided into presentation layer, application layer and data layer. Firstly, the presentation layer provides the interface and communication capabilities supporting for end user interaction. Next, the application layer is the core of the framework. In this layer, the collected data by the presentation layer performs the business logic. Finally, the application layer is developed in Python and communicates with the data layer through API calls. The data layer, sometimes called the database layer, data access layer, or backend, is where the information processed by the framework is stored and managed. In that purpose Firebase was used.
In a three-tier application, all communication goes through the application layer. The presentation layer and the data layer cannot communicate directly with each other.
The intelligence capability of the proposed framework relies on a machine learning model supported by a CNN [24], as a class of feed-forward artificial neural network successfully applied in digital image processing and analysis. Thus, for face mask recognition, a model have been trained with a dataset with 3835 images, wherein 1916 of them are individuals wearing masks.
Over the years, CNNs have become a popular technique for computer vision image classification and have been used in healthcare. This shows that CNN is a reliable end-to-end automatic predictive deep learning model. Essentially, it automatically extracts "useful" features from provided inputs. A model using a CNN, in its simplest version, consists of three main layers: convolutional, clustering, and fully connected.
The convolutional layer extracts high-level features from the input data and passes them to the next layer in the form of feature maps. Pooling layer reduces the dimensionality of the data. The Clustering Layer receives each feature map output from the convolutional layer and prepares a condensed feature map. Finally, the Fully Connected Layer provides the classification capabilities. A probability score is computed for each class label by means of an activation function, commonly called a softmax function. In a deep neural network like CNN, there are many neurons, and based on the activation function, the neurons fire and the network moves forward. The activation function decides when the identified content is forwarded.
This framework includes the mean to quickly train the CNN. In that aim, data are prepared by cleaning, normalizing and processing to be taken as input to the CNN model providing the learning capabilities to the proposed framework. Next, fitting the matrix to the Keras API [25] is required. It expects each input to have 3 dimensions: one for rows, one for columns, and one for colors. This 3rd dimension is often used when dealing with color images including multiple color channels (e.g., RGB). However, since a monochrome image has been adopted, this third dimension included a single element. The next step is to create a CNN. The input CNN layer is followed by two hidden layers: a hidden dense layer and an output dense layer.
After the model being in place, it is trained for learning patterns from data according to a defined frequency (epochs). While CNN model learns, it makes mistakes. Every error (misprediction) causes penalties (or costs), which are reflected in the loss value for each epoch. In short, the model aims to achieve a low loss and the higher possible accuracy at the end of the last epoch. After the dataset being split into training and testing, a CNN model was trained from dataset. Finally, the trained model was used to take predictions. The flow of the proposed CNN algorithm is presented in Figure 1. Since the model have been trained, the berry Pi 3 includes a Pi Camera according to Figure 2. Regarding facial mask recognition, it occurs after five successful readings have been achieved for user wearing mask properly. Ideally, that number should be higher, but the OpenCV and Keras dependencies impacts the Raspberry Pi 3 performance and user experience will decrease as result of longer time computing the result. Therefore, this number avoids false positives on providing access to users to a room or closed environments. As mentioned before, the Raspberry Pi 3 is a digital device that will allow the MQ-3 Sensor to do digital and non-analogical gas readings [26]. This way, the MQ-3 Sensor does not read specific values of disinfection product, but it detects the levels of disinfection product in the user's hands. Therefore, the MQ-3 Sensor was integrated into the software. The library WiringPi offered the connections to the Raspberry Pi.
With this, testing and tuning sensors was started to detect the right level of disinfection product in hands. Unfortunately, sometimes it did not fulfill the imposed limit. In other words, hands are not properly disinfected. Therefore, both lights must be turned on to accomplish this request, which shows each case.
In the end, the control over the servo motor was integrated into the software. The presented research allowed to understand better how to use the Wiring Pi library to control the servo motor. The pin 18 (GPIO 24) of Raspberry Pi was used for the servo motor. Once this is a Pulse Width Modulation(PMW) exit, this generates analog signals in a digital device to allow the servo motor to move 90 degrees to make it look like the door opened.
A Firebase [27] database and an API, enabled by a Laravel framework were used. Firebase is an open-source NoSQL database to manage as a replacement for traditional relational databases providing storage capabilities to manage document-oriented data. NoSQL databases help to process large amounts of distributed data. The API for retrieving and processing data from the database uses Laravel [28], a PHP framework, and has become the standard server framework. It is specifically designed for building single-page, multipage hybrid web applications and is often used to make APIs because it facilitates the development of applications that can handle many types of requests. In this case, the API has a GET request that the frontend framework will call. Once called, they access Firebase and process the data based on the input and the specified request, then send it back to the application in JSON format for easy reading. In addition, it shows the mask validation and the date the door was opened.
The framework was deployed as software-as-a-service (SaaS), cloud and on-premises solution. This way, it can contribute to accelerate time to market and reduces costs for integrating new capabilities. It also increases its adoption from users by providing the flexibility.

Preliminary results and discussion
The proposed framework is a prototype for further developments. Thus, the experimental work was developed in Python and took for based on an OpenSource project [29], using OpenCV, and Keras detects in real-time face masks in users.
It also used some hardware components depicted in Figure 3, such as Raspberry Pi 3, Pi Camera, MQ-3 Sensor, Motor Sensor, Jumper Wires, and MicroSD Card. This proposed framework includes a Raspberry Pi 3 as the IoT device recognizing when users are wearing face masks. This hardware is more powerful in terms of computing and memory than other available hardware (e.g. Arduino Uno), while also providing similar features on integrating sensors [30].
The Pi camera [31] is the component able to capture video in real-time to check whether users are properly wearing masks. MQ-3 was used as one sensor is, indeed, sensitive to other gases besides disinfection product [32]. In this work, it was used to read the level of disinfection product in users hands to check whether they disinfected or not. In case both conditions have being met, wearing a face mask properly and disinfected hands, a servo engine opens the door (in angle of 90 degrees). The jumper wires connect the Raspberry Pi 3 pins to both MQ-3 Sensor and servo engine. The MicroSD Card contains the Raspbian OS on the Raspberry Pi 3 through the use of the official tool Raspberry Pi Imager.
The proposed framework allows the detection of the use of a facial mask, where the temperature is measured with the Raspberry Pi 3, and OpenCV [33] and Keras frameworks. It can be simultaneously used even if they are not requested would result in constant high levels of temperature, which will diminish the lifetime of the hardware.
When the user aims to have access to some spaces, such as rooms or other closed environments and set upfront a camera, different things can happen. The recognition of the mask in face may not be possible in case of low light conditions, compelling users to lookup for better luminosity conditions.
In case light conditions exist, the framework could lead to the readings of face mask recognition. After five correct readings in the validated conditions, the user will be approved to the next and final validation to check whether disinfection product in hands exists. In case conditions have been met, the door is opened for a few seconds and then closed again to check a new user.
Similarly to this work [21], we also have successfully applied a CNN to the context of COVID-19 pandemic although the different purpose.

Conclusions
The COVID-19 pandemic has dramatically affected every aspect of human lives. To prevent, mitigate, and recover from the consequences of disease transmission, work proposes a technological solution avoiding its spread by checking if the users gathers the hygienic conditions to have access facilities to keep a secure environment.
On that purpose, individuals look to a camera to check whether they are wearing masks, and if they have the adequate amount of disinfection product in their hands, values to be measured by sensors to check if the hands are correctly disinfected. In case these two conditions have been met the door will be opened. The preliminary results demonstrate that the proposed framework can effectively meet this purpose.