From 959076821e3f99cd71fda9d3062d77eeedbd40b1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 26 Apr 2026 16:48:04 +0100 Subject: [PATCH] Remove spectral prior and widen solver drift --- docs/implementation-plan.md | 17 ++++++++++++++++- docs/lean-optimizer-algorithm-map.md | 2 +- notes/fresh-workspace-handoff.md | 5 ++++- src/repixelizer/params.py | 2 +- state/evidence.jsonl | 1 + state/map.yaml | 6 ++++-- 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 6fc9db6..2b632d5 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -89,7 +89,22 @@ Tracked fixture: - `tests/fixtures/real/ai-badge-tip-focus.json` -### 2. Keep phase-field honest +### 2. Keep lattice inference honest + +Current stance: + +- keep the shipped searched path grounded in change-interval evidence plus autocorrelation +- do not keep the projected edge-energy spectral pass; it floor-hugged to `2px` / `626`-family nonsense on the dense landscape fixture and did not earn its keep +- treat phase rerank as optional scaffolding, not sacred machinery + +Future options worth exploring, if autocorr stops carrying its weight: + +- distance-transform / medial-radius blob sizing on softened interiors +- small scale-space blob-size detection (`LoG` / `DoG`) +- blur-aware correction of observed blob width before converting to lattice size +- tiny learned size-and-phase prior trained on synthetic fake-pixel-art fixtures + +### 3. Keep phase-field honest Rules: diff --git a/docs/lean-optimizer-algorithm-map.md b/docs/lean-optimizer-algorithm-map.md index 4251a7b..46819ec 100644 --- a/docs/lean-optimizer-algorithm-map.md +++ b/docs/lean-optimizer-algorithm-map.md @@ -338,7 +338,7 @@ Code: Meaning: -The field pays a small tax for wandering too far. Motion has to earn its keep. +The field pays a small tax for wandering too far. Motion has to earn its keep, but the leash is long enough to recover from moderate phase error instead of dying half a cell short of the right blob. ### Metaphor diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 0d21781..e8e05a4 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -28,7 +28,9 @@ Do not trust this file for the exact live HEAD. Always check git. - `phase-field` is the only live reconstruction engine. - The live pipeline is `source -> lattice inference -> edge analysis -> phase-field reconstruction -> cleanup -> optional palette fit -> diagnostics`. +- searched lattice inference is back to change-interval evidence plus autocorrelation; the projected edge-energy spectral pass was tried, floor-hugged to 2px / 626-family aliases on the dense landscape fixture, and was removed - The low-confidence phase rerank path is a short preview solve, not a second full optimizer. +- the phase field now has a wider displacement budget, so moderate phase mistakes are allowed to get corrected by the field instead of relying purely on rerank ceremony - Cleanup is secondary and usually a no-op; the core result is supposed to come from the solver, not cleanup cosplay. - The current tracked weakness is the widened dark contour near the badge sword tip on tapered shapes. - `source_structure` exists because lattice-only `source_fidelity` could call visibly better outputs worse. @@ -51,8 +53,9 @@ Do not trust this file for the exact live HEAD. Always check git. The current spine: - lattice inference with fixed-size and searched-size paths +- searched lattice inference currently trusts change-interval evidence plus autocorrelation, not the rejected spectral prior - low-confidence phase rerank through short preview reconstruction -- edge analysis feeding one projected displacement-field optimizer +- edge analysis feeding one projected displacement-field optimizer with a wider displacement leash - nearest-source final sampling from `uv0_px + disp_t` - cleanup, optional palette fit, diagnostics, compare mode, tuning, and GUI observer events on the live path - `source_structure` plus `source_fidelity` in run summaries and comparisons diff --git a/src/repixelizer/params.py b/src/repixelizer/params.py index bc98296..d39ed7e 100644 --- a/src/repixelizer/params.py +++ b/src/repixelizer/params.py @@ -14,7 +14,7 @@ class SolverHyperParams: phase_field_min_spacing_ratio: float = 0.18 phase_field_magnitude_weight: float = 0.08 phase_field_learning_rate: float = 0.10 - phase_field_max_displacement_ratio: float = 0.48 + phase_field_max_displacement_ratio: float = 0.95 phase_rerank_preview_steps: int = 8 source_edge_detail_threshold: float = 0.25 alpha_opaque_threshold: float = 0.95 diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 17bf121..71808e5 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -7,3 +7,4 @@ {"ts": "2026-04-26T12:56:28+00:00", "type": "research", "status": "ok", "note": "Added dense landscape fixture tests/fixtures/real/dense-landscape.png plus tracked fixed-512 output. Current automatic lattice inference on the 1254px source undershoots to 251x251, so README previews now include that case with the fixed 512x512 result beside Lanczos."} {"ts": "2026-04-26T13:14:17+00:00", "type": "research", "status": "ok", "note": "Dense landscape auto inference misses high because spacing stats split between false small-cell harmonics and mushier real-cell intervals. The spacing spectrum actually guides toward 415/418 and 251, but src/repixelizer/inference.py caps automatic major-axis candidates at 256, silently discarding the denser 415/418 branch; among the surviving sizes, reranking picks 251. Current phase/coherence scoring on the fixture is much stronger around 415-418 than at 251."} {"ts": "2026-04-26T13:53:17+00:00", "type": "research", "status": "ok", "note": "Relaxed automatic candidate search so high guided sizes from the spacing spectrum can survive above the old 256 cap. On tests/fixtures/real/dense-landscape.png, auto inference now lands at 418x418 instead of 251x251; still short of the fixed 512x512 target, but no longer throwing away most of the detail before scoring starts."} +{"ts": "2026-04-26T15:46:23+00:00", "type": "research", "status": "rejected", "note": "Tried a projected edge-energy spectral lattice prior and removed it before ship. On tests/fixtures/real/dense-landscape.png it floor-hugged to a 2px rhythm and widened the candidate family toward bogus 626-size aliases, so the searched path is back to change-interval evidence plus autocorrelation."} diff --git a/state/map.yaml b/state/map.yaml index af0eb06..ef187c7 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -65,7 +65,7 @@ accepted_design: - `src/repixelizer/pipeline.py` owns orchestration and phase rerank selection. - `src/repixelizer/analysis.py` provides the normalized edge scout used for loss and cleanup guidance. - `src/repixelizer/phase_field.py` owns the one honest optimization variable: `disp_t`. - - The optimizer starts from fixed lattice centers, optimizes displacement with projected Adam, then rounds to real source pixels for final output. + - The optimizer starts from fixed lattice centers, uses a wider displacement budget than the earlier tighter leash, optimizes displacement with projected Adam, then rounds to real source pixels for final output. - Cleanup is local and secondary; it does not define the core reconstruction model. - `source_fidelity` is useful but incomplete; `source_structure` exists because visible structure can improve while lattice-only scoring complains. - The tracked badge fixture and sword-tip focus are the current reality check for solver changes. @@ -86,7 +86,9 @@ rejected_paths: reason: lattice-only fidelity can call visibly better outputs worse - name: multi_stage_solver_religion reason: stacked stages and compensators hide confusion instead of fixing the one-field model + - name: projected_edge_spectrum_prior + reason: the projected edge-energy spectral pass floor-hugged to 2px / 626-family aliases on the dense landscape fixture and did not justify its complexity current_status: - summary: The repo has one live reconstruction engine, `phase-field`, wired through the main pipeline with lattice inference, edge analysis, projected displacement optimization, cleanup, optional palette fitting, diagnostics, compare mode, tuning, and GUI observer events. `source_structure` now rides alongside `source_fidelity` because lattice-only scoring was lying about visible quality. The tracked weakness is still the widened dark contour near the badge sword tip on tapered shapes. + summary: The repo has one live reconstruction engine, `phase-field`, wired through the main pipeline with lattice inference, edge analysis, projected displacement optimization, cleanup, optional palette fitting, diagnostics, compare mode, tuning, and GUI observer events. The spectral lattice prior experiment was removed after it floor-hugged to 2px / 626-family aliases on the dense landscape fixture, so the shipped searched path is back to change-interval evidence plus autocorrelation. The solver now has a wider displacement budget so moderate phase error can be recovered by the field instead of requiring as much rerank ceremony. `source_structure` now rides alongside `source_fidelity` because lattice-only scoring was lying about visible quality. The tracked weakness is still the widened dark contour near the badge sword tip on tapered shapes. next_action: After rehydrate, if the user wants continued solver work, take one bounded hypothesis aimed at along-stroke versus across-stroke behavior near tapered contours in `src/repixelizer/phase_field.py`, validate it against the pinned badge case and `tests/fixtures/real/ai-badge-tip-focus.json`, and revert immediately if the visual result or `source_structure` does not clearly improve.