feat(ml): CCIP character matches ground to the matched figure region (#133 step 2)
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 20s
CI / backend-lint-and-test (push) Successful in 33s
CI / integration (push) Successful in 3m42s

match_image now tracks WHICH query figure produced the winning cosine per
character (argmax over the per-figure best-reference sim) and attaches its bbox as
grounding {bbox,kind:'figure',detector}. SuggestionService carries it: a CCIP-only
character hit grounds to its figure; a 'both' hit keeps the head's localized crop
if it had one, else falls back to the CCIP figure — so corroborated characters
stay grounded. Test: a character match carries the matched figure's bbox+kind.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
2026-07-05 23:18:41 -04:00
parent 409724b981
commit dfe2fda564
3 changed files with 29 additions and 5 deletions
+4
View File
@@ -55,6 +55,10 @@ async def test_matches_same_character_across_images(db):
m = next(x for x in matches if x["tag_id"] == raven.id)
assert m["source"] == "ccip" and m["category"] == "character"
assert m["score"] > 0.9
# #1206: the match grounds to the figure region that matched (hover → the
# figure box lights up), so a character suggestion is localized too.
assert m["grounding"]["bbox"] == pytest.approx([0.0, 0.0, 1.0, 1.0])
assert m["grounding"]["kind"] == "figure"
@pytest.mark.asyncio