This is a Social Distancing Detector project.
This project uses Deep Learning based YOLOv3 Pretrained model for object Detection, OpenCV python library for image processing and Centroid Tracking Algorithm For object tracking. In this project, I am attaching the code for building a Social Distancing Detector to detect if a crowd is practicing Social Distancing or not, using a sample video.
Social Distancing is one such terminology that has gained popularity over the past few months, thanks to COVID-19. People are forced to maintain a sufficient amount of distance between each other to prevent the spread of this deadly virus. Amidst this crisis, I and My Project Team decided to build a simple Social Distancing Detector that could monitor the practice of social distancing in a crowd.
- OpenCV (for frame/image processing)
- Deep Learning (Used YOLOv3 Pretrained model for object Detection-(used filter for people indentification only))
- Centroid Tracking Algo (For object tracking)
- imutils==0.5.3
- numpy==1.18.5
- opencv-python==4.2.0.34
- pkg-resources==0.0.0
- scipy==1.4.1
-
PLEASE DOWNLOAD THE YOLOv3 MODEL FROM BELOW LINK AND KEEP ALL THE DOWNLOADED FILES INSIDE THE SAME FOLDER
-
clone the repository to your local machine
-
navigate to this cloned directory
-
from the terminal install dependencies using these commands:
- python -m pip install opencv-python
- from scipy.spatial import distance as dist
- import numpy as np
- import argparse
- import imutils
- import os
-
after installing the dependencies run the social_distancing_config.cpython file from terminal using this command:
- python social_distancing_config.cpython
-
To analyze the different sample videos & Execute, Follow this:-
- example:
python social_distance_detector.py --input VIDEO1.mp4 --output OUTPUT1.mp4
for first Video
python social_distance_detector.py --input VIDEO2.mp4 --output OUTPUT2.mp4
for second Video
and so on.
- example: