Social Distancing Detection using Machine Learning Techniques

DOI : 10.17577/IJERTCONV10IS11129

Download Full-Text PDF Cite this Publication

Text Only Version

Social Distancing Detection using Machine Learning Techniques

Meghana G R

Dept of CSE, JIT, DVG

Pooja N G

Dept of CSE, JIT, DVG

Nandini J S

Dept of CSE, JIT, DVG

Mythri G M

Dept of CSE, JIT, DVG

Deepa R Naik

Dept of CSE, JIT, DVG

Abstract:- In the fight against COVID-19, social isolation has proven to be an effective strategy for limiting the spread of the disease. To decrease the chance of the virus spreading through physical or personal contact, people are being asked to keep their interactions with one another to a minimal. We'll utilize In this system, Python, Computer Vision, and Deep Learning are used to track social separation in public spaces and workplaces. The social distance detection tool can monitor and ensure social distancing in public spaces and workplace analysing real-time video feeds from the camera and studying people at work, in factories, stores, and hospitals to see if they are maintaining a safe distance from one another This feature could be utilised in security camera systems to see if everyone keeps a safe distance from one another.


In order to prevent the spread of contagious diseases, We should, for example, adopt social distancing during COVID-19. For decades, most societies have understood the necessity of staying away from diseased people. The main goal is to keep virus transmission to a minimum, reduce the magnitude cases throughout a prolonged period of time instead of at the peak of the epidemic in order to relieve burden on the healthcare system. Maintaining distance is a strategy for avoiding direct interaction with other people. It has been hypothesised that keeping a distance of around 2 metres between yourself and another person reduces the transmission of virus strains, including COVID19. In reality, this means that staying away from people will help to slow the spread of contagious diseases. Social distance is one of the non-pharmaceutical infection control methods that can stop or reduce the spread of a highly infectious disease. COVID-19 is a virus that is now spreading rapidly from person to person. A healthy individual can become ill if they come into touch with droplets from an infected person's cough or sneeze.

According to the World Health Organization, "COVID-19 is transmitted by droplets and fomites during intimate unprotected contact between an infector and an infectee" (WHO).A fomite is a substance, such as clothing, kitchenware, or furniture, that is likely to spread infection. As a result, illness transmission can be avoided by avoiding contact with contaminated fomites and remaining away from other persons. By restricting interaction between possibly infected persons and healthy individuals, COVID- 19 transmission is reducedor disrupted in a population using social distance.


Some countries have used technology-based measures to prevent the spread of the coronavirus pandemic since the outbreak began.. Many developed countries, including as the Republic of Korea and Bharat, use GPS data to follow the movements of ill or suspected people to discover any potential exposure among the healthy. With the help of GPS and Bluetooth, the Bharat government employs the Aarogya Setu software to look for COVID-19 patients in the surrounding area. Others may find it easier to keep a safe distance from sick people as a result of this. Drones and police work cameras have been deployed by some law enforcement agencies to monitor large-scale gatherings, and laws have been put in place to disperse the throng. Various studies, such as Xin et al., use part variations and changing detection in amplitude wave-forms to accomplish human detecting misuse of wireless signals.. However, numerous reception antennae are required, and this may not be easily integrated into all public spaces.

The use of computer science, computer vision, and machine learning will make it easier to detect correlations between high- level possibilities. For example, by analyzing Spatio- Temporal Visual Information and Applied Math Knowledge Analysis of Picture Sequences, it will allow the US to better study and predict pedestrian behaviour in traffic situations, sporting events, medical imaging, and anomaly identification.

Some studies have attempted to predict the disease trend of certain regions using a combination of visual and geo- location cellular information., build crowd count and in public spaces, density estimate algorithms or visualisations of people's space from popular swarms Such assessments, however, encounter challenges such as skilled labour and the Infrastructure design and implementation costs.

Recent advances in computer vision, deep learning, and pattern recognition, on the other hand,all of which are AI sub-categories, have changed the way computers visual information from digital photographs and videos to comprehend and interpret It also allows computers to recognise and classify different kinds of items. Furthermore, such capacities will be critical in empowering, motivating, and socially separating police work and measurements. Existing CCTV cameras, for example, may be turned into "smart" cameras that not only view people but also check if they are following the social distancing pointers. Such systems necessitate highly accurate human detection algorithms

Convolutional Neural Networks (CNNs) are useful for extracting features, classifying complicated objects, and identifying people. CNNs allow researchers to construct more accurate and faster detectors than traditional models when using faster CPUs, GPUs, and memory capacities. However, there are still issues to be tackled, such as long- term coaching, detection speed, and improving accuracy. A deep neural network (DNN)- based detector was employed by Narinder et al.,as well as a Deepsort algorithmic method as an object The space violation indexthe quantitative relationship between a group of individualsis calculated using the huntsman for people detection. The overall variety of the social distancing live to the overall variation of the social distance examined cluster was desecrated by the World Health Organization. However, no applied mathematics examination of their discoveries is offered. Furthermore, there is no mention of the precision with which the space measurements were taken.


Open the video usingcv2.VideoCapture (filename) and skim through each frame one at a time, writing it down during a path. Using the loaded graph, find an object for each frame. Find the midpoint of the range by drawing a blue varicolored bounding box that supports the bounding box vaticination we got earlier. Use an id to identify each bounding box. During each frame, calculate the euclidean distance between the midpoints. Finding the bounding boxes with a distance less than 200 and changing their colour to red using the euclidean distance Combine all of the law pieces and pass all of the frames via the path to rescue them. As a result, we'll have a slew of frames with social distance detected.

Fig 1: Block diagram of social distancing


Fig 2: System architecture of social distancing

Browse System Videos: The user can upload any video from the system using this module application will then connect to that video and begin playing it. If the application identifies any item while playing the video, it will draw bounding boxes around it. The user must use the 'q' key on the keyboard to turn off tracking.

Start Webcam Footage Tracking: This module establishes a connection to a system wbcam and starts streaming video.While streaming, if the application identifies any object, it will encircle that object with bounding boxes. To stop webcam streaming, hit 'q' while playing.


TensorFlow is a free ASCII text file software package library for dataflow and differentiable programming that may be used to solve a wide range of problems. It's a symbolic science library that's also utilised in machine learning neural network applications. Google uses it for all of their research and manufacturing. The Google Brain team created TensorFlow for internal usage. On November 9, 2015, it was released under the Apache two.0 ASCII text file licence.

Numpy-Numpy has the potential to be an all-in-one array processing package. It comes with a new flat array object and utilities for interacting with them. It's the most fundamental Python package for scientific computing. In addition to the necessities, it offers a variety of options:Numpy can seamlessly and chop-chop connect to a variety of databases.

Pandas -Pandas is a Python package that uses advanced knowledge structures and works with ASCII text files to deliver a superior knowledge tool for manipulation and analysis. Python wasmostly utilised for data preparation and knowledge mining. When it comes to knowledge analysis, it didn't seem to make a difference. Pandas overcame this difficulty. Regardless of the source of the data, we can use Pandas to complete five typical stages in the knowledge process and analysis: prepare, alter, model, and analyse. Python and Pandas are utilised in a variety of fields, including finance, economics, statistics, and analytics, to mention a few.

Matplotlib is a Python second plotting library that produces high- quality figures in a variety of hardcopy and interactive formats

across a variety of platforms. Python scripts, the Python and IPython shells, the Jupyter Notebook, web application servers, and four graphical computer programme toolkits all use Matplotlib. Matplotlib strives to simplify complicated things while simultaneously complicating basic ones. You can make plots, bar charts, error charts, scatter plots, and more with just a few lines of code. See the sample graphs and fingernail gallery for examples. The pyplot package, when paired with IPython, provides a MATLAB-like interface for simple graphing. As a power user, you have complete control over line designs, font attributes, axis properties, and more through a homeward-bound association object interface. Especially when combined with IPython. Full control over line designs, font quality, axis attributes, and other parameters is offered to expert users via an object homeward-bound interface or a collection of MATLAB methods. Discover how to utilise Scikit.

Scikit-learn is a Python toolkit that provides a standardised user interface for supervised and unsupervised learning algorithms. It comes with a liberal simplified BSD licence that encourages educational and industrial use, and it's accessible in a number of Linux versions.

The Python programming language is a well-known high- level programming language with a wide range of applications. Python, which was originally released in 1991 and was founded by Guido van Rossum, has a style philosophy that emphasises code readability and the usage of whitespace. Python includes an automatic memory management mechanism and a dynamic sorting system. It supports a number of different programming paradigms. Programming styles such as object-oriented, imperative, useful, and procedural are all supported, as well as a vast and comprehensive commonplace library. Python is an extremely popular programming language. During runtime, the interpreter works with Python. Prior to the implementation of the death sentence, you are not compelled to complete your programme. Like PERL and PHP, this is a scripting language.

  • Python is interactive; you'll write your programmes by interacting with the interpreter while sitting at a Python prompt. Python also understands how important it is to keep up with the latest developments. Strong constructs are available, avoiding time-consuming code repetition, all of this, as well as clear and compact code, is included. This is linked to maintainability, and while it may appear to be a meaningless signal, it is will tell you which quantity code you need to read, explore, and/or comprehend in order to fix difficulties or fine-tune characteristics. Python can thrive in a range of sectors, thanks to its rapid evolution, the benefit of being able to master essential Python skills in any language, and the Brobdingnagian commonplace library.



Due to the urgency of controlling COVID-19, the application value and importance of real-time mask and social distancing detection are increasing. This work reviewed, firstly, many research works that seek to surround COVID-19 outbreak. Then, it clarified the basic concepts of deep CNN models. After that, this paper reproduced the training and testing of the most used deep pretrained-based CNN models (DenseNet, InceptionV3, MobileNet, MobileNetV2, ResNet-50, VGG-16, and VGG-19) on the face mask dataset. Finally and after evaluated the numerical results, best models are tested on an embedded vision system consisted of Raspberry Pi board and webcam where efficient real- time deep learning-based techniques are implemented with a social distancing task to automate the process of detecting masked faces and violated or maintained distance between peoples.This embedded vision-based application can be used in any working environment such as public place, station, corporate environment, streets, shopping malls, and examination centers, where accuracy and precision are highly desired to serve the purpose. It can be used in smart city innovation, and it would boost up the development process in many developing countries. Our framework presents a chance to be more ready for the next crisis or to evaluate the effects of huge scope social change in respecting sanitary protection rules.In future works, we will exploit this methodology on smart sensors or connected RP nodes that will be considered as an Edge Cloud to collect multimedia data, e.g., an autonomous drone system, which can provide capture (by the camera) of the detected objects from different angles and send them to the Edge Cloud system.


[1] "SSD: Single Shot MultiBox Detector," Wei Liu and Alexander C. Berg, Google Inc., Dec 2016.

[2] Andrew G. Howard and Hartwig Adam, "MobileNets: Efficient Networking," in Andrew G. Howard and Hartwig Adam, "MobileNets: Efficient Networking," in Andrew G. Howard Google has published "Convolutional Neural Networks for Mobile Vision Applications."Inc., April 17th, 2017.

[3] Justin Lai and Sydney Maples, "Developing a Real-Time Ammunition Detection System," Stanford University, "Time Gun Detection Classifier," February2017.

[4] Shreyamsh Kamate, "UAV: Object Detection and Recognition,"Texas A&M University's "Tracking Techniques for Unmanned Aerial Vehicles" 2015, University.

[5] Adrian Rosebrock, "Deep learning and OpenCV for object detection,"pyimagesearch.Mohana and H. V. R. Aradhya, Mohana and H. V. R. Aradhya, Mohana and H. V. R. Aradhy "Real-world algorithms that are both elegant and efficient video surveillance object detection, counting, and classification in real time applications originating from a single fixed camera "International

Conference in 2016Circuits,

Controls, Communications, and Computing are all topics covered in this course (I4C),Bangalore: Bangalore University Press, 2016, pp.

[6] Wei Liu and Alexander C. Berg, SSD: Single Shot MultiBox Detector, Google Inc., Dec 2016.

[7] Andrew G. Howard, and Hartwig Adam, MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications, Google Inc., 17 Apr 2017.

[9] Shreyamsh Kamate, UAV: Application of Object Detection and Tracking Techniques for Unmanned Aerial Vehicles, Texas A&M University, 2015.

[10] Adrian Rosebrock, Object detection with deep learningand OpenCV, pyimagesearch.

[11] Mohana and H. V. R. Aradhya, "Elegant and efficient algorithms for real time object detection, counting and classification for video surveillance applications from single fixed camera," 2016 International Conference on Circuits, Controls, Communications and Computing (I4C), Bangalore, 2016, pp. 1-7.

[12] Akshay Mangawati, Mohana, Mohammed Leesan, H. V. Ravish Aradhya, Object Tracking Algorithms for video surveillance applications International conference on communication and signal processing (ICCSP), India, 2018, pp. 0676-0680.

[13] Apoorva Raghunandan, Mohana, Pakala Raghav and H. V. Ravish Aradhya, Object Detection Algorithms for video surveillance applications International conference on communication and signal processing (ICCSP), India, 2018, pp. 0570-0575.

[14] Manjunath Jogin, Mohana, Feature extraction using Convolution Neural Networks (CNN) and Deep Learning 2018 IEEE International Conference On Recent Trends In Electronics Information Communication Technology,(RTEICT) 2018, India.

[15] Arka Prava Jana, Abhiraj Biswas, Mohana, YOLO based Detection and Classification of Objects in video records 2018 IEEE International Conference On Recent Trends In Electronics Information Communication Technology,