Skip to content

Because of COVID19 measures have been taken to prevent person to person detection, one of the most influential and important new regulation is to keep 1.5 meters distance from each other. To help remind citizens to maintain this distance we have created the 1.5 meter monitor.

License

Notifications You must be signed in to change notification settings

Amsterdam-AI-Team/1.5-meter-monitor

Repository files navigation

Social Distancing YOLOv5

The 1.5 meter monitor is a system created to make users aware of social distancing measures. It detects pedestrians with the open-source YOLOv5 convolutional neural network. It uses cheap and ubiquitous hardware, such as a simple webcam, computer with GPU (or edge devices) and any screen to create awareness for anybody within the field of view of the camera to keep social distance. It does so by displaying visual information on an augmented reality interface. The persons that are detected are made aware of if they are keeping sufficient distance from others within their proximity. Distances between detected persons are calculated per frame by using a calibration for the position of the camera, an area of interest is defined and an example of 1.5x1.5 meter is given to the system as input. By default, the calculated distances are classified as 'Safe', 'Low risk' or 'High risk' for social distancing.

The system does not store any visual information, and when detected people will be displayed with a smiley overlay to prevent visual recognition.


Project Folder Structure

There are the following folders in the structure:

  1. src: Folder for all source files specific to this project
  2. weights: Folder containing pre-trained model weights
  3. media: Folder containing media files (icons, video)

Installation

  1. Clone this repository:

    git clone --recurse-submodules https://github.com/Amsterdam-AI-Team/1.5-meter-monitor

    If you clone the repo without the --recurse-submodules argument, you could also use the following command to initialize the YOLOv5 submodule:

    git submodule update --init --recursive
    
  2. Install all dependencies:

    pip install -r requirements.txt

Usage

To run with webcam:

$ python main.py --source 0 

To run with example file:

$ python main.py --source media/videos/example.mp4

How it works

Detection

For the detection of persons YOLOv5 is used. YOLO (You Only Look Once), is a network for object detection. It has fast inference speed, allowing for realtime processing and the performance is sufficient for the 1.5 meter monitor. The object detection task consists in determining the location on the image where certain objects are present, as well as classifying those objects. For the creation of the object detection model that is being used, the open dataset COCO (“Common Objects in Context”) has been used. COCO is a large-scale object detection, segmentation, and captioning dataset. It has over 330.000 images, with 250.000 people and 1.5 million objects annotated.

Camera Calibration

Distances are calculated by using a calibration for the position of the camera, a region of interest is defined and an example of 1.5x1.5 meter is given to the system as input. The region of interest is projected in a birds eye view and the 1.5x1.5 meter example is used to calculate the distance between the pedestrians.

More information and implementation details could be found in this blog


Acknowledgements

Our code uses YOLOv5 DOI

Some elements, e.g. the camera calibration strategy and distance calculation, are inspired by deepak112 Social Distancing AI

About

Because of COVID19 measures have been taken to prevent person to person detection, one of the most influential and important new regulation is to keep 1.5 meters distance from each other. To help remind citizens to maintain this distance we have created the 1.5 meter monitor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages