feat(classify): attenuate binary by panel_density so form-scan wins (MK-24) #41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/classify-binary-panel-attenuation-MK-24"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds a
(1 - panel_density_high)attenuation factor to thebinaryscore insrc/image/classify.rs::score, symmetric to the existing(1 - halftone)factor. Resolves MK-24 (parent MK-5, follow-up to MK-20).Why
MK-20 lifted form-scan from 1/11 to 5/11 fixtures, but the remaining misses could not be reached by threshold tuning. The blocker is a scoring-formula asymmetry:
binary = bimodal * low_sat * (1 - halftone)is a 3-factor product.form_scan = soft_ge(panel_density) * soft_ge(non_panel_bimodality) * edges_text * low_sat * (1 - color)is a 5-factor product where every factor lives in[0, 1].On a feature-similar form (high bimodality because the text outside the panels reads as a clean binary scan, plus low saturation), all of binary's factors fire near 1.0 while form_scan multiplies five sub-1.0 gates and loses the argmax. Halftone-scan already enjoys attenuation via binary's
(1 - halftone)factor; there was no symmetric panel-density attenuation. This PR adds it.Change
form_scan's first factor now references the sharedpanel_signalbinding instead of recomputing the samesoft_ge. No behavioural change toform_scan. No new threshold knobs:panel_density_minandsoft_scale_panelalready ship inclassify.tomlfrom MK-16 / MK-20.classify.tomlis NOT modified. No new dependencies.Verification done in-sandbox
just checkpasses:cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo build --all-targets, the test suite, and the docker builder-stage compile.classifies_form_scanandclassifies_binary_scan(the latter has panel_density ~0, so(1 - panel_signal)~ 1.0 and binary is unaffected).Verification REQUIRED from a reviewer with fixture access
The fixture tree under
tests/fixtures/classify/is gitignored (MK-14) and never reaches the CI / agent sandbox, so the empirical probe (issue Phase 1/2) could not run here. Per the issue's "ship a draft and ask the human to validate" path, please run locally and confirm before merge:just classify-fixturesagainst every populated class directory. Expected: form-scan 9/11 (5 from MK-20 + 4 new), binary-scan 52/52, receipt 5/5, color-photo 1/1, no regression on mono-photo / graphic / halftone-scan.binaryandform_scanscores (viamonkey image classify --probeor--features) for the 4 target form-scan fixtures and the 2 high-panel-density binary-scan fixtures, to make the flip visible:If form-scan does not reach 9/11, the issue authorizes iterating on
panel_density_min/soft_scale_panel; if binary-scan regresses, widensoft_scale_panelto soften the curve. Per scope discipline, the two known MK-20 misses (135334 -> unknown, 140051 -> mono-photo) are explicitly out of scope here and need their own follow-up.Acceptance criteria status
scoreadds(1 - panel_density_high)from the same thresholds form_scan uses.classifies_form_scan,classifies_binary_scan).classify.tomlNOT modified.just checkpasses._TBD_from local corpus).MK-24