Crowd Counting 101

Harshita Mittal
4 min readNov 19, 2020

Object detection is a vast domain with a variety of approaches and systems for research and learning. And the real appeal of working with computer vision and deep learning models comes when you see their real-world applications. such as facial identification or vehicle tracking.

We, humans, are able to identify objects of interest in pictures in a couple of seconds. However, it isn’t the same with machines. The good news is- now it’s easier to build object detection applications than ever before!

The COVID-19 pandemic has driven us to come up with new ways of doing everything. Businesses like shopping malls and retail stores, in particular, will have to adapt quickly to reduce and manage crowd capacity to ensure safe practices.

However, adopting crowd counting systems would not only act as an emergency measure for any pandemic; they also provide a variety of advantages that businesses can exploit in the long term. They can help retail stores optimize marketing and operational strategies. The efficient allocation of personnel based on visitor traffic statistics will enhance revenue, profit, and productivity! They can also help manage and better understand the role of spatial distancing, which has become a necessity nowadays.

Modern methods concentrate on the end-to-end pipeline, which has greatly increased performance and helped to build real-time applications.

Crowd Check is one such application that implements deep learning algorithms to estimate the number of people present. It has a social distancing detection feature that will enable a more efficient implementation of social distancing in public places. It is programmed to accept input in the form of a video feed and predicts the crowd count on the video frames created. Users can run their clips or images or live stream video through the model and get instant results.

The application has 2 functionalities:

· People Counter

· Social Distancing Detector

PEOPLE COUNTER
For the People Counter, I have used TensorFlow Object Detection API for near real-time counting on video input. This TensorFlow architecture offers state-of-the-art deep learning models that solve object detection challenges. It is used with the ssd mobilenet model trained on the COCO dataset. You can find other pre-trained models at the TensorFlow model zoo. See the model in action below.

People Counter

Based on the requirements, you can pick a suitable model from the TensorFlow API. the SSD network works best if you need a high-speed model that can operate at high-fps video streams. However single-shot detection achieves speed at the expense of accuracy. FasterRCNN, on the other hand, gives high accuracy but slow speed.

SOCIAL DISTANCING DETECTOR

In the Social Distancing Detector, I used the YOLO v3 Object Detection model on the COCO dataset which is easy to find online, to detect and count social distancing violations based on predefined distance parameters. Besides that, OpenCV and the Deep Neural Network module are the main libraries used. The model is based on-

· Object detection

· Object tracking

· Distance measurement between the detected objects

Surveillance systems can be equipped with this software tool to monitor the practice of social distancing in a huge crowd or public environment. The video below shows the output achieved when monitoring social distancing in a public area with already available street camera footage.

Social Distancing Detector

We can see that the Social Distancing Detector is able to detect if the crowd is following social distancing and marks the people who are not in safe distances with a red box and the safe people with a green box.

For those who are looking for the code, I am also attaching a link to my GitHub repository. To learn more about the Crowd Check system and how the model works, check out: https://youtu.be/XBSgKZxVaBg

--

--