From 91f50274e693a735e306d0506e9df2abdcff9e57 Mon Sep 17 00:00:00 2001 From: Florian Pfaff <6773539+FlorianPfaff@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:24:02 +0800 Subject: [PATCH 1/2] Reset CLEAR continuity after unmatched frames --- src/pyrecest/evaluation/tracking_metrics/_clear_identity.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pyrecest/evaluation/tracking_metrics/_clear_identity.py b/src/pyrecest/evaluation/tracking_metrics/_clear_identity.py index 46f898a67..e4debd70d 100644 --- a/src/pyrecest/evaluation/tracking_metrics/_clear_identity.py +++ b/src/pyrecest/evaluation/tracking_metrics/_clear_identity.py @@ -46,9 +46,11 @@ def evaluate_clear(data: TrackingSequence, *, threshold: float) -> ClearCounts: ): if len(gt_ids) == 0: fp += len(tracker_ids) + previous_timestep_id[:] = np.nan continue if len(tracker_ids) == 0: fn += len(gt_ids) + previous_timestep_id[:] = np.nan continue continuity = tracker_ids[np.newaxis, :] == previous_timestep_id[gt_ids[:, None]] score = continuity.astype(float) * 1000.0 + similarity From 2bc4c1046e234b32dbbd3ad493f103496febbe36 Mon Sep 17 00:00:00 2001 From: Florian Pfaff <6773539+FlorianPfaff@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:24:31 +0800 Subject: [PATCH 2/2] Test CLEAR continuity reset across gaps --- tests/evaluation/test_tracking_metrics.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/evaluation/test_tracking_metrics.py b/tests/evaluation/test_tracking_metrics.py index c98d47119..56afa0273 100644 --- a/tests/evaluation/test_tracking_metrics.py +++ b/tests/evaluation/test_tracking_metrics.py @@ -82,6 +82,26 @@ def test_identity_switch_reduces_association_metrics() -> None: assert finalize_identity(identity_counts)["idf1"] == pytest.approx(0.5) +def test_clear_continuity_does_not_cross_unmatched_frames() -> None: + data = _sequence( + [[0, 1], [0, 1], [0, 1]], + [[0, 1], [], [0, 1]], + [ + [[1.0, 0.0], [0.0, 1.0]], + [[], []], + [[0.6, 0.9], [0.9, 0.6]], + ], + num_gt_ids=2, + num_tracker_ids=2, + ) + + counts = evaluate_clear(data, threshold=0.5) + + assert (counts.tp, counts.fp, counts.fn) == (4, 0, 2) + assert counts.id_switches == 2 + assert counts.motp_sum == pytest.approx(3.8) + + def test_hota_uses_multiple_localization_thresholds() -> None: data = _sequence( [[0]],