Skip to content

Social distancing detector built with OpenCV using YOLO object detector

License

Notifications You must be signed in to change notification settings

FredDoe/social-distance-detector

Repository files navigation

Social Distance Detector 👮➖👮

Social distancing detector built with OpenCV using YOLO object detector

Social distancing is crucial to the prevention of the spread of contagious diseases.

Installation 📦

  1. Clone the repository
   $ git clone [email protected]:FredDoe/social-distance-detector.git
   $ cd social-distance-detector
  1. Create Virtual environment and Install dependencies
python -m venv venv

source venv/Scripts/activate

pip install -r requirements.txt
  1. Run the main social distance detector file. (set display to 1 if you want to see output video as processing occurs)
python social_distancing_detector.py --input pedestrians.mp4 --output output.avi --display 0

Running this Application 💻

  • Caution 💣
    For most accurate results, you should calibrate your camera through intrinsic/extrinsic parameters so that you can map pixels to measurable units. An easier alternative(but less accurate) method would be to apply triangle similarity calibaration. Both of these methods can be used to map pixels to measurable units.
    If you do not want/cannot apply camera calibration, you can still utilize the social distance detector but you'll have to rely strictly on the pixel distances, which won't necessarily be accurate. For the sake of simplicity, this OpenCV Social Distancing detector implementation will rely on pixel distances. You can extend the implementation as you see fit though 😉.

  • YOLO COCO weights
    The weight file exceeds the github limits but can be download from here.
    Add the weight file to the yolo-coco folder.

  • GPU
    Provided you already have OpenCV installed with NVIDIA GPU support, all you need to do is set USE_GPU=True in your config.py file.

Demo 🎥

raw-vid processed-vid

References 📖

License 🔑

MIT © Godfred Doe

About

Social distancing detector built with OpenCV using YOLO object detector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages