## 3 Materials and Methods
### Mask Detection Module  
The second module of SSDWG is to detect the mask-wearing by people who are passing through it. We used five pre-trained deep learning models, which are VGG-16, MobileNetV2, Inception V3, ResNet-50, and Convolutional Neural Network (CNN), to detect a face mask wear in three classes: face with proper mask (FWPM), face with improper mask (FWIPM), and face without a mask (FWOM). Further, our proposed model identifies and classifies the types of face masks in two classes, which are N-95 and a surgical mask. We fine-tuned these five pre-trained models with transfer learning for training, which is much faster and easier than training a model from scratch with randomly initialized weights. In a similar way, the authors [13] used a deep neural network to analyze vibration signals that are caused by walking persons on the floor to detect the person localization in large buildings. We set the output layer of these models as non-trainable by freezing the weights and other trainable parameters in each layer to not be trained or updated when we feed our dataset. Further, we added an output layer to train on our dataset. This output layer would be the only trainable layer in our new model. We used the Adam optimizer with a learning rate of 0.0001, cross-entropy for our loss, and accuracy for our matrix. Figure 9 shows the architecture of the CNN model.  
The architecture of CNN consists of an input layer, an output layer, and multiple hidden layers. The hidden layers typically consist of convolutional layers, pooling layers, fully connected layers, and normalization layers (ReLU). This network's input is the images with face mask (proper and improper) and without a face mask  
Figure 8: MLX90614 contact-free temperature measuring sensor.  
Figure 9: Architecture of Convolutional Neural Network (CNN) model.  
and three RGB channels. The first layer is a convolutional layer with the Relu function, as shown in Equation (1), with a kernel size of 224 by 224 and 64 output channels.  
\[Relu(x)=max(0,x) \tag{1}\]  
Relu function returns 0 if it receives any negative input, but it returns that value for any positive value of \(x\). The next layer of the architecture is max pooling, which involves shrinking the image stack. To pool an image, the window size is defined as (112 \(\times\) 112, 64 output channels). The window is then filtered across the strides' appearance, with the max value being recorded for each window. With the max-pooling layer, we have a normalization layer that is known as the Rectified Linear Unit (Relu) process, which is shown in Equation (1), which changes all of the negative values within the filtered image to 0. This step is then repeated on all of the filtered images, and the Relu layer increases the non-linear properties of the model. On the third layer, the same as the first layer, we had a convolutional layer that process images with a kernel size of (56 \(\times\) 56) and process RGB to 256 output channels. There is also a pooling layer before the fully connected layer with the kernel size of 7 \(\times\) 7.  
We have a flattened layer with a fully connected layer with the softmax function shown in Equation (2).  
\[p_{i}=\frac{e^{x}i}{\sum_{j}e^{x}j} \tag{2}\]  
where \(x_{i}\) is the total input received by unit \(i\) and \(p_{i}\) is the prediction probability of the image belonging to class \(i\).  
In this layer, every value gets a vote to predict the class of image. The fully connected layers are often stacked together, with each intermediate layer voting on phantom hidden categories. In effect, each additional layer allows for the network to learn even more sophisticated combinations of features towards better decision making [35]. Finally, we have an output, which is a label of proper face mask, improper face mask, and without a face mask.