GithubHelp home page GithubHelp logo

mankes2 / social-distancing-detector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aibenstunner/social-distancing-detector

0.0 0.0 0.0 45.92 MB

A social distancing detector built with OpenCV using YOLO object detector

License: MIT License

Python 100.00%

social-distancing-detector's Introduction

Social Distancing Detector

A social distancing detector built with OpenCV using YOLO(COCO model) 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.

And the leper in whom the plague is โ€ฆ he shall dwell alone; [outside] the camp shall his habitation be. โ€” Leviticus 13:46

Social distancing is crucial to the prevention of the spread of disease.

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/aibenStunner/social-distancing-detector.git
   $ cd social-distancing-detector
  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
    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

Contributing ๐ŸŽ contributions welcome

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

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 ๐Ÿ“–

Todos ๐Ÿ“

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

License ๐Ÿ”‘

MIT ยฉ Gadri Ebenezer

social-distancing-detector's People

Contributors

aibenstunner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.