需要 Python 3.8 至 3.14;MOTP 输出的是平均距离而非百分比,需用 (1 - MOTP) * 100 换算成 MOTChallenge 口径;FAR 不直接给出,需自行按每帧误检数计算
py-motmetrics
cheindMIT活跃维护用 Python 对多目标跟踪器做基准评测,计算 CLEAR MOT 等标准指标,方便横向对比不同跟踪算法的效果。
:bar_chart: Benchmark multiple object trackers (MOT) in Python
pip install motmetricsREADME 未说明,纯 Python 计算,无 GPU 或显存要求
用 Python 评估多目标跟踪结果的工具库,对齐 MOTChallenge 指标,快速算出 MOTA、IDF1、HOTA
用 Python 对多目标跟踪器做基准评测,计算 CLEAR MOT 等标准指标,方便横向对比不同跟踪算法的效果。
核心能力
- 实现 CLEAR MOT、Identity 与 HOTA 系列指标
- 一行 evaluate_motchallenge 自动识别格式并输出指标表
- 支持 MOTChallenge、VATIC、UA-DETRAC 的文本与 MAT/XML 格式
- 提供 MOTAccumulator 累积帧级匹配事件,可自定义指标
- 内置 IoU、欧氏距离等距离矩阵辅助函数
容易踩的坑
- v1.4.0最新正式版2024-10-30 · 2024-10-30 19:45 UTC
What's Changed
- Correct usage of euclidean distances in motmetrics.utils.compare_to_groundtruth() by @angelcarro in https://github.com/cheind/py-motmetrics/pull/168
- Update eval_detrac.py by @Ardeshir-Shon in https://github.com/cheind/py-motmetrics/pull/171
- Get ride of np.bool deprecation warning. by @alexlitz in https://github.com/cheind/py-motmetrics/pull/155
New Contributors
- @Ardeshir-Shon made their first contribution in https://github.com/cheind/py-motmetrics/pull/171
Full Changelog: https://github.com/cheind/py-motmetrics/compare/v1.3.0...v1.4.0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
py-motmetrics
py-motmetrics provides Python tools for evaluating multiple object tracking (MOT) results. It implements MOTChallenge-aligned CLEAR MOT, Identity, and HOTA-related metrics, including MOTA, MOTP, IDF1, precision, recall, and track quality counts.
Installation
pip install motmetrics
Python 3.8 through 3.14 is supported.
For development:
uv venv
uv pip install --group dev
Quick Start
For MOTChallenge-style text files, compute and print metrics in one call. Supported file formats are detected automatically.
import motmetrics as mm
summary = mm.evaluate_motchallenge("path/to/gt.txt", "path/to/pred.txt")
print(summary)
summary displays as a MOTChallenge-style table and keeps the raw pandas data available:
summary.mota
summary.idf1
summary.hota
summary.df.to_csv("metrics.csv")
By default, evaluate_motchallenge uses fmt="auto". It detects MOTChallenge text, VATIC text, and UA-DETRAC .mat/.xml files. For ambiguous text files, pass the format explicitly:
summary = mm.evaluate_motchallenge(gt, pred, fmt=mm.io.Format.MOT16)
Folder evaluation uses the same function:
summary = mm.evaluate_motchallenge("path/to/gt_root", "path/to/preds_root")
print(summary)
Expected folder layout:
gt_root/<SEQUENCE>/gt/gt.txt
preds_root/<SEQUENCE>.txt
The command-line evaluator is still available:
python -m motmetrics.apps.eval_motchallenge path/to/gt_root path/to/preds_root
Metrics
List all registered metrics:
import motmetrics as mm
print(mm.list_metrics_markdown())
The default MOTChallenge summary includes the commonly reported CLEAR, Identity, and HOTA metrics.
Advanced Use
Useful lower-level pieces:
mm.MOTAccumulatorstores frame-level matching events.mm.distancescontains distance helpers such as IoU and Euclidean matrices.mm.io.loadtxt(..., fmt="auto")detects MOTChallenge text, VATIC text, and UA-DETRAC MAT/XML files.mm.metrics.create()returns aMetricsHostfor custom metric selection.mm.utils.compare_to_groundtruthcompares loaded dataframes directly.mm.utils.compare_to_groundtruth_reweightingsupports custom HOTA-style multi-threshold workflows.
For the full HOTA/CLEAR/Identity parity check against TrackEval, see motmetrics/tests/test_trackeval_parity.py.
MOTChallenge Notes
Results are aligned with the MOTChallenge devkit, with two naming/format differences:
FARis not listed directly; it can be computed as false positives per frame.- MOTChallenge reports MOTP as a percentage, while py-motmetrics reports the average distance. Convert with
(1 - MOTP) * 100for MOTChallenge-style MOTP.
Development
Run the test suite:
uv run --no-project pytest
Run the TrackEval parity test locally:
uv pip install trackeval==1.3.0
uv run --no-project pytest -q motmetrics/tests/test_trackeval_parity.py
References
- Bernardin, Keni, and Rainer Stiefelhagen. "Evaluating multiple object tracking performance: the CLEAR MOT metrics." EURASIP Journal on Image and Video Processing, 2008.
- Milan, Anton, et al. "MOT16: A benchmark for multi-object tracking." arXiv preprint arXiv:1603.00831, 2016.
- Li, Yuan, Chang Huang, and Ram Nevatia. "Learning to associate: HybridBoosted multi-target tracker for crowded scene." CVPR, 2009.
- Ristani, Ergys, et al. "Performance Measures and a Data Set for Multi-Target, Multi-Camera Tracking." ECCV Workshop, 2016.
License
MIT. See LICENSE.