Social Distancing Detector using YOLO v3 Image Processing Algorithm

The lack of public awareness and negligence, the pandemic due to coronavirus(covid19) has brought a global crisis with its deadly spread to more than 180 countries, and about 147 million confirmed cases along with 3.11 million deaths globally as of 26th April 2021. Due to the absence of the vaccine against the covid19 the world has suffered a lot. Though scientists have developed several vaccines then also the pandemic is still out of control so therefore the only feasible option available to us is social distancing. And this notion motivated us to bring up the idea of a social distancing detector using image processing which includes a deep learning framework for automation task monitoring. The framework utilizes the YOLO v3 model object detection model to separate moving people from the background and to detect people by using bounding boxes. The basic idea of this article is to analyze the social distancing violation index rate that how many people violate the rule of social distancing in a particular interval of time.


I. INTRODUCTION
In this difficult situation of time of COVID-19 pandemic, we are facing many problems regarding to our health. We are forced to stay at home, sanitize everything before using and maintain social distancing in our day to day life. We have been doing this from a year but still right now we are facing the second wave of COVID-19. The main problem with us is that we are failing to keep the social distance amongst the people and due to that the COVID-19 cases are rising day by day. They are reaching almost 2.5 lakhs cases per day and it is very horrifying. The Government has forced a lockdown again and everything has shut down, hotels, colleges, malls, tourist places, etc. The life we were living before a year from now was very different. We were enjoying everything without following any kind of rules of social distancing. So now we have to come together and fight this virus as soon as possible so that we can again live our lives to the fullest.
To help maintain social distancing amongst the people, we have proposed a system which help us to detect whether people are following the required social distancing or not. Our system detects the distance between the people with the help of image processing. If the required distance is being followed it will show no risk and if it is not being followed it will show risk. The system captures the distance between the people either from camera or from the recorded videos. So we can detect the social distance from live images or from recorded videos.
We can use this system at every public place to help the police or other people who are working there to see whether people are following the rules or not and then strict action will be taken on those people. This will reduce their efforts and people will follow the social distancing rules due to the strict action. These people will also have no fear to get in contact with the virus as they will be working on the system instead of physically being present there. So, it will be a win-win situation for everyone. That is why our system will play an important role in these kind of situations II. LITERATURE REVIEW Various research has been carried out on social distancing using different techniques. Yadav et al. [1] proposed a system in which raspberry pi4 integrated with the camera to automatically track public spaces in real-time to prevent the spread of the coronavirus. The trained model set was installed in public places to detects whether people keep safe social distances and also checks whether or not those people wear masks. This method operates in two stages : first , to identify a person without the mask and second, when the detection of a social distance ,if violation by individuals is noticed the photo was taken and sent to a control center at the State Police Headquarters for further action. They achieved an accuracy of 91%. Singh Punn et al. [4] proposed a real-time based deep learning technique to monitor social distancing using object detection and tracking approaches. The number of violations was given by calculating the number of groups formed and the violation index term computed as the ratio of the number of people to the number of groups. In this different models were used to fasten the detection like RCNN, SSD, and YOLO v3. . An AI monocular camera-based real-time system to monitor social distancing was proposed by Yang et al. [5]. 4 Rinkal Keniya, Ninad Mehendale , the people were detected as maintaining social distance or not depending on the distance maintained between two people. They were marked in frames of different colours (green and purple). Green colour for violating social distancing and label as unsafe. Purple colour for not violating social distancing and label as safe. The method was verified in 3 different pedestrian crowd datasets. But there were some missing detections in the train station dataset, as in some areas the density of pedestrians was very high. In Sener et al. [2] method the motion of the communicating people was extracted from each region of the detected individual. They achieved an accuracy of 93.3%. Bielecki et al. [6] did a study of 508 soldiers with an average age of 21 years. Soldiers were divided in two groups. For the 354 soldiers affected before social distancing was introduced, the Coronavirus caused 30 % to become sick. While no soldier in a population of 154, in which infections occurred after social distancing had been introduced. by this clearly show's the importance of Social Distancing. An innovative localization method was proposed by Nadikattu et al. [7] to track humans' position in the surrounding . This AI smart device is not only handy for maintaining social distancing but also detects. The system will warn the user if anyone is near him within a 6-foot radius. Ghorai et al. [8] proposed a deep learning solution that would alert the person as soon as the person violates social distancing. A video is captured using the CCTV camera and with the PoseNet model, the people are detected. If the distance between 2 frames of people is less then the authorities required minimum distance then they are alerted. To slow down the spread of the Coronavirus via airborne transmission, a "social distancing" approach of around 6 feet was recommended in the proposed method by Feng et al. [11]. It was also found that the wind effect on droplet transport and deposition is dynamic and highly dependent and localized on the wake flow pattern. Liu et al. [3] proposed a model for detecting objects in images using a single deep neural network. The results on PASCAL VOC, COCO, and ILSVRC datasets showed that SSD has competitive accuracy to methods that utilize an additional object proposal step and is much more faster. The accuracy of SSD300 is 74.3 % and for SSD512 is 76.8 %.
Model Accuracy (%) Yadav et al. [ III. SYSTEM ARCHITECTURE DESIGN First the input from video or camera in been given to the system. In this input by image processing the person are detected using Yolo Algorithm which have been trained by Training dataset. The detected person Centroid will be calculated and by Euclidean distance Formula a pair wise distance between centroids will be calculated. By this we will get the distance between person and the person who are Violating Social Distancing will be counted and the person who are maintaining the social distance will also be counted.

IV. METHODOLOGY
We have loaded 192 images from the dataset where each image had single or multiple labels inside it which were used for training the model. We have also used a trained COCO dataset so that we can improve our accuracy. Further, more images and labels were generated using an auxiliary dataset The auxiliary dataset is a variation of the images in terms of rotation , scaling ,and cropping. The dataset was then stored into two different parts. Later the dataset is divided into training and testing for validation and 55 % of the dataset is selected for training, 15 % for validation, and the remaining 30 % for testing of trained detectors. Box labels were used to create the data for training and evaluation purposes A rectangular box was used to mark the Person. We have used YOLO V3 (You Only Look Once) algorithm for object detection till date YOLO is one of fastest image processing algorithm. YOLO has three tuning parameter, network input sizes, anchored box, and feature extraction network. First, the frame is detected then compute bounding box coordinates and then derived the center of the bounding box. Using the box coordinates the top-left coordinates are derived. After which the frame is pre-processed giving three results which are confidence, bounding box, and centroids of each person in the frame. The euclidean distance is used to find the distance between centroids. After the comparison of the distance between the centroids of two individuals pair of person, it is compared with the minimum distance in terms of pixels. The pairs are marked as red or green depending on if they have violated minimum social distancing distance or not and the total number of person violating the Social Distance is also being displayed. Data augmentation was carried out to improve the accuracy by randomly transforming the data while training the machine. Data augmentation added more variety during training. And actually, increases the number of labels in the training data samples. The use of transform augmentation during the training allows random keeping of images. The associated box labels are also flipped horizontally. Augmentation was not performed for the validation and test data and hence evaluation can be carried out unbiasedly since the data is not modified.
www.ijarsct.co.in ResNet-18 the accuracy was 85.3 %. We tested our model using a video stream and images. Of which, we could see the proper detection of people according to the distance between a pair of person. The frames were also labelled as safe and unsafe accordingly. Also, the count of the violations made people were counted and were constantly updating. wherein the entire frame is detected, and further, the distance calculation and comparison between the centroids takes place. The results obtained by the model are displayed in fig . The Red and green coloured images displayed along with the labels indicate if the person is maintaining social distancing or not. The table 1 shows the comparison with different models tested and found in the reviews and their respective accuracies. The maximum accuracy was 87.3 % and 75.4 % was the minimum accuracy.

VI. CONCLUSION AND FUTURE SCOPE
Social distancing is one of the important precautions in reducing physical contact that may lead to the spread of coronavirus. The consequences of noncompliance with these guidelines will be causing higher rates of virus transmission. A system has been developed using python and OpenCV library to implement two proposed features. The first feature is on detecting violations of social distancing, while the second feature is on detecting violations of entering restricted areas. Both features have been tested for accuracy. Based on the overall results, this study is seen to meet all of its objectives. However, there are some limitations to the results obtained. Based on the test performed on the system, the results show that the object detection model used for detecting persons is having the difficulty in detecting people correctly in the outdoor environment and difficult scenes. For further improvement in the future, a better object detection model can be implemented.