Skip to main content

Tracking-by-detection (MOT) package

Project description

Motrack: Multi-Object Tracking Library

Introduction

Motrack is a versatile multi-object tracking library designed to leverage the tracking-by-detection paradigm. It supports a range of tracker algorithms and object detections, making it ideal for applications in various domains.

Usage

Pseudocode for tracker utilization:

from motrack.object_detection import YOLOv8Inference
from motrack.tracker import ByteTracker, TrackletState

tracker = ByteTracker()  # Default parameters
tracklets = []
yolo = YOLOv8Inference(...)

video_frames = read_video(video_path)

for i, image in enumerate(video_frames):
  detections = yolo.predict_bboxes(image)
  tracklets = tracker.track(tracklets, detections, i)
  active_tracklets = [t for t in tracklets if t.state == TrackletState.ACTIVE]

  foo_bar(active_tracklets)

This library offers flexibility to use any custom object detector.

Implementation of custom tracker:

from typing import List, Tuple

from motrack.library.cv.bbox import PredBBox
from motrack.tracker import Tracker, Tracklet


class MyTracker(Tracker):
  def track(
    self,
    tracklets: List[Tracklet],
    detections: List[PredBBox],
    frame_index: int
  ) -> List[Tracklet]:
    ... Tracker logic ...

    return tracklets

Similarly, custom object detection inference, filter, association method or dataset can also be implemented and seamlessly combined with other components.

Features

Supported tracker algorithms

Method Name Description
SORT arxiv: Simple Online and Realtime Tracking
DeepSORT arxiv: SIMPLE ONLINE AND REALTIME TRACKING WITH A DEEP ASSOCIATION METRIC
MoveSORT SORT with improved association method
ByteTrack arxiv: ByteTrack: Multi-Object Tracking by Associating Every Detection Box
Bot-SORT arxiv: BoT-SORT: Robust Associations Multi-Pedestrian Tracking
SparseTrack arxiv: SparseTrack: Multi-Object Tracking by Performing Scene Decomposition based on Pseudo-Depth

Evaluation of these methods on different datasets can be found in evaluation.md

Supported object detection algorithms

Method Name Description
YOLOX arxiv: Simple Online and Realtime Tracking
YOLOv8 github: Ultralytics YOLOv8

Use motrack/create_yolo_format.py to create YOLOv8 training dataset and motrack/create_coco_format.py to create YOLOX training dataset.

FastReID integration

Any FastReID model for appearance matching can be used. Model has to be exported in ONNX. Please check deploy documentation for mode info. Use scrips/create_fastreid_patches.py to create fast-reid dataset in order to train an appearance model.

Supported datasets

Currently supported datasets are: MOT17, MOT20, DanceTrack and SportsMOT.

Any custom dataset can be added by extending the base dataset.

Tools

List of script tools:

  • Inference: Perform any tracker inference that can directly evaluated with TrackEval framework.
  • Postprocess: Perform offline postprocessing (linear interpolation, etc...) for more accuracy tracklets.
  • Visualize: Visualize tracker inference.

Evaluation

Evaluation of different supported methods can be found here.

Installation

Run these commands to install package within your virtual environment or docker container.

pip install motrack

Package page can be found on PyPI.

Extensions

In order to use YOLOv8 for inference, please install ultralytics library:

pip install ultralytics

or install extras motrack['yolov8']:

pip install `motrack['yolov8']`

For FastReID inference, please install onnxruntime for CPU:

pip install onnxruntime

or GPU:

pip install onnxruntime-gpu

In order to use motrack-motion filters, use:

pip install `motrack['motion']`

Changelog

Package changelog can be found here

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

motrack-0.6.0.tar.gz (70.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

motrack-0.6.0-py3-none-any.whl (106.8 kB view details)

Uploaded Python 3

File details

Details for the file motrack-0.6.0.tar.gz.

File metadata

  • Download URL: motrack-0.6.0.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.7

File hashes

Hashes for motrack-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8812eb2e4d32525796f44f459d5cb7f5b6db0725ae075e7b44bb6d99205e079b
MD5 bd3fb3072f01be2cc6fdcb421aa8129b
BLAKE2b-256 3f971458dd53445b22b0e24906f497183bb5ffbd6b158528972a23b04b1c5c81

See more details on using hashes here.

File details

Details for the file motrack-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: motrack-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 106.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.7

File hashes

Hashes for motrack-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8897ed8273518a25ad4b9f5033e53e3975c32fe34e7719e4717f3012f40a2ee0
MD5 2fd7d851623d2dd07412a3b0c688bb32
BLAKE2b-256 26a3942b9e4a65a63c7e85354875d40f3034ff5c10037ef1b3dc2323cd132db3

See more details on using hashes here.

Supported by

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