{'fraction_non_alphanumeric': 0.025024236548715464, 'fraction_numerical': 0.00672564226854096, 'mean_word_length': 4.534875922199866, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
COVID Safety Measures Alert System

: The corona virus COVID-19 pandemic is causing a global health crisis so the effective protection method is wearing a face mask and maintaining social distance in public areas according to the World Health Organization (WHO). The COVID-19 pandemic forced governments across the world to impose lockdowns to prevent virus transmissions. Reports Indicate that wearing facemasks and maintaining social distance while at work clearly reduces the risk of transmission. An efficient and economic approach of using AI to create a safe environment in a manufacturing setup. So we are doing a Project on detecting whether a person wears a mask or not, also giving an alert message to the person to wear a mask, and maintain social distance or not. A hybrid model using deep and classical machine learning for face mask detection will be presented for face mask detection, a face recognition model is used to identify faces and an object detection algorithm is used to identify persons and also calculate social distance between each other. We collected face mask detection dataset consisting of mask and without mask images, and person photos to identify the person. We are going to use OpenCV to do real-time face detection from a live stream via our webcam. We will use the dataset to build a COVID-19 face mask detector with computer vision using Python, OpenCV, and TensorFlow and Keras, use a face recognition module to identify faces and a YOLO algorithm to detect objects and calculate social distance. Our goal is to identify whether the person on a video stream is wearing a face mask or not, if not give an alert message to wear a mask and check for social distance between each other with the help of computer


I. INTRODUCTION
The basic aim of the project is to detect the presence of a face mask on human faces on live streaming video and if a person is not wearing a mask then an alert message is generated saying "wear your mask" with the person's name and checks for social distance if there are more than one person. For face mask detection we have used TensorFlow, Keras API's and mobilenetv2 model. In this we train the system with mask and without mask image datasets. Then we will identify human faces, find ROI and give output as mask or no mask based on streaming image. For face recognition, we encode the faces using the face recognition module and identify a few face locations to recognize a person. Then we check for a match of streaming images with the images in the database. If found then gives an alert message with name or else alert message. In this project, we develop a generic Deep Neural Network-Based model for automated people detection, tracking, and inter-people distances estimation in the crowd, in a live streaming video. We use centroid identification techniques to identify the centroid of a person. If the distance between the centroids of any two persons is less than the minimum distance then a red box is indicated around the person. In this way, the covid safety measures alert system is developed.

II. PROBLEM DEFINITION A. Existing System
After the breakout of the worldwide pandemic COVID-19, there arises a severe need for protection mechanisms, face masks, and social distancing being the primary ones.But there is no proper system to monitor people in public places and check whether people are wearing masks or not. So there are workers to monitor people in public places whether they are taking safety measures or not. Here there is more chance of getting covid for people who are working to monitor people. Also some people may not be monitored properly if there is a huge crowd. So, to avoid all these problems we need an automated system to monitor people in public places and tell them to maintain safety measures.
B. Problems in Existing System 1) Difficult to identify each and every person if there is a huge crowd (some persons may miss).
2) It takes more time than proposed system to identify persons without mask in huge crowd 3) Needs more manual power, concentration and attention.

C. Proposed System
The basic aim of the project is to detect the presence of a face mask on human faces on live streaming video and if a person is not wearing a mask then an alert message is generated saying "wear your mask" with the person's name and checks for social distance if there are more than one person. For face mask detection we have used TensorFlow, Keras API's and mobilenetv2 model. In this we train the system with mask and without mask image datasets. Then we will identify human faces, find ROI and give output as mask or no mask based on streaming image. For face recognition, we encode the faces using the face recognition module and identify a few face locations to recognize a person. Then we check for a match of streaming images with the images in the database. If found then gives an alert message with name or else alert message. In this project, we develop a generic Deep Neural Network-Based model for automated people detection, tracking, and inter-people distances estimation in the crowd, in a live streaming video. We use centroid identification techniques to identify the centroid of a person. If the distance between the centroids of any two persons is less than the minimum distance then a red box is indicated around the person. In this way, the covid safety measures alert system is developed.

D. Advantages in Proposed System
1) Used to detect face masks and social distance automatically.
2) Can give instant alert messages to wear a mask by voicing their names.
3) Less processing time 4) Has better accuracy than manual checking. 5) We can reduce the spread of covid 19 by identifying people without masks, no social distance and suggesting them to wear masks and maintain social distance.

III. PROBLEM SOLUTION
This project is done in three steps where each step has a certain methodology. The steps and methodologies in this project are A. Face Mask Detection 1) Data at Source: The majority of the images were augmented by OpenCV. The set of images were already labeled "mask" and "no mask". The images that were present were of different sizes and resolutions, probably extracted from different sources or from machines (cameras) of different resolutions.
2) Data Preprocessing: Preprocessing steps as mentioned below were applied to all the raw input images to convert them into clean versions, which could be fed to a neural network machine learning model. a) Resizing the input image (256 x 256) b) Applying the color filtering (RGB) over the channels (Our model MobileNetV2 supports 2D 3 channel image) c) Scaling / Normalizing images using the standard means of keras build in weights d) Center cropping the image with the pixel value of 224x224x3 5.Finally Converting them into tensors (Similar to NumPy array) .

3) Approach:
In this project we will load the data set and train face mask classifiers with tensorflow and keras. Then we will serialize the face mask on the disk in step 1.Now in step2 we will load our face mask classifier into the disk and detect faces in video. Next extract each region of interest ROI(from nose to chin). Apply a face mask classifier to each ROI to determine with mask or without mask. Finally show the result. The final layer softmax function gives the result of two probabilities each one represents the classification of"mask" or "not mask".

5) Apply mask detector over live video stream
The flow to identify the person in the webcam wearing the face mask or not. The process is two-fold.

1) To Identify the Faces in the Webcam:
To identify the faces a pre-trained model provided by the OpenCV framework was used.
2) Classify the Faces Based on the Mask: Our work on facemask detection comprises data collection to tackle the variance in kinds of face masks worn by the workers. The face mask detection model is a combination of a face detection model to identify the existing faces from camera feeds and then running those faces through a mask detection model. 3) Approach: Neural networks are gaining much more attention in many pattern recognition problems, such as OCR, object recognition, and autonomous robot driving. Since face detection can be treated as a two class pattern recognition problem, various neural network algorithms have been proposed. The advantage of using neural networks for face detection is the feasibility of training a system to capture the complex class conditional density of face patterns. However, one demerit is that the network architecture has to be extensively tuned (number of layers, number of nodes, learning rates, etc.) to get exceptional performance. In the early days most hierarchical neural networks were proposed by Agui et al.. The first stage has two parallel subnetworks in which the inputs are filtered intensity values from an original image. The inputs to the second stage network consist of the outputs from the sub networks and extracted feature values. An output at the second stage shows the presence of a face in the inputregion.Propp and Samal developed one of the earliest neural networks for face detection . Their network consists of four layers with 1,024 input units, 256 units in the first hidden layer, eight units in the second hidden layer, and two output units.Feraud and Bernier presented a detection method using auto associative neural networks. The idea is based on which shows an auto associative network with five layers is able to perform a nonlinear principal component analysis. One auto associative network is used to detect frontal view faces and another one is used to detect faces turned up to 60 degrees to the left and right of the frontal view. After that Lin et al. presented a face detection system using probabilistic decision-based neural networks (PDBNN). The architecture of PDBNN is similar to a radial basis function (RBF) network with modified learning rules and probabilistic interpretation.

Fig 2: Flowchart for Face recognition C. Social Distancing 1) Data Collection and Processing:
We collected live video feeds from CCTVs cameras across various manufacturing sites of the Aditya Birla Group and generated a large dataset of frames that was used for training our models. Visual inspection of the videos showed that our target object, viz. a person was not present in all the frames. In order to avoid going through all feeds and manually selecting frames containing persons, we filtered videos to select frames that have moving objects which majorly constitutes working staff. We make use of the existing background subtraction algorithm as described . As a pre-processing step, we also categorized frames containing objects in low-light and normal light. Finally, a total of 6589 person annotations were completed of which 80% were set aside for training and the remaining 20% for validation.

2) Approach a) Person Detection:
We have made use of the transfer learning approach and have fine-tuned MobileNetV2 model for person detection using TensorFlow framework . We finally converted the trained model to Intermediate Representation (IR) format for OpenVINO Deep Learning Workbench . As the MobileNetV2 paper confirms that it utilizes standard operations present in all neural frameworks, it was easy for us to convert native TensorFlow from binary format to the OpenVINO (IR) format. We trained the model using TensorFlow Object Detection API. We used a 300 × 300 size input for our SSD model with MobileNetV2 as backbone.

b) Distance Measurement:
We run our custom trained MobileNetV2 model for person detection on each frame. The output from the model is a list of coordinates of bounding rectangles on detected persons; where a single rectangle is represented as: [xmin, ymin, width, height]. To find out if the detected people are following social distancing, we need to calculate the Euclidean distance between the bounding rectangles. The imaging plane or the camera plane is a 2D projection of 3D world coordinates therefore, the spatial relationship between the objects in this plane changes due to camera perspective. The objects near to the camera appear larger than those that are away from it. Calculating the distance between the rectangles in this perspective would give an incorrect estimate of the actual distance, we must correct it by transforming the image into top-down-view or bird'seye-view. This is done by applying an Inverse Perspective Transform onto the image. In essence, we compute the Homography Matrix (denoted here as M) which is used to carry out the transformation. There are three parts to the calculation of M, and are detailed below :  Translation (to make image zero-centered), If , be coordinates in image plane, the shifted image coordinates will be = − 2 = − 2  Rotation and Scaling is computed along 2 planes ( × ) = [ where ∅ is the angle between camera plane and perspective view plane; and are scaling factors to resize stretched image back to its original dimension.  Projection is last step to convert this 3D transformed image to 2D form assuming ( , , ) are 3D coordinates in a rotated image and ( , )in converted 2D image and assuming is focal length of camera = − + ( 2 ) = − + ( 2 ) Now, we pick the coordinates of the rectangles and compute Euclidean distance between them. we calculate four linear distances Euclidean distance ( , ) = √( 1 − 2) 2 + ( 1 − 2) 2 ( , ) = ( ( 1, 1), ( 1, 2), ( 2, 1), ( 2, 2)) where = [ 1, 2] and = [ 1,2] are set of ground points. From each individual distance matrix is computed. is a zero-diagonal symmetric matrix = [ 11 … 1 ⋮ ⋮ 1 … ] Thereafter the minimum of the four distances is chosen and compared to threshold distance "t" which is the assumed safe Figure 2: Perspective transformation of selected area 4 distance. If the minimum calculated distance is less than the threshold, we generate an alert thus ensuring that no two sets of people stand close to each other.  In the below figure we can see that both the persons in live streaming video are wearing masks and not maintaining social distance. So green boxes are displayed around their faces with a text "mask". Also other red boxes are displayed around their face region to indicate no social distance. In the below figure we can see that both the persons in live streaming video are not wearing masks and maintaining social distance. So red boxes are displayed around their faces with text "no mask". Also other green boxes are displayed around their face region to indicate social distance. In the below figure we can see that both the persons in live streaming video are maintaining social distance. Also we can see that one is wearing a mask and the other is not wearing a mask. So a red box is displayed around the face of those who don't wear a mask with text "no mask" and a green box is displayed around the face of those who wear a mask with text "mask". Now other green boxes are displayed around their face region to indicate social distance. In the below figure we can see that both the persons in live streaming video are maintaining social distance and wearing a mask. So green boxes are displayed around their faces with text "mask". Also other green boxes are displayed around their face region to indicate social distance.

VI. CONCLUSIONS
As the technology is blooming with emerging trends the availability of new coivd safety measures alert systems can possibly contribute to public healthcare. The architecture consists of MobileNet, YOLO and face recognition algorithms as the backbone and it can be used for high and low computation scenarios. In order to extract more robust features, we utilize transfer learning to adopt weights from a similar task face detection, which is trained on a very large dataset. We used OpenCV, tensor flow, keras , and CNN to detect whether people were wearing face masks and maintaining social distance or not. The models were tested with images and real-time video streams. The accuracy of the model is achieved and the optimization of the model is a continuous process and we are building a highly accurate solution by tuning the hyper parameters. Furthermore, the proposed method achieves state-of-the-art results on a public face mask dataset. By the development of covid safety measures alert system we can detect if the person is wearing a face mask and maintaining social distance or not and also gives an alert message by voicing their names to wear a mask and this would be of great help to the society.