Skip to content

Commit

Permalink
Add track overlap test with gap close
Browse files Browse the repository at this point in the history
  • Loading branch information
Draga Doncila committed Dec 4, 2023
1 parent 92e6acc commit f9d3ecb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/traccuracy/metrics/_track_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,4 @@ def _calc_overlap_score(
max_overlap = max(overlaps)
correct_count += max_overlap
total_count += len(reference_tracklet.edges())

return correct_count / total_count if total_count > 0 else -1
15 changes: 15 additions & 0 deletions tests/metrics/test_track_overlap_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from traccuracy.matchers import Matched
from traccuracy.metrics._track_overlap import TrackOverlapMetrics, _mapping_to_dict

from tests.test_utils import get_gap_close_graphs


def add_frame(tree):
attrs = {}
Expand Down Expand Up @@ -183,6 +185,19 @@ def test_track_overlap_metrics(data, inverse) -> None:
assert results == expected, f"{data['name']} failed without division edges"


def test_track_overlap_gap_close():
g_gt, g_pred, mapping = get_gap_close_graphs()
matched = Matched(
TrackingGraph(g_gt),
TrackingGraph(g_pred),
mapping,
)
metric = TrackOverlapMetrics()
results = metric.compute(matched)
assert results["track_purity"] == 7 / 9
assert results["target_effectiveness"] == 7 / 8


def test_mapping_to_dict():
mapping = [("1", "2"), ("2", "3"), ("1", "3"), ("2", "3")]
mapping_dict = _mapping_to_dict(mapping)
Expand Down

1 comment on commit f9d3ecb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Mean (s) BASE ef50a44 Mean (s) HEAD f9d3ecb Percent Change
test_load_gt_data 1.39667 1.26892 -9.15
test_load_pred_data 1.16082 1.16968 0.76
test_ctc_matched 2.24662 2.22133 -1.13
test_ctc_metrics 0.5703 0.53189 -6.73
test_ctc_div_metrics 0.28662 0.27668 -3.47
test_iou_matched 9.56684 9.48869 -0.82
test_iou_div_metrics 0.27151 0.27021 -0.48

Please sign in to comment.