---
# System prepended metadata

title: Track and count people with head detection and Deep Sort

---

# Track and count people with head detection and Deep Sort

Demo result https://drive.google.com/file/d/1qxRkdQz_3gOTfZ6GBUq6sDiiWnp5Dnhe/view

## Pseudo direction
![](https://i.imgur.com/mCtcMkh.png)



## Manually counting result
* Go from North to South and the heads cross the line: 14 people
* Go from South to North and the heads cross the line: 24 people
* Go from South to North and the heads didn't cross the line: 7 people (at the begining time of the video)
* Go from North to South and the heads didn't cross the line: 2 people. Their heads went out the frame before crossing the line.
* Go other directions and the heads didn't go cross the line: 14 people


## Auto counting method
* Use [LSC-CNN](https://arxiv.org/pdf/1906.07538.pdf) model to detect the heads
* Track the heads with DeepSort
* Count when the heads cross the defined line


## Auto counting result
The model only counts the people that their heads cross the line.

* Go from North to South and the heads cross the line: 14 people => Error rate 0%
* Go from South to North and the heads cross the line: 25 people => Error rate = 1/24 = 4.17%
* Total (both NS and SN directions and cross the line)
    * Manually counting: 38 people.
    * Auto counting: 39 people.
    * Error rate: 1/38 = 2.63%


## Some notes and example pictures

* The video is recorded at the cross road therefore there are also other directions that people can move but we didn't count in this demo.
* All the people that already crossed the line at the first frame will not be counted.
* There are 2 people went from North to South, but their heads were out of the video frame before crossing the line (but the lower part of bodys are still in the frame). We should choose the better angle to record the video so we can avoid or reduce these cases.


![](https://i.imgur.com/KagR1rI.jpg)
7 people that already crossed the line at the begining of the video will not be counted.


![](https://i.imgur.com/ajjMUVV.jpg)
The head of the person on the right side is out of frame before crossing the line, but the body still in the frame.

![](https://i.imgur.com/vVBighG.png)
The person went from the East to the North but his head didn't cross the line, so he will not be counted.

![](https://i.imgur.com/umCEK4P.jpg)
The guy went from the West to the East, his head didn't cross the line so will not be counted too.