[#84] Detail-loss recovery (P2 detector) — R&D record, DO NOT MERGE#85
Draft
realproject7 wants to merge 1 commit into
Draft
[#84] Detail-loss recovery (P2 detector) — R&D record, DO NOT MERGE#85realproject7 wants to merge 1 commit into
realproject7 wants to merge 1 commit into
Conversation
…, not shipping) Coverage-path detector routing detail-rich inputs to a recovery retrace (pre-trace flatten OFF + fine region merge) that traces back fine interior marks the default flattens (stipple/hatch/thin lines), while clean-flat art keeps the economical default. Signal = fine-mark density of original minus that of the default render. Adds opt-in ConvertOptions.retrace_time_budget_s (+ --retrace-time-budget-s) to skip the recovery retrace when the default trace already exceeded the budget. Validated (routing reproduces the anchored set; in-engine flagged fire / clean-flats add zero paths; full test suite passes; ruff clean). NOT shipping: operator eye-gate found the recovery output busier / net-negative vs the clean economical default on the flat/solid-art target class. Preserved for the record per #84. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 8, 2026
realproject7
added a commit
that referenced
this pull request
Jul 8, 2026
…puts (#89) 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.
Draft / record only — not for merge. Refs #84 (intentionally no
Fixes, so nothing auto-closes).Preserves the P2 detail-loss recovery work so it is not lost. Live/PyPI stays v0.8.0; this is not in any release.
Change (2 files, +98)
pipeline.py:_fine_mark_density()detector + constants;ConvertOptions.retrace_time_budget_s; coverage-branch wiring (time the default trace →DROP = fmd(orig) − fmd(default_render)→ if> 0.7retrace with pre-trace flatten OFF + fine region merge → skip when the default trace already exceeded the budget). Emits a report note on apply/skip.cli.py:--retrace-time-budget-s SECONDS.Validation
pytestpasses;ruffclean;retrace_time_budget_s=0correctly skips recovery.Why not shipping
Operator eye-gate: on the flat/solid-art target class the recovery output reads busier / net-negative vs the clean, economical default — the shipped v0.8.0 output is at-or-better than the reference vectorizer by eye. The detector also over-fires on a borderline speckle clean-flat under a different input encoding. Shelved; reopen if a non-regressing recovery mechanism is found (esp. the harder translucency/glass case, tracked separately).
🤖 Generated with Claude Code