feat(ml): CCIP character matches ground to the matched figure region (#133 step 2)
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user