Documentation

  • N/A
  • 2021.4
  • 10/26/2021
  • Public Content

Multi-Camera Detection of Social Distancing on Windows*

Overview

Social distancing is one of the most effective non-pharmaceutical ways to prevent the spread of disease. This Windows* tutorial gives a solution to prevent the spread of disease by using the Inference Engine in the
Intel® Distribution of OpenVINO™ toolkit
and computer vision / Open CV to measure distance between people and store data to
InfluxDB*
. This data can be visualized on a Grafana* dashboard.

How It Works

A multi-camera surveillance solution demonstrates an end-to-end analytics pipeline to detect people and calculates social distance between people from multiple input feeds. Frames are transformed, scaled and normalized into BGR images which can be fed to the Inference Engine in the
Intel® Distribution of OpenVINO™ toolkit
. The steps below are performed for the inference.
  • Apply Intel's person detection model, i.e., person-detection-retail-0013 to detect people from all the video streams.
  • Compute Euclidean distance between all the people from the above step.
  • Based on above measurements, check whether any people are violating N pixels apart.
  • Store total violations count of social distancing data in InfluxDB.
  • Visualize the stored data of InfluxDB on Grafana dashboard.

Get Started

Step 1: Install the Component
The Multi-Camera Detection of Social Distancing component will be installed with the package and will be available in the target system.
Go to the Multi-Camera Detection of Social Distancing component directory which will be available at the path where you started the installation of Edge Insights for Vision from edgesoftware.exe:
C:\Program Files (x86)\Intel\Edge_Insights_for_Vision_2021.4_LTS\Edge_Insights_for_Vision_<version>\RI_Multi_Camera\mcss-covid19\
Where
<version>
is the
Edge Insights for Vision
version selected while downloading.
Step 2: Download the Input Video
The application works better with input feed in which cameras are placed at eye level angle.
Please download sample video at 1280x720 resolution and place it in the
<path_of_edge_insights_vision>\Edge_Insights_for_Vision_<version>\RI_Multi_Camera\mcss-covid19\resources
directory.
Where
<version>
is the
Edge Insights for Vision
version selected while downloading.
(Data set subject to this license. The terms and conditions of the dataset license apply. Intel® does not grant any rights to the data files.)
To use any other video, specify the path
INPUT1
in the
run.py
file inside the application directory.
The application also supports multi-video as input. The appropriate code with comments is available in the
run.py
file inside the application directory.
NUM_CHANNELS=4 INPUT1=p+"\\..\\resources\\Pexels Videos 2670.mp4" MIN_SOCIAL_DIST1==<appropriate_minimum_social_distance_for_input1>
Step 3: Initialize Environment Variables
  1. Go to the bin directory located in the
    Intel® Distribution of OpenVINO™ toolkit
    installation path:
    cd C:\Program Files (x86)\Intel\openvino_2021\bin
  2. Run
    setupvars.bat
  3. Go to the sample application directory in which the Object Detection YOLO V3 Python demo is located:
    cd C:\Users\<username>\Downloads\YOLOv3
Leave the command prompt window open for the next step.

Run the Application

Instructions in this tutorial are provided for two hardware configurations (CPU and GPU). Configure the application by modifying the DEVICE1 parameter.
  1. Go to the application directory of Multi-Camera Detection of Social Distancing component:
    cd C:\Program Files (x86)\Intel\Edge_Insights_for_Vision_2021.4_LTS\Edge_Insights_for_Vision_<version>\RI_Multi_Camera\mcss-covid19\application\
    Where
    <version>
    is the
    Edge Insights for Vision
    version selected while downloading.
  2. Inside the
    run.py
    file, change the following parameters (if required):
    PERSON_DETECTOR=p+"\\..\\intel\\person-detection-retail-0013\\FP16\\person-detection-retail-0013.xml" "DEVICE1="<device>"
    where
    <device>
    can be either
    CPU
    or
    GPU
    .
  3. Run the script from the command prompt:
    python run.py
The following sample output shows the application running on four channels.
You can change application parameters in the
run.py
file.

Data Visualization on Grafana

The application must be running in parallel to view the results in Grafana.
  1. Navigate to
    localhost:3000
    on your browser.
    If browser shows
    localhost refused to connect
    , then make sure Grafana service status is active.
  2. Login with user as
    admin
    and password as
    admin
    .
    You can skip the
    Change Password
    page if it is displayed.
  3. Go to
    Configuration
    and select
    Data Sources
    .
  4. Click
    + Add data source
    , select
    InfluxDB
    , and provide the following details:
    Name:
    Mcss Covid
    URL:
    http://localhost:8086
    Auth: Choose
    Skip TLS Verify
    InfluxDB details:
    Database:
    McssCovid
    HTTPMethod:
    GET
  5. Click
    Save and Test
    .
  6. Click
    +
    icon on the left side of the window, then select
    Import
    .
  7. Choose
    Upload.json File
    and import the
    mcss-covid19/resources/multi_cam.json
    file.
  8. Click on
    Import
    .
  9. Click on
    Multi Camera Covid-19 Solution
    dashboard to view real time violation data.

Summary and Next Steps

This application successfully leverages
Intel® Distribution of OpenVINO™ toolkit
plugins for detecting and measuring distance between the people and storing data to InfluxDB. It can be extended further to provide support for feed from network stream (RTSP camera) and the algorithm can be optimized for better performance.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.