Using python, deep learning and computer vision to monitor social distancing. Idea Credits: LandingAI
It’s advisable to make a new virtual environment for this project and install the dependencies. Following steps can be taken to download get started with the project
git clone https://github.com/aqeelanwar/SocialDistancingAI.git
The provided requirements.txt file can be used to install all the required packages. Use the following command
cd SocialDistancingAI
pip install –r requirements.txt
cd SocialDistancingAI
python main.py --videopath "vid_short.mp4"
Running main.py will open a window of the first frame in the video. At this point the code expects the user to mark 6 points by clicking appropriate positions on the frame.
The first 4 among the 6 required points are used to mark the Region of Interest (ROI) where you want to monitor. Moreover, the lines marked by these points should be parallel lines in real world as seen from above. For example these lines could be the curbs of the road. These 4 points need to be provided in a pre-defined order which is following.
- Point1 (bl): Bottom left
- Point2 (br): Bottom right
- Point3 (tl): Top left
- Point4 (tr): Top right
The last two points are used to mark two points 6 feet apart in the region of interest. For example this could be a person's height (easier to mark on the frame)
The gif below will help understand the points better
The complete block diagram of the algorithm can be seen below.
A detailed article on the working of this project can be found here
Idea credits: LandingAI