Repository navigation
Add cross-image identity/likeness scorer (generation vs locked reference) - #3
Merged
Merged
Conversation
…nce) Adds `IdentitySimilarity` scorer + `compare_to_reference` facade in `lookbook/scorers/identity.py` — the measurement substrate for reelee's reference supervisor. Compares a candidate against a locked reference (or pool) by cosine over an injectable embedder, normalized to [0,1]. - Reuses existing embedders unchanged (arcface default; clip/dinov2 via the `embedder=` seam for non-face subjects). Embedder is injectable (name, object, or bare callable) so importing the module needs no heavy deps and the math is unit-testable with a fake embedder. - Reference embedded ONCE at construction and cached; candidates never re-embed the reference. - Set aggregation over a reference pool: max (default, "matches any locked view") | mean | min. Advisory `passed` flag against a defaulted threshold (0.85) — never hard-blocks; the consumer decides. - Registered as scorer `identity_similarity`; facade `compare_to_reference` + `SimilarityResult` exported from `lookbook`. Surfaced over HTTP and MCP as `compare_to_reference` so reelee can call it as a sidecar. - 28 offline tests (cosine math, normalization, aggregation, threshold gate, reference-caching, config_hash, JSON-ability) + 1 gated ArcFace smoke test. Follow-up (not done here, deliberately): reelee's transforms/continuity/character_drift.py hand-rolls CV face distance and should be refactored to call this — flagged, not touched, to avoid breaking its tests. Closes #2
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a cross-image identity-similarity scorer reusing lookbook's existing ArcFace embedder:
Registered as the
identity_similarityscorer; also surfaced over HTTP + MCP ascompare_to_reference. The measurement substrate for reelee's reference supervisor (Noel's explicit ask). Part of epic thorwhalen/reelee-web#151.The embedder is injectable (DI) so importing pulls in no torch/insightface; the cosine→[0,1] math, set-aggregation (reference may be one image or a pool), and threshold pass/fail are unit-tested offline. 28 new tests (+1 model-gated smoke); full suite 140 passed, 4 skipped — no regressions.
The reelee-side refactor of
continuity.character_driftto reuse this is flagged as a follow-up, not in this PR.Closes #2
https://claude.ai/code/session_01VpuLiVm21Wf3F3NUSveVwV