You are on page 1of 5

International Electrical and Electronics Engineering Conference (IEEEC-2021)

Social distancing detection using AI which can help


in deciding lockdown status
Ankur Srivastava1, Aryan Verma2, Gaurav Mishra3
1Delhi
Technological University
{ank.sri1004, aryanv28699, mishra.gaurav1998}@gmail.com

Abstract: There is absolutely no obscurity in the fact that COVID-19 led pandemic has put the whole world into jeopardy and has apparently
brought the important activities to a halt. The major step that the authorities have come up with is Social Distancing. Our project puts light
on the process of detecting and examining whether social distancing is being followed and implemented properly in a particular area.

We propose a model which makes it easy for the authorities to substantially ramp up the social distancing detection systems. Our project
incorporates the usage of Deep Learning concepts which would alert the concerned authorities as soon as there are more people than the
allowed limit and less distance between two people than the allowed limit. An active surveillance system which is able to measure distances
between two individuals and produce a warning sign can be useful to slow down the speed of spreading this virus.
We are proposing an AI based social distancing detection system which will encompass the following:
1. System shouldn’t record the data for the long term.
2. There should be no human involvement in the detection loop.
3. The code ought to be available to the overall population.

Keywords: Obscurity, Jeopardy, Substantially, Incorporates

diagnosis and the detection process of this infection consists of


I. INTRODUCTION RT-PCR tests and CT imaging. Reverse Transcription-
COVID-19 is a contagious disease caused by the novel Sars Polymerase Chain Reaction or RT-PCR is a real time
CoronaVirus-2. This emergence of this deadly virus could be diagnosis which incorporates the usage of nasopharyngeal
traced back to the month of December of the year 2019 in the swabs. Chest CT imaging detects the increased possibility of
Wuhan city of China. This virus has been quite relentless and infection based on symptoms and risk factors.
has been testing the health care facilities of countries across
the world. As per our knowledge of the history related to Through the following study, we aim to develop a computer
pandemics, we can very well understand that the effect of vision system which would help gauge the distance between
pandemics can not only be experienced on the socio-cultural objects through the stereo view of the camera deployed.
gamut but also hampers and distorts the economic system of Initially, the distances between the face images are obtained.
many countries. Our research is aimed at providing data to the authorities to
decide on the lockdown status of a certain region and at which
According to the reports of the BBC, the previous pandemics times.
have ruthlessly vanished out populations around the world.
The Plague of Justinian vanished out around half of the global II. LITERATURE REVIEW
population in the 6th century of the common era. 0.2 billion A. Social Distancing for COVID-19
fatalities could be traced down to the havoc caused by the
COVID-19 has been relentlessly causing acute respiratory
‘Black Death’ in the 14th century of the common era. syndromes around the corners of the world since the month of
Smallpox killed 0.3 billion people in the 20th century in spite December in 2019 [1]. Social distancing has proved to be an
of the availability of an effective vaccine since the 18th
effective measure to slow down and put some breaks on the
century. The Covid-19 led pandemic is an addition to the list
spread of COVID-19 [2]. This measure has proved to be of
of pandemics and a once-in-a-century pandemic that has
great importance and has been supported by quite a few works
proved disastrous not just for the human resource but also for
accomplished in recent times. Social distancing can be defined
the economic setup. as maintaining a distance of at least 2 meters (6 feet) between
two individuals to avoid the possibility of contact.
The infection is at the peak for the initial 3 days. The
symptoms can be nausea, fatigue, dry cough, fever, cold,
On continued analysis and series of experiments it has been
weakness, loss of taste and smell, sore throat and headache. It
accepted that social distancing has been quite beneficial
takes around 14-16 days for a covid infected patient to economically [3]. COVID-19 is going to be with us for years
recover. The period of recovery varies from to some and it may be quite difficult to completely eliminate
this virus in the short term. In such a scenario there has been
patient to patient and is governed by the severity of the
an urgent need for an
infection and the immunity system of the individuals. The
International Electrical and Electronics Engineering Conference (IEEEC-2021)

automated system that can help examine and monitor social III. PRELIMINARIES
distancing measures and help the society comply with the
A. Deep learning based detection of object
COVID guidelines. This way we can prove to be advantageous
for society. Detection of objects in the image world is a very elemental
problem of computer vision. The primary aim is to identify
B. Human Detection occurrences of bodies that belong to some specific categories,
This research work basically focuses on the implementation of for example, humans, cars, establishments, etc. In recent times
pedestrian detection as a general object detection problem or object identification gauges have been dominated by deep
as a dedicated model or framework for the detection of CNN models.
pedestrians only. A well explained survey of 2D object
detectors including metrics, compiled datasets and The training of these models is done using supervised learning
fundamentals can be easily found [4]. Deep learning concept with methods such as data augmentation so that the variety of
has also been used in one of the surveys for the detection of data can be increased.
generalised objects as well as the detection of pedestrians [5]. .
B. Model Generalization
This model incorporates the usage of deep learning concepts
and can be further classified into 2 broad divisions. The very The generalisation capacity of avant-garde is satisfactory for
first being the Two-stage detectors which incorporates the stationing pre-trained models to new conditions. For 2-D
usage of R-CNN concepts [6, 7, 8, 9]. It initiates with region entity identification pre-trained models can bring out good
proposals followed by the stratification process and then a accuracy irrespective of the make of camera, angle of the view
bounding box regression. The next broad division is the One- or the lighting conditions.
stage detectors. Some of the well known models using one-
stage detectors are YOLOv1-v4 [9, 10, 11], SSD, RetinaNet Thus, a pre-trained neural network based human detection
and EfficientDet. system can be directly used for the analysis.

Apart from these anchor-based approaches there are various


IV. METHOD
anchor-free approaches: CornerNet, FCOS and RepPoints.
These models were scrutinized on datasets of Pascal VOC and
MS COCO. These approaches have good efficiency as well as We put forward the usage of CCTV footage for detecting
real-time performance and hence can be incorporated as pre social distancing violations without recording any data. We
trained models to ramp up the social distancing detection use our model to detect if there are any social distancing
measures. violations and alert the system. We also use a metric called
C. Some other models social density to monitor the extent of social distancing.
In [13], a simulated model has been developed by the authors
and displayed the probable effect of abiding by the social A. Problem formulation
distancing norms and avoiding physical touch as measures to We are interested in finding the number of social distancing
check transmission of virus. Nevertheless, the impacts could violations and we try to find the social density and ensure it
be impacted by the way in which the higher and concerned stays below a critical threshold which we will find empirically.
authorities implement these regulations without leaving any We can set up an alert if the number of social distancing
loophole. Imposition of strict lockdown could also be violations crosses a threshold set by the authorities.
considered as a measure. The incorporation of video
surveillance devices to examine social distancing can be of
great use. B. Human Detection
We use a pretrained model called GoogleNet to detect
The process of detection is more or less the same in all the humans. GoogLeNet is a 22-layer deep convolutional neural
applications. There are 3 main segregations: Object Feature network that is based on the Inception Network, a Deep CNN
Description, Object Detection, Object Classification. The very developed by researchers at Google.The GoogLeNet
first step of the proceeding is Object Feature Description. This architecture consists of 22 layers (27 layers including pooling
basically involves feature detection and feature extraction. layers), and part of these layers are a total of 9 inception
Feature Detection involves Edge Detection, Corner Detection, modules(figure 5)[15]. Table 1 gives the architecture of the
Blob Detection, Ridge Detection and some other algorithms, model.
some of them being Canny, FAST, LoG etc. Profound learning
methods like neural organizations like CNN, RCNN, Fast For every object identified by the model, we get the class of
RCNN, and so forth and a couple of calculations like the object and four coordinates, the top left, top right, bottom
AdaBoost Algorithm, Face DNR are for the most part utilized left and bottom right pixel of the bounding box. We are
for discovery of the item.The next step is Object interested in the middle point of the bottom edge of bounding
Classification. It involves a bulk of algorithms for box, which we define as (pose vector).
classification. The results of the comparative study of the Let X₀, Y₀ and X₁, Y₁ be the coordinates of the bottom left and
feature extraction techniques carried along with several bottom right pixels of bounding box, 𝐩 is given by,
classifiers suggested that SURF 128 + XCSLBP technique (X₀ + X₁)/2 , (Y₀ + Y₁)/2.
along with the SVM-linear classifier produced an accuracy of
99.2% and is the finer approach for this as mentioned in [14]
International Electrical and Electronics Engineering Conference (IEEEC-2021)

and K is the intrinsic parameters of the camera,

K=

where h is the camera height, f is focal length, and ku and kv


are the measured calibration coefficient values in horizontal
and vertical pixel units, respectively. (cx, cy) is the principal
point shifts that corrects the optical axis of the image plane
[16].
D. Finding Distance Between Pedestrians
After finding real world coordinates, we can find the euclidean
distance between any two pedestrians.We can also find the
social distancing violations by checking if this distance is
below the threshold.
E. Critical Social Density Evaluation
We need to track down a basic social density that would make
sure that the likelihood of social distancing infringement is
low. We use a linear regression model to estimate this value.
TABLE I: GOOGLENET ARCHITECTURE (WHERE POOL PROJ. IS THE NUMBER OF We use the total number of violations y and social density p as
1X1 FILTERS USED AFTER POOLING WITHIN AN INCEPTION MODULE, PARAMS. our two variables.
REFERS TO THE NUMBER OF WEIGHTS WITHIN THE CURRENT ARCHITECTURE
y = A0 + A1*p
COMPONENT, OPS REFERS TO THE NUMBER OF OPERATIONS CARRIED OUT
WITHIN THE COMPONENT)
We can generate data for this model using the results of our
pedestrian detection model.
C. Bird’s Eye View Mapping
We need to map the angled view to a bird’s eye view. To do
this we need to apply a calibrated IPM(inverse perspective
mapping) transition.For this, we require camera location, its V. EXPERIMENT
height and angle of view, we can estimate them with various
methods if they aren’t available to us. We ran our model on a video dataset of a busy street which
gave us enough pedestrian footage for the model to give
By applying IPM we can convert the 2D image points (x,y) to accurate results of the problem we intend to solve.We divided
corresponding world coordinate points(Xw,Yw,Zw). our code into two parts, the first one detects pedestrians and
the second one to detect the social distancing or the social
critical density status.

A. Implementation Details:
Where R is the rotation matrix,
We need to find the perspective transformation matrix to get
accurate distance between two objects since CCTV’s give an
angled perspective. For datasets that don’t have information
R=
about the height of CCTV and the interval between few crucial
positions that can be used for making our frame of reference
transformation matrix we would have to estimate the size of
objects given in the video and then try to estimate the
perspective transformation matrix.
T is the translation matrix,
We estimated the distances between key points in our dataset.
After finding the perspective transformation matrix we run our
pedestrian detection code on our dataset. Then we need to find
the real-world coordinates from the 2D image coordinates.
T=
Now we need to find the number of social distancing
violations, the distance between two pedestrians and social
density 𝛒. Our model uses GoogleNet which is a pretrained
Deep Convolutional Neural Network and is a variant of the
Inception architecture.
International Electrical and Electronics Engineering Conference (IEEEC-2021)

The experimentation was done on a laptop with an Intel Core correspondence between these two was used to determine
i5-7300HQ CPU, 8 gb RAM, and NVIDIA GeForce GTX critical social density.
1050Ti CPU. From the plotted graph, it can be concluded that there is a
positive relation between the two parameters as when one is
increasing, the other is too.
A simple linear regression was applied on the values of the
above two parameters. The skewness value of the social
density of our data set was 0.193. These results are displayed
in fig 2. Here critical density will be the minimum value of the
predicted range.
Table 3 here tabulates the observed intercepts and critical
density of the regression model. These values also go along
with the pattern of values in the fig 2. This helped us uphold
the success of our technique.

Fig 1: Human detection using our model and the subsequent verification of
physical distancing.

VI. RESULTS
A. Human Detection
Figure 1 shows a random frame from our video dataset after
going through our model, we also have the 2D transformed
image.

Fig 3: Histogram heatmap between social density and mean closest distance.

Fig 2: Graph is the linear regression(red) between social density and frequency
of social distancing violations. Prediction range is signified by green lines and
the critical social density is the x-intercepts of the lines.

B. Distance between individuals


For each pedestrian, we can find the set of humans closer than
the minimum distance required for social distancing by
iterating over all the pedestrians detected and finding the Fig 4: Graph is a histogram heat map between social density and frequency of
social distancing violations. This shows that there is a positive relation
euclidean distance between them. We specify D for each i
between the two parameters.
pedestrian as the closest distance between him and another
pedestrian. We specify the minimum of the set of all D as i

minimum closest distance D . We can also find the average


min

closest distance, D , of a set of D of size n as the sum of all D


avg i i

in the set divided by n. We compare these findings with the


social density and observe that both D and D are relatively
avg min

high when social density is low.

C. Critical Social Density


A histogram was plotted for the values of the social density
and the frequency of social distancing infringements. The
International Electrical and Electronics Engineering Conference (IEEEC-2021)

VII. CONCLUSION
This paper proposes an Artificial Intelligence based system for
figuring out regions where social distancing is not being
followed. We use social density as a factor for figuring out the
extent of social distancing violation.

There are some pedestrians which the model fails to identify


when they are not properly visible, or they are hidden from
view by another pedestrian. Future work may be done on
increasing pedestrian detection accuracy and on detecting
groups of pedestrians.

REFERENCES

[1] D. S. Hui, E. I. Azhar, T. A. Madani, F. Ntoumi, R. Kock, O. Dar, G.


Ippolito, T. D. Mchugh, Z. A. Memish, C. Drosten et al., “The
continuing 2019-ncov epidemic threat of novel coronaviruses to global
Fig 5: Histogram heat map between social density and minimum closest health the latest 2019 novel coronavirus outbreak in wuhan, china,”
distance. International Journal of Infectious Diseases, vol. 91, pp. 264–266, 2020.
[2] C. Courtemanche, J. Garuccio, A. Le, J. Pinkston, and A. Yelowitz,
“Strong social distancing measures in the united states reduced the
covid-19 growth rate: Study evaluates the impact of social distancing
measures on the growth rate of confirmed covid-19 cases across the
united states.” Health Affairs, pp. 10–1377, 2020.
[3] M. Greenstone and V. Nigam, “Does social distancing matter?”
University of Chicago, Becker Friedman Institute for Economics
Working Paper, no. 2020-26, 2020.
[4] Z. Zou, Z. Shi, Y. Guo, and J. Ye, “Object detection in 20 years: A
survey,” arXiv preprint arXiv:1905.05055, 2019.
[5] Z.-Q. Zhao, P. Zheng, S.-t. Xu, and X. Wu, “Object detection with deep
learning: A review,” IEEE transactions on neural networks and learning
systems, vol. 30, no. 11, pp. 3212– 3232, 2019.
[6] R. Girshick, J. Donahue, T. Darrell, and J. Malik, “Rich feature
hierarchies for accurate object detection and semantic segmentation,” in
Proceedings of the IEEE conference on computer vision and pattern
recognition, 2014, pp. 580–587.
[7] R. Girshick, “Fast r-cnn,” in Proceedings of the IEEE international
Fig 6: Stacked bar graph between number of violations and closest distance. conference on computer vision, 2015, pp. 1440– 1448.
[8] S. Ren, K. He, R. Girshick, and J. Sun, “Faster r-cnn: Towards real-time
object detection with region proposal networks,” in Advances in neural
information processing systems, 2015, pp. 91–99.
TABLE II: DATASET CHARACTERISTICS [9] J. Dai, Y. Li, K. He, and J. Sun, “R-fcn: Object detection via region-
based fully convolutional networks,” in Advances in neural information
processing systems, 2016, pp. 379–387.
Data Name Frame per Quality Video Length [10] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, “You only look
second once: Unified, real-time object detection,” in Proceedings of the IEEE
conference on computer vision and pattern recognition, 2016, pp. 779–
788.
Street Data 24 1280*720 5 min
[11] J. Redmon and A. Farhadi, “Yolo9000: better, faster, stronger,” in
Proceedings of the IEEE conference on computer vision and pattern
recognition, 2017, pp. 7263–7271.
[12] A. Bochkovskiy, C.-Y. Wang, and H.-Y. M. Liao, “Yolov4: Optimal
speed and accuracy of object detection,” arXiv preprint
TABLE III: INTERCEPT AND CRITICAL SOCIAL DENSITY
arXiv:2004.10934, 2020.
THROUGH LINEAR REGRESSION MODEL
[13] Joel R Koo, Alex R Cook, Minah Park, Yinxiaohe Sun, Haoyang Sun,
Jue Tao Lim, Clarence Tam, and Borame L Dickens, ”Interventions to
Data Name Intercept 𝛃₀ Critical Density 𝝆c mitigate early spread of sars-cov-2 in singapore: a modelling study”. The
Lancet Infectious Diseases, 2020.
[14] M Hiranmai, Niranjana [Krupa B], and H K Nagaraj, ”Comparative
Street Data 0.0234 0.0104 study of various feature extraction techniques for pedestrian detection”.
”Procedia Computer Science”, ”154”:”622 – 628”, 2019, in proceedings
of the 9th International Conference of Information and Communication
Technology [ICICT-2019] Nanning, Guangxi, China January 11-13,
2019.
[15] https://towardsdatascience.com/deep-learning-googlenet-explained-
de8861c82765
[16] Rezaei, M.; Klette, R. Computer Vision for Driver Assistance; Springer
International Publishing: Cham, Switzerland, 2017.

You might also like