{"library":"motmetrics","title":"Multiple Object Tracking Metrics (motmetrics)","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install motmetrics"],"cli":null},"imports":["from motmetrics import MOTAccumulator","from motmetrics.distances import iou_matrix","from motmetrics.metrics import create"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import motmetrics as mm\nimport numpy as np\n\n# Dummy data: Ground truth and tracker hypotheses for two frames\n# Format: [id, x, y, width, height] for bounding box coordinates\ngt_frame1 = np.array([[1, 10, 10, 5, 5], [2, 20, 20, 5, 5]])\nts_frame1 = np.array([[1, 10, 10, 5, 5], [2, 20, 20, 5, 5]])\n\ngt_frame2 = np.array([[1, 11, 11, 5, 5], [2, 21, 21, 5, 5]])\nts_frame2 = np.array([[1, 11, 11, 5, 5], [2, 21, 21, 5, 5]])\n\n# Create an accumulator to store tracking results\nacc = mm.MOTAccumulator(auto_id=True)\n\n# Process Frame 1:\n# Calculate Intersection over Union (IoU) distances between ground truth and hypotheses\n# Bounding boxes are expected as [x, y, width, height]\nC1 = mm.distances.iou_matrix(gt_frame1[:, 1:], ts_frame1[:, 1:], max_iou=0.5)\nacc.update(gt_frame1[:, 0], ts_frame1[:, 0], C1)\n\n# Process Frame 2:\nC2 = mm.distances.iou_matrix(gt_frame2[:, 1:], ts_frame2[:, 1:], max_iou=0.5)\nacc.update(gt_frame2[:, 0], ts_frame2[:, 0], C2)\n\n# Compute and display metrics\nmh = mm.metrics.create()\nsummary = mh.compute(acc, metrics=['mota', 'motp', 'num_frames'], name='dummy_tracking')\nprint(summary)","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}