Skip to content

swaubhik/social-distance-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Distance Detector

Social Distance Detection system built with OpenCV, Yolo using Deep Learning and Computer Vision concepts in order to detect social distance in real-time video streams.

Live Demo

😇 Motivation

In the present scenario due to Covid-19, there is no efficient social distance detection applications which are now in high demand for transportation means, densely populated areas, residential districts, large-scale manufacturers and other enterprises to ensure safety.

👀 Demo

⚠️ TechStack/framework used

⭐ Features

The following are examples of the added features. Note: You can easily on/off them in the config. options (mylib/config.py):

1. Real-Time alert:

  • If selected, we send an email alert in real-time. Use case: If the total number of violations (say 10 or 30) exceeded in a store/building, we simply alert the staff.
  • You can set the max. violations limit in config (Threshold = 15).
  • This is pretty useful considering the COVID-19 scenario.

Note: To setup the sender email, please refer the instructions inside 'mylib/mailer.py'. Setup receiver email in the config.

2. Threading:

  • Multi-Threading is implemented in 'mylib/thread.py'. If you ever see a lag/delay in your real-time stream, consider using it.
  • Threading removes OpenCV's internal buffer (which basically stores the new frames yet to be processed until your system processes the old frames) and thus reduces the lag/increases fps.
  • If your system is not capable of simultaneously processing and outputting the result, you might see a delay in the stream. This is where threading comes into action.
  • It is most suitable for solid performance on complex real-time applications. To use threading:

set Thread = True in the config.

3. People counter:

  • If enabled, we simply count the total number of people: set People_Counter = True in the config.

4. Desired violations limits:

  • You can also set your desired minimum and maximum violations limits. For example, MAX_DISTANCE = 80 implies the maximum distance 2 people can be closer together is 80 pixels. If they fell under 80, we treat it as an 'abnormal' violation (yellow).
  • Similarly MIN_DISTANCE = 50 implies the minimum distance between 2 people. If they fell under 50 px (which is closer than 80), we treat it as a more 'serious' violation (red).
  • Anything above 80 px is considered as a safe distance and thus, 'no' violation (green).

📁 Weights

Download the weights file from Click to Download and place it in the 'yolo' folder.

🔑 Prerequisites

All the dependencies and required libraries are included in the file requirements.txt See here

🚀  Installation

  1. Clone the repo
$ git clone https://github.com/swaubhik/social-distance-detector.git
  1. Change your directory to the cloned repo and create a Python virtual environment named 'test'
$ mkvirtualenv test
  1. Now, run the following command in your Terminal/Command Prompt to install the libraries required
$ pip install -r requirements.txt

💡 Working

  1. Open terminal. Go into the cloned project directory and type the following command:
$python run.py -i mylib/videos/test.mp4
  1. To run inference on an IP camera, Setup your camera url in 'mylib/config.py':
# Enter the ip camera url (e.g., url = 'http://127.0.0.1:8040/video')
url = ''
  1. To detect in real-time video streams type the following command:
$python run.py

Set url = 0 for webcam.

👏 And it's done!

Feel free to mail me for any doubts/query :email: b18csel299@cit.ac.in

🤝 Contribution

Feel free to file a new issue with a respective title and description on the the Social-Distance-Detector repository. If you already found a solution to your problem, I would love to review your pull request!

❤️ Owner

Made with ❤️  by Swaubhik Chakraborty,Amit Kumar Singh

👍 Credits

Main:

Optional:

👀 License

MIT © Swaubhik Chakraborty

About

This is my B.tech 5th-semester mini project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages