Skip to content

A computer vision 📹 based object detection application that helps to monitor and detect social distancing in public places

Notifications You must be signed in to change notification settings

siddharthc30/SafetyEye

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SafetyEye

A computer vision based object detection command line application that helps to monitor and detect social distancing in public places.

Summary of Contents

  1. About The Project
  2. Problem Addressed
  3. Getting Started
  4. Example
  5. Results
  6. New!
  7. Coming up

About The Project

During the pandemic, there were guidelines passed by local government bodies that were to be followed on a personal basis in order to reduce the rise in COVID-19 cases, one of them was following social distancing in public places. Following social distancing is a difficult task for us, as it is something new to us and we have to be constantly monitored so that we follow this rule and reduce the risk of contracting the virus. If there were people appointed to monitor social distancing from the field, this job becomes not only tedious but also would put the respective person at risk of contracting the virus. In order to overcome this problem, we can automate this task and SafetyEye comes right into action. SafetyEye is a command-line application that detects and monitors social distancing using a state-of-the-art object detection model that is tuned to recognize human beings. When CCTV footage of a public place is fed to the application, it outputs a video with a graphical representation of people following social distancing or not. This helps in a way that a person can sit inside a cabin remotely and take a look into the situation for any further action.

Built With

  1. Python3
  2. Opencv
  3. cv2's DNN Library

Problem Addressed

Automation of social distance detection and monitoring.

Getting Started

Prerequisites

To install the required prerequisite modules, just run pip install -r requirements.txt
Next, download the weights of yolov3 network from here and copy-paste the file into this cloned directory
After downloading the weights, go to file app.py and line 17 and change the path of the weights file.
net = cv2.dnn.readNet("<path of weights file>", "yolov3.cfg")

Run it

After all the required files and modules are downloaded. Run the command
python3 app.py --path (path of the test video in double quotes)

For example, python3 app.py --path "home/videos/testvideo.avi"

  • Then a pop-up with the first frame of the test video appears.
  • Here, you have to select first four dots that will appear in red on the frame such that they form a rectangle.
  • Order of plotting points is important, and the order is, top-left, top-right, bottom-left and bottom-right
  • Later, you have to select two dots that appear in blue along a straight line (preferable), to find out the minimum distance to be maintained by the people in the video. And then press enter.

All these steps are demonstrated below in Example section

Example

Here is a demo on how to run the application, demo

Results

This is the output of the application after running it on the sample video that is already in this repository.
output

Here, people bounded by green boxes are maintaining social distancing according to the threshold distance given by the user and the ones bounded by red boxes are not.
P.S: The complete output video is in file out.avi

New!

This application has an inbuilt camera caliberation function, using which we can set the minimum distance between people in the video to classify them whether they are socially distanced or not. This application also has a perspective tranformation of the people so that the distance between people will be independent of the orientation of camera.

Coming up

Automate the process of camera calibration.

Instead of the user entering the minimum distance required to be maintained, the future goal of this application is to automate this process and smartly find out the minimum distance using an algorithm, which would inturn reduce the effort of user entering the points to calculate the distance.

About

A computer vision 📹 based object detection application that helps to monitor and detect social distancing in public places

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages