fix(classify): tune panel_density thresholds against form-scan corpus (partial, MK-20) #40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/classify-panel-density-tune-MK-20"
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?
Implements MK-20 (partial). Filing follow-up MK for the scoring change that unblocks the remaining 6 fixtures.
Summary
MK-16 shipped panel_density defaults that recognised only 1 of 11 form-scan fixtures in the local corpus. Empirical probe via
--probemeasured the real distribution; this PR moves the defaults to:panel_luma_lo: 0.20 -> 0.50 (excludes binary-scan dense-text fusion at component mean_luma 0.32-0.39)panel_luma_hi: 0.80 -> 0.92 (catches the lightest tax-form blue tints at 0.85-0.89)panel_density_min: 0.05 -> 0.02 (real form-panel coverage is 0.02-0.18, MK-16's 5% overshot)Inline comments on each value cite the observed band.
Results
Net +4 form-scan classifications, zero regressions in the populated baseline directories.
A pre-existing miss in
graphic/Scan-20260524T144404.png(classifies ascolor-photo) is unchanged: the fixture'ssat_mean=0.187,palette_size=336features fire color-photo's saturation+palette gate under main's defaults too. Orthogonal to MK-20.Why this is partial
The remaining 6 form-scan misses cannot be reached by threshold tuning alone. The structural 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 with each factor in[0, 1].On feature-similar inputs (high bimodality, low saturation), binary's shorter product wins because nothing attenuates it on form-scan signal the way
(1 - halftone)attenuates it on halftone signal. The 6 misses break down as: 4 lose to binary'sbimodal * low_sat, 1 falls belowmin_score(135334 has unusually lownon_panel_bimodality0.85 and edges 0.05), 1 loses to mono-photo via(1 - bimodal)(140051's overall bimodality is 0.61).Will file a follow-up MK to add
(1 - panel_density_high)(or similar) to the binary score so the two classes compete on a level field. This PR stops at the cleanest threshold-only ship.Test plan
cargo test --bin monkey classify(15/15 in-tree synthetic tests).just classify-fixturesagainst the local 11-fixture form-scan corpus and full binary-scan / receipt / color-photo sets (see Results above).just check(fmt + clippy + build + Docker stage).