Introduction

Social Distancing — the term that has taken the whole world by storm and is transforming the way we live. Social distancing also called “physical distancing”, means keeping a safe space between yourself and other people who are not from your household. As the country has started to unlock amid surging COVID-19 cases, maintaining social distancing has become a key issue. The biggest concern revolving around the COVID-19 situation is how quickly the infection spreads from one person to another through contact or even being within proximity of an infected person. Social Distancing is here to stay longer than expected to fight Covid-19.

So this got me thinking to develop an AI model to detect if people are following social distancing and at the same time are wearing masks. So here is a sample of the outcome of the model. With the use of deep learning and OpenCV, we can extract interesting insights from video clips. Red bounding boxes indicate that the person is in the proximity of another person and the blue box indicates the person is maintaining social distance. And we have separate bounding boxes for identifying if the person is wearing a mask or not.

Image for post

You can find the code I used on my Github Repo.

Overview of the steps

The TensorFlow object detection API is the framework for creating a deep learning network that solves object detection problems. The API provides pre-trained object detection models which they refer to as Model Zoo, have been trained on the COCO dataset. The Common Objects in Context (COCO) dataset has 200,000 images with more than 500,000 object annotations in 90 commonly found objects. See the image below of objects that are part of the COCO dataset.

Image for post

In this case, we care about class ‘Person’ which is part of the COCO dataset.

The API also has a big set of models it supports. See the table below for reference.

#computer-vision #artificial-intelligence #data-science

A Social Distancing using a Tensorflow object detection model, Python and OpenCV
24.25 GEEK