agent: dedupe near-duplicate crops before the SigLIP embed #174

Merged
bvandeusen merged 1 commits from dev into main 2026-07-01 00:24:39 -04:00
Owner

Follow-up to the pipeline rewrite (#173). Cuts redundant regions/GPU by deduping near-identical crops before the embed.

Figure boxes are already NMS-merged (iou 0.6) and each YOLO self-NMSes, but the combined per-frame crop pile (figure→concept ∪ anatomy component→concept ∪ panel) was embedded with no cross-proposer dedup — so genuine near-duplicates slipped through (a figure box ≈ an anatomy component on a solo bust; overlapping booru head classes), embedding the same region twice and burning a slot against max_regions.

detectors.dedupe_crops() adds a greedy, high-IoU (default 0.85), kind-aware pass over the pending (crop, template) list right before embed_batch: drop boxes overlapping ≥ iou within the same kind, keep the highest score. The high threshold collapses only true near-identical boxes while preserving intentional nested crops across scopes (a whole figure vs a small head component sit well below it) and distinct kinds (concept vs panel). Env-tunable DEDUPE_IOU (≥1.0 disables); runs on CPU before the GPU work. Temporal (cross-frame) dedup deferred. Build marker 2026-07-01.2.

CI green on dev (run 1812). Validated on the desktop after pull.

🤖 Generated with Claude Code

Follow-up to the pipeline rewrite (#173). Cuts redundant regions/GPU by deduping near-identical crops before the embed. Figure boxes are already NMS-merged (iou 0.6) and each YOLO self-NMSes, but the combined per-frame crop pile (figure→concept ∪ anatomy component→concept ∪ panel) was embedded with no cross-proposer dedup — so genuine near-duplicates slipped through (a figure box ≈ an anatomy component on a solo bust; overlapping booru head classes), embedding the same region twice and burning a slot against `max_regions`. `detectors.dedupe_crops()` adds a greedy, high-IoU (default **0.85**), **kind-aware** pass over the pending `(crop, template)` list right before `embed_batch`: drop boxes overlapping ≥ iou within the same kind, keep the highest score. The high threshold collapses only true near-identical boxes while preserving intentional nested crops across scopes (a whole figure vs a small head component sit well below it) and distinct kinds (concept vs panel). Env-tunable `DEDUPE_IOU` (≥1.0 disables); runs on CPU before the GPU work. Temporal (cross-frame) dedup deferred. Build marker `2026-07-01.2`. CI green on dev (run 1812). Validated on the desktop after pull. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bvandeusen added 1 commit 2026-07-01 00:24:35 -04:00
feat(agent): dedupe near-duplicate crops before the SigLIP embed
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 17s
CI / backend-lint-and-test (push) Successful in 26s
CI / integration (push) Successful in 3m25s
eaae896858
Figure boxes are already NMS-merged (iou 0.6) and each YOLO detector self-NMSes,
but the combined per-frame crop pile (figure→concept ∪ anatomy component→concept
∪ panel) was embedded with no cross-proposer dedup — so genuine near-duplicates
slipped through (a figure box ≈ an anatomy component on a solo bust; overlapping
booru head classes on one head), embedding the same region twice and burning a
slot against max_regions.

Add detectors.dedupe_crops(): a greedy, high-IoU (default 0.85), kind-aware pass
over the pending (crop, template) list right before embed_batch — drop boxes that
overlap ≥ iou within the same kind, keep the highest score. The high threshold is
deliberate: it collapses only true near-identical boxes while preserving
intentional nested crops across scopes (a whole figure vs a small head component
sit well below it) and distinct kinds (concept vs panel). Env-tunable DEDUPE_IOU
(≥1.0 disables). Runs on CPU before the GPU work, so it cuts both embed cost and
region count. Temporal (cross-frame) dedup deferred. Build marker 2026-07-01.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
bvandeusen merged commit 3996205f3b into main 2026-07-01 00:24:39 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bvandeusen/FabledCurator#174