refactor(registry): only keep identified tracks associable while dormant

candidates() now excludes dormant (off-screen) tracks that were never
identified: an unowned dormant track has no actor to re-attach to, so
keeping it in the association pool only enlarges the matcher's per-frame
comparison set and invites a new face re-associating onto an anonymous
stub. On-screen tracks are always candidates; a dormant track must have
crossed ownership (t.actor set) to stay associable within
track_extinction_sec.

Measured trade: a small recall cost (~1-3pp on some films, e.g. Lord of
War -2.5) for a cleaner, bounded pool. Kept deliberately. Note it does NOT
fix the ROCm GEMM wedge (that is an intermittent driver flake, not a
pool-size problem) — this is a correctness/cleanliness change, not a
performance one.
This commit is contained in:
2026-08-09 19:20:06 +02:00
parent add7e22053
commit 1477c53885
+15 -3
View File
@@ -218,9 +218,21 @@ public:
const double clock = const double clock =
reg_.awaits_evidence_ ? reg_.evidence_through_ : reg_.now_; reg_.awaits_evidence_ ? reg_.evidence_through_ : reg_.now_;
for (auto& [id, t] : reg_.tracks_) { for (auto& [id, t] : reg_.tracks_) {
if (t.last_seen && // On-screen tracks are always candidates (actively tracked this
(clock - *t.last_seen) > reg_.cfg_.track_extinction_sec) // frame). A dormant (off-screen) track is only worth keeping alive
continue; // retired from association; still awaiting evidence // for re-association if it was actually IDENTIFIED: an unowned
// dormant track has no actor to re-attach to, so holding it in the
// pool only bloats the matcher's per-frame comparison set (every
// candidate is a GEMM row) and invites a new face re-associating
// onto an anonymous stub. Gating dormant tracks on t.actor keeps
// the pool bounded regardless of how large track_extinction_sec is
// — which is what makes a long re-association window affordable.
if (t.last_seen) { // dormant
if (!t.actor.has_value())
continue; // never identified: not worth re-associating
if ((clock - *t.last_seen) > reg_.cfg_.track_extinction_sec)
continue; // past the re-association horizon
}
out.push_back(&t); out.push_back(&t);
} }
return out; return out;