Python package for multiple object tracking research with focus on laboratory animals tracking.

Overview

Build Status

motutils is a Python package for multiple object tracking research with focus on laboratory animals tracking.

Features

  • loads:
  • saves: MOTChallenge CSV
  • Mot, BboxMot and PoseMot classes backed by xarray dataset with frame and id coordinates
  • export to Pandas DataFrame
  • oracle detector: fake all knowing detector based on ground truth with configurable inaccuracies
  • different classes of tracked objects: point, bounding box, pose
  • interpolation of missing positions
  • find mapping between MOT results and ground truth
  • visualization:
    • tracked positions / objects overlaid on a video
    • montage of multiple videos with results and/or ground truth
  • cli
    • visualization
    • evaluation ()
    • mot format conversion

visualization montage

Video comparison of multiple tracking methods and the ground truth.

Installation

pip install git+https://github.com/smidm/motutils

Usage

$ motutils --help
Usage: motutils [OPTIONS] COMMAND [ARGS]...

Options:
--load-mot FILENAME             load a MOT challenge csv file(s)
--load-gt FILENAME              load ground truth from a MOT challenge csv
file
--load-idtracker FILENAME       load IdTracker trajectories (e.g.,
trajectories.txt)
--load-idtrackerai FILENAME     load idtracker.ai trajectories (e.g.,
trajectories_wo_gaps.npy)
--load-sleap-analysis FILENAME  load SLEAP analysis trajectories (exported
from sleap-label File -> Export Analysis
HDF5)
--load-toxtrac FILENAME         load ToxTracker trajectories (e.g.,
Tracking_0.txt)
--toxtrac-topleft-xy 
   
    ...
position of the arena top left corner, see
first tuple in the Arena line in Stats_1.txt
--help                          Show this message and exit.

Commands:
convert    Convert any format to MOT Challenge format.
eval       Evaluate a single MOT file against the ground truth.
visualize  Visualize MOT file(s) overlaid on a video.

   
$ motutils convert --help

Usage: motutils convert [OPTIONS] OUTPUT_MOT

  Convert any format to MOT Challenge format.

$ motutils eval --help

Usage: motutils eval [OPTIONS]

  Evaluate a single MOT file against the ground truth.

Options:
  --write-eval FILENAME  write evaluation results as a CSV file
  --keypoint INTEGER     keypoint to use when evaluating pose MOT results
                         against point ground truth
$ motutils visualize --help

Usage: motutils visualize [OPTIONS] VIDEO_IN VIDEO_OUT
                          [SOURCE_DISPLAY_NAME]...

  Visualize MOT file(s) overlaid on a video.

Options:
  --limit-duration INTEGER  visualization duration limit in s
  --help                    Show this message and exit.

Python API Quickstart

>> mot.ds Dimensions: (frame: 4500, id: 5) Coordinates: * frame (frame) int64 0 1 2 3 4 5 6 ... 4494 4495 4496 4497 4498 4499 * id (id) int64 1 2 3 4 5 Data variables: x (frame, id) float64 434.5 277.7 179.2 ... 185.3 138.6 420.2 y (frame, id) float64 279.0 293.6 407.9 ... 393.3 387.2 294.7 width (frame, id) float64 nan nan nan nan nan ... nan nan nan nan nan height (frame, id) float64 nan nan nan nan nan ... nan nan nan nan nan confidence (frame, id) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0 >>> mot.num_ids() 5 >>> mot.count_missing() 0 >>> mot.get_object(frame=1, obj_id=2) Dimensions: () Coordinates: frame int64 1 id int64 2 Data variables: x float64 278.2 y float64 293.7 width float64 nan height float64 nan confidence float64 1.0 >>> mot.match_xy(frame=1, xy=(300, 300), maximal_match_distance=40) Dimensions: () Coordinates: frame int64 1 id int64 2 Data variables: x float64 278.2 y float64 293.7 width float64 nan height float64 nan confidence float64 1.0 >>> mot.to_dataframe() frame id x y width height confidence 0 1 1 434.5 279.0 -1.0 -1.0 1.0 1 1 2 277.7 293.6 -1.0 -1.0 1.0 2 1 3 179.2 407.9 -1.0 -1.0 1.0 3 1 4 180.0 430.0 -1.0 -1.0 1.0 4 1 5 155.0 397.0 -1.0 -1.0 1.0 ... .. ... ... ... ... ... 22495 4500 1 90.3 341.9 -1.0 -1.0 1.0 22496 4500 2 187.9 431.9 -1.0 -1.0 1.0 22497 4500 3 185.3 393.3 -1.0 -1.0 1.0 22498 4500 4 138.6 387.2 -1.0 -1.0 1.0 22499 4500 5 420.2 294.7 -1.0 -1.0 1.0 [22500 rows x 7 columns]">
>>> from motutils import Mot
>>> mot = Mot("tests/data/Sowbug3_cut.csv")

>>> mot.ds
<xarray.Dataset>
Dimensions:     (frame: 4500, id: 5)
Coordinates:
  * frame       (frame) int64 0 1 2 3 4 5 6 ... 4494 4495 4496 4497 4498 4499
  * id          (id) int64 1 2 3 4 5
Data variables:
    x           (frame, id) float64 434.5 277.7 179.2 ... 185.3 138.6 420.2
    y           (frame, id) float64 279.0 293.6 407.9 ... 393.3 387.2 294.7
    width       (frame, id) float64 nan nan nan nan nan ... nan nan nan nan nan
    height      (frame, id) float64 nan nan nan nan nan ... nan nan nan nan nan
    confidence  (frame, id) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0

>>> mot.num_ids()
5

>>> mot.count_missing()
0

>>> mot.get_object(frame=1, obj_id=2)
<xarray.Dataset>
Dimensions:     ()
Coordinates:
    frame       int64 1
    id          int64 2
Data variables:
    x           float64 278.2
    y           float64 293.7
    width       float64 nan
    height      float64 nan
    confidence  float64 1.0

>>> mot.match_xy(frame=1, xy=(300, 300), maximal_match_distance=40)
<xarray.Dataset>
Dimensions:     ()
Coordinates:
    frame       int64 1
    id          int64 2
Data variables:
    x           float64 278.2
    y           float64 293.7
    width       float64 nan
    height      float64 nan
    confidence  float64 1.0

>>> mot.to_dataframe()
       frame  id      x      y  width  height  confidence
0          1   1  434.5  279.0   -1.0    -1.0         1.0
1          1   2  277.7  293.6   -1.0    -1.0         1.0
2          1   3  179.2  407.9   -1.0    -1.0         1.0
3          1   4  180.0  430.0   -1.0    -1.0         1.0
4          1   5  155.0  397.0   -1.0    -1.0         1.0
      ...  ..    ...    ...    ...     ...         ...
22495   4500   1   90.3  341.9   -1.0    -1.0         1.0
22496   4500   2  187.9  431.9   -1.0    -1.0         1.0
22497   4500   3  185.3  393.3   -1.0    -1.0         1.0
22498   4500   4  138.6  387.2   -1.0    -1.0         1.0
22499   4500   5  420.2  294.7   -1.0    -1.0         1.0
[22500 rows x 7 columns]

Documentation

See the quickstart and tests for now.

Write me if you would like to use the package, but the lack of documentation is hindering you. You can easily reorder my priorities on this simply just by letting me know that there is an interest.

You might also like...
Multiple Object Tracking with Yolov5!

Tracking with yolov5 This implementation is for who need to tracking multi-object only with detector. You can easily track mult-object with your well

A modular framework for vision & language multimodal research from Facebook AI Research (FAIR)

MMF is a modular framework for vision and language multimodal research from Facebook AI Research. MMF contains reference implementations of state-of-t

Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Object Detection and Multi-Object Tracking
Object Detection and Multi-Object Tracking

Object Detection and Multi-Object Tracking

SiamMOT is a region-based Siamese Multi-Object Tracking network that detects and associates object instances simultaneously.
TSDF++: A Multi-Object Formulation for Dynamic Object Tracking and Reconstruction

TSDF++: A Multi-Object Formulation for Dynamic Object Tracking and Reconstruction TSDF++ is a novel multi-object TSDF formulation that can encode mult

Object tracking and object detection is applied to track golf puts in real time and display stats/games.

Putting_Game Object tracking and object detection is applied to track golf puts in real time and display stats/games. Works best with the Perfect Prac

Multiple paper open-source codes of the Microsoft Research Asia DKI group
Multiple paper open-source codes of the Microsoft Research Asia DKI group

📫 Paper Code Collection (MSRA DKI Group) This repo hosts multiple open-source codes of the Microsoft Research Asia DKI Group. You could find the corr

Official PyTorch implementation of MX-Font (Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Experts)

Introduction Pytorch implementation of Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Expert. | paper Song Park1

Owner
Matěj Šmíd
Matěj Šmíd
SciKit-Learn Laboratory (SKLL) makes it easy to run machine learning experiments.

SciKit-Learn Laboratory This Python package provides command-line utilities to make it easier to run machine learning experiments with scikit-learn. O

ETS 528 Nov 25, 2022
FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.

Detectron is deprecated. Please see detectron2, a ground-up rewrite of Detectron in PyTorch. Detectron Detectron is Facebook AI Research's software sy

Facebook Research 25.5k Jan 7, 2023
Code of U2Fusion: a unified unsupervised image fusion network for multiple image fusion tasks, including multi-modal, multi-exposure and multi-focus image fusion.

U2Fusion Code of U2Fusion: a unified unsupervised image fusion network for multiple image fusion tasks, including multi-modal (VIS-IR, medical), multi

Han Xu 129 Dec 11, 2022
Yolox-bytetrack-sample - Python sample of MOT (Multiple Object Tracking) using YOLOX and ByteTrack

yolox-bytetrack-sample YOLOXとByteTrackを用いたMOT(Multiple Object Tracking)のPythonサン

KazuhitoTakahashi 12 Nov 9, 2022
QuakeLabeler is a Python package to create and manage your seismic training data, processes, and visualization in a single place — so you can focus on building the next big thing.

QuakeLabeler Quake Labeler was born from the need for seismologists and developers who are not AI specialists to easily, quickly, and independently bu

Hao Mai 15 Nov 4, 2022
Multiple-Object Tracking with Transformer

TransTrack: Multiple-Object Tracking with Transformer Introduction TransTrack: Multiple-Object Tracking with Transformer Models Training data Training

Peize Sun 537 Jan 4, 2023
Quasi-Dense Similarity Learning for Multiple Object Tracking, CVPR 2021 (Oral)

Quasi-Dense Tracking This is the offical implementation of paper Quasi-Dense Similarity Learning for Multiple Object Tracking. We present a trailer th

ETH VIS Research Group 327 Dec 27, 2022
Probabilistic Tracklet Scoring and Inpainting for Multiple Object Tracking

Probabilistic Tracklet Scoring and Inpainting for Multiple Object Tracking (CVPR 2021) Pytorch implementation of the ArTIST motion model. In this repo

Fatemeh 38 Dec 12, 2022
Implementation of the CVPR 2021 paper "Online Multiple Object Tracking with Cross-Task Synergy"

Online Multiple Object Tracking with Cross-Task Synergy This repository is the implementation of the CVPR 2021 paper "Online Multiple Object Tracking

null 54 Oct 15, 2022
This repository is an official implementation of the paper MOTR: End-to-End Multiple-Object Tracking with TRansformer.

MOTR: End-to-End Multiple-Object Tracking with TRansformer This repository is an official implementation of the paper MOTR: End-to-End Multiple-Object

null 348 Jan 7, 2023