Skip to main content

Multi-object trackers in Python

Project description

Multi-object trackers in Python

Easy to use implementation of various multi-object tracking algorithms.

DOI

YOLOv3 + CentroidTracker TF-MobileNetSSD + CentroidTracker
Cars with YOLO Cows with tf-SSD
Video source: link Video source: link

Available Multi Object Trackers

  • CentroidTracker
  • IOUTracker
  • CentroidKF_Tracker
  • SORT

Available OpenCV-based object detectors:

  • detector.TF_SSDMobileNetV2
  • detector.Caffe_SSDMobileNet
  • detector.YOLOv3

Installation

Pip install for OpenCV (version 3.4.3 or later) is available here and can be done with the following command:

pip install motrackers

Additionally, you can install the package through GitHub instead:

git clone https://github.com/adipandas/multi-object-tracker
cd multi-object-tracker
pip install [-e] .

Note - for using neural network models with GPU
For using the opencv dnn-based object detection modules provided in this repository with GPU, you may have to compile a CUDA enabled version of OpenCV from source.

  • To build opencv from source, refer the following links: [link-1], [link-2]

How to use?: Examples

The interface for each tracker is simple and similar. Please refer the example template below.

from motrackers import CentroidTracker # or IOUTracker, CentroidKF_Tracker, SORT
input_data = ...
detector = ...
tracker = CentroidTracker(...) # or IOUTracker(...), CentroidKF_Tracker(...), SORT(...)
while True:
    done, image = <read(input_data)>
    if done:
        break
    detection_bboxes, detection_confidences, detection_class_ids = detector.detect(image)
    # NOTE: 
    # * `detection_bboxes` are numpy.ndarray of shape (n, 4) with each row containing (bb_left, bb_top, bb_width, bb_height)
    # * `detection_confidences` are numpy.ndarray of shape (n,);
    # * `detection_class_ids` are numpy.ndarray of shape (n,).
    output_tracks = tracker.update(detection_bboxes, detection_confidences, detection_class_ids)
    # `output_tracks` is a list with each element containing tuple of
    # (<frame>, <id>, <bb_left>, <bb_top>, <bb_width>, <bb_height>, <conf>, <x>, <y>, <z>)
    for track in output_tracks:
        frame, id, bb_left, bb_top, bb_width, bb_height, confidence, x, y, z = track
        assert len(track) == 10
        print(track)

Please refer examples folder of this repository for more details. You can clone and run the examples.

Pretrained object detection models

You will have to download the pretrained weights for the neural-network models. The shell scripts for downloading these are provided here below respective folders. Please refer DOWNLOAD_WEIGHTS.md for more details.

Notes

  • There are some variations in implementations as compared to what appeared in papers of SORT and IoU Tracker.
  • In case you find any bugs in the algorithm, I will be happy to accept your pull request or you can create an issue to point it out.

References, Credits and Contributions

Please see REFERENCES.md and CONTRIBUTING.md.

Citation

If you use this repository in your work, please consider citing it with:

@misc{multiobjtracker_amd2018,
  author = {Deshpande, Aditya M.},
  title = {Multi-object trackers in Python},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/adipandas/multi-object-tracker}},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motrackers-0.0.2.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

motrackers-0.0.2-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file motrackers-0.0.2.tar.gz.

File metadata

  • Download URL: motrackers-0.0.2.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for motrackers-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0c2b2b0d2c2cfc148b13eae6714b37c3872618a6e6247d39dd8808ff0b2c4520
MD5 fc7c510277fd76111eb0f969615452b5
BLAKE2b-256 1cb7b946b52a40fe7da12e2541a1053e2b21d0a1ad305a9776eea7b93fabb709

See more details on using hashes here.

File details

Details for the file motrackers-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: motrackers-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for motrackers-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d372f6d27d698cd94f683f6328eccab2dbe8be13730ddc88773bf3064b26622
MD5 edefb21d257061ac3be51adf4e25d4e6
BLAKE2b-256 42bfc03bc0ce8089479bdd8b1745490037f5387e75219a29d436a9328482eafb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page