Skip to content

🦠 DOORI - Social Distancing Monitoring Model 🤖, a deep learning computer vision project built with OpenCV using YOLO object detector.

License

Notifications You must be signed in to change notification settings

Hemant-Mulchandani/DOORI-Social-Distancing-Monitoring-Model

Repository files navigation

A deep learning computer vision project built with OpenCV using YOLO (COCO dataset) object detector.

Motivation🌟

Social distancing is a method used to control the spread of contagious diseases. It implies that people physically distance themselves from one another, reducing close contact, and thereby reducing the spread of a contagious disease (such as the COVID-19 Disease). Social distancing is not a new concept, dating back to the fifth century, and has even been referenced in religious text such as the Bible.

• Social distancing plays crucial role in prevention of spread of Covid-19 virus.

Features 💎

  • Object detection using the YOLO COCO model to detect only people in a video stream.
  • Computes the pairwise distances between all detected people.
  • Based on the computed distances, we determine whether social distancing rule is being violated or not.

Installation 📦

  1. Clone the repo
   $ git clone https://github.com/Hemant-Mulchandani/DOORI-Social-Distancing-Monitoring-Model.git
  1. Install dependencies
   $ pip install -r requirements.txt
  1. Run the main social distancing 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

Usage 💻

  • 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 distancing 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
    Github usually doesn't support files larger than 25 Mb.You can find the yolo weights in My Google Drive or can be downloaded from here. Download weight file and add 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.

For CPU:

To run this code in your terminal:

  • Open your terminal
  • Change directory to where you have downloaded this code
  • Install python3 if you have not, if installed already then it's ok!
  • Run python3 -m venv venv to create a virtual environment named venv.
  • Run source venv/bin/activate to activate your environment!
  • Write pip install -r requirements.txt to install the python dependencies related to this project like opencv,numpy,scipy etc.
  • Run the command time python social_distance_detector.py --input pedestrians.mp4 --output output.avi --display 1 to run your social distance detection project

For GPU:

You can find my google colab file here Social Distancing Detector Colab

Demo 🎥

• Raw Video as an input

After you run the last line of code or command, a window will pop up and after execution of the file a output.avi file will be showing up in your directory like this:

• Processed Video as the output

Want to talk more?? 🙋🏻‍♂️

If you are interested in helping or have something to suggest or just want to chat with me, you can reach me through the following media .

References 📖

To Dos 📝

  • Utilize proper camera calibration.
  • Apply top-down transformation of view angle.
  • Improve the poeple detection process.

License 🔑

GNU Lesser General Public License v2.1 ©

About

🦠 DOORI - Social Distancing Monitoring Model 🤖, a deep learning computer vision project built with OpenCV using YOLO object detector.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published