Home

Awesome

<h1 align='center'> Multi-Camera Live Object Tracking </h1>

This repository contains my object detection and tracking projects. All of these can be hosted on a cloud server.

You can also use your own IP cameras with asynchronous processing thanks to ImageZMQ. I've written a blog post on how to stream using your own smartphones with ImageZMQ here.

Deep SORT and YOLO v4

Check out my Deep SORT repository to see the tracking algorithm that I used which includes the options for Tensorflow 2.0, asynchronous video processing, and low confidence track filtering.


Traffic Counting (Link)

This project is an extension of the object counting app.

<div align='center'> <img src="gifs/traffic_counting1.gif" width="80%"/> </div>

(Full video)

Features

Note that since DETRAC doesn't contain any motorcycles, they are the only vehicles that are ignored. Additionally, the DETRAC dataset only contains images of traffic in China, so it struggles to correctly detect certain vehicles in other countries due to lack of training data. For example, it can frequently misclassify hatchbacks as SUVs, or not being able to detect taxis due to different colour schemes.


Object Counting (Link)

This project was originally intended to be an app for counting the current number of people in multiple rooms using my own smartphones, where the server would be remotely hosted. Below shows detection, tracking, and counting of people and cars.

<div align='center'> <img src="gifs/object_counting2.gif" width="50%"/> </div>

Features


Using my own smartphones as IP cameras

<div align='center'> <img src="gifs/object_counting1.gif" width="50%"/> </div>

Training your own vehicle tracking model (Link)

I trained a YOLO v4 and Deep SORT model using the DETRAC training dataset with v3 annotations. I've provided the scripts for converting the DETRAC training images and v3 annotations into the correct format for training both the YOLO v4 model as well as the Deep SORT tracking model.

I had to train the YOLO v4 model using Darknet and then convert it to Keras format using convert.py from the Keras-to-YOLOv4 repository. The Deep SORT model was trained using cosine metric learning.

If you don't want to train your own models, this repository already includes the trained Deep SORT model (mars-small128.pb) from the original Deep SORT repository. Follow the instructions in the Keras-to-YOLOv4 repository for downloading and converting an already trained Darknet YOLO v4 model to Keras format.Alternatively, you can also find these in my Deep SORT and YOLOv4 repository

Please note that if you decide not to train your own models, the vehicle tracking performance will most likely be worse than if you trained your own models on the DETRAC dataset or any other traffic dataset. This is mainly because the original Deep SORT model (mars-small128.pb) was trained on tracking people and not vehicles. However, if your goal is to use this app to count people then this shouldn't be much of an issue.

Deep SORT conversion parameters

DETRAC images are converted into the Market 1501 training format.

YOLO conversion parameters

DETRAC images are converted into the Darknet YOLO training format.

Both models were trained and evaluated on the DETRAC training set, but no evaluation has been done yet on the test set due to lack of v3 annotations and I don't have MATLAB for the Deep SORT evaluation software. It's been good enough though for my use case so far.


Hardware used

To give some idea of what do expect, I could run two traffic counting streams at around 10fps each (as you can see in the traffic counting gif). Of course, this heavily depends on stream resolution and how many frames are being processed for detection and tracking.


YOLO v3 vs. YOLO v4

I used YOLO v3 when I first started the object counting project which gave me about ~10FPS with tracking, making it difficult to run more than one stream at a time. Using YOLO v4 made it much easier to run two streams with a higher resolution, as well as giving a better detection accuracy.


Dependencies

This project was built and tested on Python 3.6. You can use the conda environment file to set up all dependencies.

If environment.yml isn't working, try environment_windows.yml if you're on a Windows machine.


Credits