def test_assignment_metrics_with_empty_predictions():
    """Tests metrics when there are no predictions."""
    acc = mm.MOTAccumulator(auto_id=True)
    # Empty predictions.
    acc.update([1, 2, 3, 4], [], [])
    acc.update([1, 2, 3, 4], [], [])
    acc.update([1, 2, 3, 4], [], [])
    acc.update([1, 2, 3, 4], [], [])

    mh = mm.metrics.create()
    metr = mh.compute(acc, return_dataframe=False, metrics=[
        'num_matches', 'num_false_positives', 'num_misses',
        'idtp', 'idfp', 'idfn', 'num_frames',
    ])
    assert metr['num_matches'] == 0
    assert metr['num_false_positives'] == 0
    assert metr['num_misses'] == 16
    assert metr['idtp'] == 0
    assert metr['idfp'] == 0
    assert metr['idfn'] == 16
    assert metr['num_frames'] == 4
Tests metrics when there are no predictions.
motmetrics/tests/test_metrics.py