Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pyrecest/evaluation/tracking_metrics/_clear_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions tests/evaluation/test_tracking_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]],
Expand Down
Loading