motmetrics is a Python library providing a comprehensive suite of metrics for benchmarking multiple object trackers (MOT). It simplifies the evaluation of tracker performance by handling associations between ground truth and hypothesis data, and calculating standard metrics like MOTA, MOTP, and more. The current version is 1.4.0, with an active but infrequent release cadence focused on maintenance and bug fixes.
pip install motmetricsVerified import paths — ran on the pinned version, not inferred.
Initialize a `MOTAccumulator`, then iterate frame by frame. For each frame, compute a distance matrix (e.g., IoU) between ground truth and tracker hypotheses bounding boxes, and update the accumulator. Finally, use `motmetrics.metrics.create()` to compute and display standard MOT metrics.
Upgrade motmetrics to version 1.4.0 or higher to resolve this: `pip install --upgrade motmetrics`.
Ensure you are using motmetrics 1.4.0 or newer for accurate distance calculations, especially when using `motmetrics.utils.compare_to_groundtruth` with non-IoU metrics.
Always ensure your bounding box data is in `[x, y, width, height]` format (often referred to as `xywh`) when passed to `motmetrics` distance functions like `iou_matrix`. Adjust your data preprocessing if necessary.
Before passing ground truth and hypothesis IDs to `acc.update()`, verify that `gt_frame_ids` and `ts_frame_ids` contain unique identifiers for objects present in that specific frame.
Import it from the `metrics` submodule: `from motmetrics.metrics import create` or access it as `mm.metrics.create()` if you imported `motmetrics as mm`.
Ensure you are passing numpy arrays of shape `(N, 4)` (for N bounding boxes in `xywh` format) as the first two arguments to `iou_matrix`, not attempting to call an array object itself.
Verify that the number of ground truth IDs (`gt_ids.shape[0]`) matches the number of rows in your distance matrix (`C.shape[0]`), and similarly for hypothesis IDs (`ts_ids.shape[0] == C.shape[1]`) for the `acc.update(gt_ids, ts_ids, C)` call. The distance matrix `C` must precisely match the counts of ground truth and hypothesis objects for the current frame.
No dependency data recorded yet.