/ Machine Learning

Code for estimating social distances from RGB cameras

Code for estimating social distances from RGB cameras

Social-Distancing

Social-Distancing is an open-source project for automatically estimating interpersonal distance from uncalibrated RGB cameras. The software can be freely used for any non-commercial applications to assess compliance with safe distances. The code is open and can be improved with your support, please contact us at [email protected] if you would like to help us.

social-distancing

Installation steps

Code is developed in Python3 and tested on Ubuntu 18.04 with NVidia driver, Cuda 10.0 and Cudnn 7.6.5.

  • [x] Install the requirements
    To run this code, you need to install:

    • OpenPose:
      Please follow the instruction in the repository gitHub and install OpenPose in social-distancing/openpose/ folder.
      In case you prefer to use a different OpenPose installation folder, you can pass it using the --openpose_folder argument.

    • OpenCV:
      apt-get install python3-opencv
      pip3 install opencv-python

Usage

python3 social-distancing.py -h  #help

Images

python3 social-distancing.py --image_in <path to the input image> --image_out <path to the result image to be saved> --horizontal_ratio 0.7 --vertical_ratio 0.7

Videos

python3 social-distancing.py --stream_in [path to the input video] --stream_out [path to the result video] --horizontal_ratio 0.7 --vertical_ratio 0.7

Network stream

python3 social-distancing.py --preview disabled --streaming enabled --video_port [port] --js_port [js_port] --stream_in [ address ]

Dataset

We tested Social-Distancing code on the public ShanghaiTech'dataset.

@inproceedings{zhang2016single,
  title={Single-image crowd counting via multi-column convolutional neural network},
  author={Zhang, Yingying and Zhou, Desen and Chen, Siqin and Gao, Shenghua and Ma, Yi},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  pages={589--597},
  year={2016}
}

Disclaimer

Information provided by the software is to be intended as an indication of safe distance compliance. It is not intended to measure the actual metric distance among people.

The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors, PAVIS or IIT be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

GitHub

Comments