feat(worker): constrained density clustering in forward face recognition #969

Merged
chris merged 1 commit from feat/constrained-forward-worker into main 2026-09-30 08:15:14 +02:00
Owner

Worker side of ADR 0100 — extends ADR 0017 constrained density semantics to the forward owner_face_recognition pass. Companions: ADR PR #966, Core PR #968, Web PR #967.

Forward pass changes (workers/people/src/memories_people_worker/main.py):

  • New setting constrainedClusteringEnabled (default True; False restores legacy DBSCAN path verbatim — golden tests untouched)
  • Constrained components per (modelName, modelVersion): anchors (payload assignments) + step-1-matched faces join the ε-graph as fixed labeled nodes; different identity labels are hard cannot-link (no edge); admission gate mirrors Core (component nodes >= minimumRecognizedFaces, core node degree+1 >= minimumRecognizedFaces)
  • Per admitted component: 0 identities → legacy new_person_cluster/cluster-band emission parity; 1 identity → cluster_person_match toward that person (weakMatch:true when beyond clusterMatchMaxDistance → review-only); >=2 identities → ONE review-only cluster_person_match toward the closest centroid with weakMatch+ambiguous+sorted conflictingPersonIds
  • Non-admitted faces and anchorless model pairs fall through to legacy DBSCAN; strong-band step 1 and weak-consensus step 3 byte-identical in both modes; tentative faces never anchor, never movable

Design note: step-1-matched faces join the graph as labeled fixed nodes because with anchors-only nodes chain attachment (the Morfar case) is geometrically impossible — step 1 already consumes everything within maxDistance of an anchor. Mirrors Core's named-match-before-density ordering.

Tests: 12 new (workers/people/tests/test_constrained_forward_clustering.py): Morfar chain attach ON/unmatched OFF, ambiguous emission shape, cannot-link graph assertion + bridge case, gate fall-through + boundary, zero-identity parity (exact dict equality ON vs OFF), flag-off legacy parity, mixed model pairs, tentative-never-movable. Full suite: 121 passed (109 pre-existing unchanged).

Worker side of ADR 0100 — extends ADR 0017 constrained density semantics to the forward owner_face_recognition pass. Companions: ADR PR #966, Core PR #968, Web PR #967. Forward pass changes (workers/people/src/memories_people_worker/main.py): - New setting constrainedClusteringEnabled (default True; False restores legacy DBSCAN path verbatim — golden tests untouched) - Constrained components per (modelName, modelVersion): anchors (payload assignments) + step-1-matched faces join the ε-graph as fixed labeled nodes; different identity labels are hard cannot-link (no edge); admission gate mirrors Core (component nodes >= minimumRecognizedFaces, core node degree+1 >= minimumRecognizedFaces) - Per admitted component: 0 identities → legacy new_person_cluster/cluster-band emission parity; 1 identity → cluster_person_match toward that person (weakMatch:true when beyond clusterMatchMaxDistance → review-only); >=2 identities → ONE review-only cluster_person_match toward the closest centroid with weakMatch+ambiguous+sorted conflictingPersonIds - Non-admitted faces and anchorless model pairs fall through to legacy DBSCAN; strong-band step 1 and weak-consensus step 3 byte-identical in both modes; tentative faces never anchor, never movable Design note: step-1-matched faces join the graph as labeled fixed nodes because with anchors-only nodes chain attachment (the Morfar case) is geometrically impossible — step 1 already consumes everything within maxDistance of an anchor. Mirrors Core's named-match-before-density ordering. Tests: 12 new (workers/people/tests/test_constrained_forward_clustering.py): Morfar chain attach ON/unmatched OFF, ambiguous emission shape, cannot-link graph assertion + bridge case, gate fall-through + boundary, zero-identity parity (exact dict equality ON vs OFF), flag-off legacy parity, mixed model pairs, tentative-never-movable. Full suite: 121 passed (109 pre-existing unchanged).
feat(worker): constrained density clustering in forward face recognition
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Run scoped PR tests (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
d571f75f7e
chris merged commit a899cede0b into main 2026-09-30 08:15:14 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!969
No description provided.