feat(identity): condition box padding on the box's source (gate item 4) - #12
Merged
Merged
Conversation
One global `identity_box_padding` (0.12) padded every identity crop the same, but the enrollment-redesign spikes measured two opposite optima by source: - A grounder box (VLM analyze/localize) can be cropped tight to the object's most recognizable part; widening it to 0.75 repairs the scoping (F1 0.776 -> 0.909, spike 3e). - A tracker box (SAM2, register button) has no such defect, so the same padding only pulls in desk and hurts separation (+0.340 -> +0.255, spike 2e). Split the knob into `identity_grounder_box_padding` (0.75) and `identity_tracker_box_padding` (0.0), and apply each at the call site that knows the box origin: the query path and the grounded enrollment path crop grounder boxes; `enroll_center_anchor` crops the tracker box. `enroll_manual` is unaffected (it masks with a full-ones mask). Status surface and wiring updated; a test asserts padding-per-source across both enrollment paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Splits the single global
identity_box_padding(0.12) into two source-conditioned knobs, applied at the call site that knows where the box came from:analyze/localize)identity_grounder_box_paddingpipeline.py, ×3) + groundedenroll(enroll.py, ×2)identity_tracker_box_paddingenroll_center_anchor(enroll.py, ×1)enroll_manualis unaffected — it masks with a full-ones mask, so padding never applies there.Why
Gate item 4 (
docs/19-Post-Spike-Build-Plan.md), spikes 3e/2e. One padding value can't serve both sources:Local validation (padding sweep on the identity probe)
Ran a real sweep to pick the grounder default rather than inherit 0.75 blind: LFM-3B grounds every probe image (local proxy for Cosmos), then the production crop path (
box_to_mask→prepare_masked_crop) at each padding → C-RADIOv4-H → the probe's balanced accept/reject scoring.native= bare LFM box;extent= LFM + item 3's extent clause (post-item-3 proxy).extent) box at 0.0 padding already beats a bare box at 0.75, but padding still adds separation on top, peaking at 0.5–0.75.Caveats: LFM is a proxy for Cosmos; n=36 across 3 keyring instances; the tracker side (0.0) was not re-verified here (the probe has no tracked clips).
Tests
test_box_padding_is_conditioned_on_the_box_sourceasserts the grounded path widens (grounder padding) and the register-button path stays tight (tracker padding), across both enrollment paths.ruffandpyrightclean.🤖 Generated with Claude Code