Implementation of Crowd Counting with YOLO & DeepSort Algorithm

Sreekanth Zipsy
Secure and Private AI Writing Challenge
2 min readAug 17, 2019

In this article i would like to discuss about the implementation we tried to do Crowd Counting & Tracking with Deep Sort-Yolo Algorithm.

This is the Paper most people follow https://arxiv.org/abs/1703.07402 SIMPLE ONLINE AND REALTIME TRACKING WITH A DEEP ASSOCIATION METRIC

Output from the Paper

In this paper they adopt a conventional single hypothesis tracking methodology with recursive Kalman filtering and frame-by-frame data association.

To check the similarity between the frames they used conventional distance metric. Deep Cosine Metric, Metric learning aims to construct an embedding where two extracted features corresponding to the same identity are likely to be closer than features from different identities. This paper presents a method for learning such a feature space where the cosine similarity is effectively optimized through a simple re-parametrization of the conventional softmax classification regime. At test time, the final classification layer can be stripped from the network to facilitate nearest neighbor queries on unseen individuals using the cosine similarity metric.

There are several kind of distance metrics, to name a few: Minkowski Distance, Euclidean Distance, Manhattan Distance,Mahalanobis Distance, Cosine Distance (or) similarity. In this approach we use cosine distance.

Take a look at this wonderful article written by Natasha Sharma: https://towardsdatascience.com/importance-of-distance-metrics-in-machine-learning-modelling-e51395ffe60

For the implementation purpose i used the YOLO pre-trained weights from original site which was trained on COCO dataset & discarded all the classes except the person class for our crowd counting purpose.

As the model is complex, we will get around 10 FPS only….if you can use less complex model like tiny Yolo or train something on our own for person detection we can sure get more than 30 FPS.

Here the picture from my output video

You can check my demo output at this link https://drive.google.com/open?id=1h-XJTDbw_h-v3iaAf_z-1HXVkojOhRNL.

References:

  1. https://github.com/nwojke/cosine_metric_learning
  2. https://github.com/Qidian213/deep_sort_yolov3
  3. https://arxiv.org/abs/1703.07402
  4. https://arxiv.org/abs/1812.00442

--

--