# Face Mask Detection on Photo and Real-Time Video Images Using Caffe-MobileNetV2 Transfer Learning
## 4 Materials and Methods  
The proposed methodology includes the CMNV2 model, which is used for photo images and real-time face mask detection on live webcam video streaming. The proposed CMNV2 method was created with the DNN architecture using TensorFlow, Keras, and OpenCV libraries to detect face masks in real-time. In the proposed model, two sets of files were used to explore the model architecture and store the weights for each layer. The first is the prototxt file, which contains the layer model architecture, and the second is the Caffe model, which stores the weights for each layer. An image may contain multiple objects, with non-linear boundaries between them. An activation function known as ReLU was used after each convolution layer to introduce non-linearity into the neural network. The ReLU function is linear for all positive values of the convolution layer output and zeroes for all negative values. After training the proposed model, this model was used for the classification of photos and real-time video images, as shown in the block diagram of Figure 6.  
Figure 5: Inverted Residual Block.  
The following steps describe the above block diagram of the proposed CMNV2 model.  
Step 1: In this work, a dataset of the joint photographic expert group (JPEG)/ portable network graphics (PNG) images of people's faces with and without masks was used.  
Step 2: The images were arranged in two folders, one with a mask and one without a mask. The images were then labeled using the graphical tool 'labeling'. Both the training and testing datasets for these labels contained label data for each image.  
Step 3: The data of a total of 1376 images were randomly split into training and testing each time, and stratification was used to determine the ratio of masked and unmasked data in the training and test data.  
Step 4: The collected images were mainly split into two categories. The first one of them is a training dataset consisting of \(1100\) images, representing 80% of the entire dataset. The second category is the testing data, which consists of the remaining 276 images, representing 20% of the total dataset.  
Step 5: After processing the training and testing data, various batches were used to determine the number of samples to process before updating the model.  
Step 6: The model training was used to run the algorithm on the input data and compare the processed results with the sample output, which is explained in Section 4.2.  
Step 7: After loading the modified MobileNetV2 and Caffe model, the proposed CMNV2 model was saved and later utilized for the testing dataset as explained in Section 4.3.  
Step 8: Testing the model output results with the display of photo and real-time videos images is explained in Section 4.4.  
[PERSON] created a dataset of 1376 images related to the artificial mask by adding facial masks to standard images of faces to categorize the class of masked images dataset. There are 690 images with masks and 686 images without masks among them. The 'Prajna Bhandary' dataset, which is available and taken from GitHub [46], contains images of people with and without masks. During the proposed methodology, we used an additional five of our own images, one with a mask and four without, to test the model's accuracy on the different datasets. The proposed research paper has a total data of 1381 images as shown in Figure 7.  
Figure 6: Block Diagram.