[#86] Detail-aware input cap: relax 1280→2048 for fine-mark-dense inputs#89
Merged
Conversation
…puts The long-edge cap (#82, default 1280) is the primary detail-killer for high-res detail-rich art: a 1648x2944 illustration is LANCZOS-downscaled to 717x1280 before tracing, shredding face features nothing downstream can recover. Make the cap detail-aware. - Port _fine_mark_density (+ constants) from the shelved P2 detector (#84/#85). - In convert()'s downscale block: at the DEFAULT cap only, measure the original's fine-mark density; if >= 8.0, relax the effective cap to _DETAIL_CAP_EDGE_PX (2048, == _TRACE_RESOLUTION). Any explicit --max-input-edge-px (incl. 0) bypasses the heuristic verbatim. - Report note records the relax (fmd + 1280->2048). Structurally non-regressing: inputs <= 1280 never enter the branch (byte-identical; golden corpus green), low-density inputs keep 1280. Calibrated on the pv-corpus + new-test sweep; relaxing the few dense "flat" cartoons that cross the floor is visually harmless (verified montage). Verified: popgirl 1648x2944 -> relax 2048 (fmd 10.4, 1668 paths); 03-flatcartoon (fmd 6.93) stays 1280. Tests: detector separation, flat-stays + explicit override, dense-relaxes. ruff + full suite green. 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.
Closes #86. T1 of the detail-parity-v2 track. Rollback anchor: tag
detail-parity-baseline(== v0.8.0).What
Makes the input long-edge cap (#82, default 1280) detail-aware: at the default cap only, an over-cap input's original fine-mark density is measured; if ≥ 8.0 the effective cap relaxes to 2048 (
_TRACE_RESOLUTION, still bounded). Any explicit--max-input-edge-px(incl. 0) bypasses the heuristic verbatim.Ported
_fine_mark_density(+ constants) from the shelved P2 detector (#84/#85) — the shelved asset, reused as a router.Why it is safe (structurally non-regressing)
Evidence
Calibration sweep (fmd reproduces the proposal exactly): cat 4.58 / popgirl 10.39 / moon 13.60. Full pv-corpus + new-test sweep in [
z-design/.../analysis-2026-07-07/T1-cap-calibration.csv]. Finding: an fmd floor cannot perfectly separate flat-from-detail (04-flatcartoon 12.99 > popgirl 10.39) — so I verified the boundary visually.Visual gate (
T1-cap-1280-vs-2048-montage.png): relaxing the four >1280 high-fmd flatcartoons to 2048 is harmless (01/04/06 near-identical, 05 marginally crisper); popgirl clearly benefits. Path cost modest (0.93–1.20×).Functional: popgirl 1648×2944 → relax 2048 (fmd 10.4, 1668 paths, note emitted); 03-flatcartoon (6.93) stays 1280.
Tests: detector separation, flat-stays + explicit-override, dense-relaxes.
ruff+ full suite (130) green.This is default-ON (no flag), so per the quality-loop protocol it needs the operator visual eye-gate on the montage before merge / any engine release. Production is protected meanwhile (svgsmith-x402 API pinned
<0.9.0). Paired with #87 (op-point routing) for the full popgirl face recovery.🤖 Generated with Claude Code