- Motivation
- YOLO Theory
- Detection Output
- Tech Stack
- Functionalities
- To Do and Further Improvements
- Requriements
- Run Locally
- License
- Contributors
The current COVID-19 pandemic is showing negative effects on human health as well as on social and economic life. It is a critical and challenging task to revive public life while minimizing the risk of infection. Reducing interactions between people by social distancing is an effective and prevalent measure to reduce the risk of infection and spread of the virus within a community. And so, this project will help to monitor that.
YOLO or You Only Look Once is an algorithm that uses neural networks to provide real-time object detection. Object detection in YOLO is done as a regression problem and provides the class probabilities of the detected images. As the name suggests, the algorithm requires only a single forward propagation through a neural network to detect objects.
- Python
- Detect people who are practicing social distancing and those who are not.
- Draw a green coloured box around those who are practicing social distancing and red for those who are not.
- Display the following information :
- The threshold values used for detection.
- Number of people recognized.
- Number of people who are practicing social distancing.
- Number of people who are not practicing social distancing.
- Using YOLO for Image Detection
- Calculate the distance between people and categorise them as safe and unsafe
- Draw green coloured boxes for those who follow social distancing and red for those who don't.
- Detect and draw boxes for image, video and live stream.
- Adding Birds-Eye View for the Video
- Work on the minimum pixel distance for different media.
- Assign a score at the end of the video/stream for every person based on the time they were not socially distanced.
The following dependencies and modules(python) are required, to run this locally
- os, sys, argparse
- math
- mimetypes
- numpy==1.21.2
- opencv-python==4.5.3.56
To install the requirements run:
$ pip install -r requirements.txt
- Clone the GitHub repository
$ git clone git@github.com:Pranav1007/Social-Distance-Detector.git
- Pull all the git lfs files
$ git lfs fetch --all
- Move to the Project Directory
$ cd Social-Distance-Detector
-
Create a Virtual Environment (Optional)
- Install Virtualenv using pip (If it is not installed)
$ pip install virtualenv
- Create the Virtual Environment
$ virtualenv sdd
-
Activate the Virtual Environment
- In MAC OS/Linux
$ source sdd/bin/activate
- In Windows
$ source sdd\Scripts\activate
-
Install the requirements
(sdd) $ pip install -r requirements.txt
- Run the python script run.py along with the appropriate arguements
(sdd) $ python3 run.py -m v -p media/test.mp4
- Usage
"""
Usage:
usage: run.py [-h] [-m MEDIA] [-p PATH]
optional arguements:
-h --help Show this screen and exit.
-m MEDIA --media MEDIA Media Type (image(or i), video(or v), webcam(or w))
-p PATH --path PATH Path of the Media File (For webcam enter any character)
"""
- Other options to Edit
"""
You can go to the utilities/config.py and change the threshold values based on the video and system requirements.
"""
# If you want to use GPU:
Set USE_GPU = True
# If you want to increase or decrease the minimum threshold distance
Modify the DIST_THRES value
# If you want to change the Non Maximum Supression Threshold or Confidence Threshold
Modify the NMS_THRESH or CONF_THRESH values respectively
- Dectivate the Virtual Environment (after you are done)
(sdd) $ deactivate
This project is under the Apache-2.0 License License. See LICENSE for Details.
Pranav B Kashyap
|
Prakhar Singh
|
Avi Tewari
|