Skip to content

Personal social distancing detector using Python, a Tensorflow model and OpenCV

Notifications You must be signed in to change notification settings

basileroth75/covid-social-distancing-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

covid-social-distancing-detection

This project is a social distancing detector implemented in Python with OpenCV and Tensorflow. The result that can be obtained is the following :

Installation

OpenCV

If you are working under a Linux distribution or a MacOS, use this tutorial from Adrian Rosebrock to install this library.

Other requirements

All the other requirements can be installed via the command :

pip install -r requirements.txt

Download Tensorflow models

In my project I used the faster_rcnn_inception_v2_coco model. I could not upload it to github because it is to heavy. You can download this model and several others from the Tensorflow detection model zoo. Just download all the models you want to try out, put them in the models folder and unzip them. For example :

tar -xvzf faster_rcnn_inception_v2_coco_2018_01_28.tar.gz

Run project

Calibrate

Run

python calibrate_with_mouse.py

You will be asked as input the name of the video and the size of the frame you want to work with. The default values are PETS2009.avi and 800 pixels.

Note : It is important to start with the top right corner, than the bottom right, then bottom left, than end by top left corner !

You can add any video to the video folder and work with that.

Start social distancing detection

Run

python social_distanciation_video_detection.py

You will be asked as inputs :

  • The tensorflow model you want to use (default value faster_rcnn_inception_v2_coco_2018_01_28).
  • The name of the video (default value PETS2009.avi).
  • The distance (in pixels between 2 persons).

Outputs

Both video outputs (normal frame and bird eye view) will be stored in the outputs file.

About

Personal social distancing detector using Python, a Tensorflow model and OpenCV

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages