From d4b5ab9ed75d725260d6332ca7703dbdb1c43b8f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 24 Apr 2026 03:20:47 +0100 Subject: [PATCH] Remove tile-graph engine --- README.md | 18 +- docs/implementation-plan.md | 38 +- docs/readme-assets/badge-example-sheet.png | Bin 468835 -> 404062 bytes .../readme-assets/engine-comparison-sheet.png | Bin 265003 -> 0 bytes .../guard-right-crop-comparison.png | Bin 36978 -> 36977 bytes docs/tile-graph-algorithm-map.md | 427 ------ scripts/generate_readme_previews.py | 245 +--- src/repixelizer/analysis.py | 21 +- src/repixelizer/cli.py | 8 - src/repixelizer/compare.py | 2 - src/repixelizer/params.py | 13 - src/repixelizer/pipeline.py | 68 +- src/repixelizer/tile_graph.py | 1204 ----------------- src/repixelizer/types.py | 10 +- tests/fixtures/real/ai-badge-tip-focus.json | 1 - tests/test_analysis.py | 13 +- tests/test_pipeline.py | 144 -- tests/test_tile_graph.py | 537 -------- 18 files changed, 33 insertions(+), 2716 deletions(-) delete mode 100644 docs/readme-assets/engine-comparison-sheet.png delete mode 100644 docs/tile-graph-algorithm-map.md delete mode 100644 src/repixelizer/tile_graph.py delete mode 100644 tests/test_tile_graph.py diff --git a/README.md b/README.md index fceb79a..6ce4f36 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ Instead of pretending this is a resize problem, Repixelizer treats it as lattice Repixelizer was built to rescue fake pixel art, but it can also be used to generate pixel art directly from non-pixel source art when the shapes are clean and the local structure is doing something useful. -Rows show the source art, a plain Lanczos downscale, the default `phase-field` solver, and the `tile-graph` alternate solver. The bottom row also carries the tracked sword-tip closeup, because that tiny patch is one of the more honest tests of whether the machine is preserving structure instead of just faking confidence. +Rows show the source art, a plain Lanczos downscale, and the live `phase-field` solver. The bottom row also carries the tracked sword-tip closeup, because that tiny patch is one of the more honest tests of whether the machine is preserving structure instead of just faking confidence. ![Repixelizer example comparison](docs/readme-assets/badge-example-sheet.png) -That is the pitch in one image: two different machines, same mess, same ruler, nowhere to hide. +That is the pitch in one image: same mess, same ruler, one machine forced to prove it actually understands the grid. ## Current Status @@ -24,7 +24,6 @@ What exists now: - lattice inference with CUDA support - a lean displacement-field optimizer in `src/repixelizer/phase_field.py` -- a source-owned alternate solver in `src/repixelizer/tile_graph.py` - automatic diagnostics, comparisons, and benchmark runs - a tuning harness for offline parameter sweeps - metrics that finally care about visible structure instead of only pleasing the lattice accountant @@ -36,16 +35,14 @@ What changed recently: - `source_structure` is reported alongside `source_fidelity`, because the old metric was happily calling better-looking images worse - the tracked sword-tip blemish on the AI badge has its own focused fixture in `tests/fixtures/real/ai-badge-tip-focus.json` -Current read on the engines: +Current read on the engine: - `phase-field` is the release path. It currently produces the best-looking badge result in the repo, especially on internal linework, even though it still widens the tracked sword-tip stroke a bit too much. -- `tile-graph` is still valuable as the alternate machine. It keeps hard source ownership and often preserves cell identity in a different, sometimes more stubborn way, but it is slower and more temperamental on badge-scale inputs. Current weak spots: - `phase-field` still needs better along-stroke versus across-stroke behavior near tapered contours -- tile-graph cold-build time is still dominated by connected-component labeling / region extraction on large fixtures -- lattice selection is still low-confidence on some ugly generated inputs, so pinned-size iteration remains an important workflow for both engines +- lattice selection is still low-confidence on some ugly generated inputs, so pinned-size iteration remains an important workflow ## Quickstart @@ -59,10 +56,7 @@ Run the optimizer: ```powershell repixelize input.png --out output.png repixelize input.png --out output.png --diagnostics-dir diagnostics --device auto -repixelize input.png --out output.png --reconstruction-mode phase-field --diagnostics-dir diagnostics --device auto -repixelize input.png --out output.png --reconstruction-mode tile-graph --diagnostics-dir diagnostics --device cpu -repixelize input.png --out output.png --reconstruction-mode tile-graph --diagnostics-dir diagnostics --device cuda -repixelize input.png --out output.png --reconstruction-mode tile-graph --target-width 126 --target-height 126 --phase-x 0.0 --phase-y -0.2 --device cuda +repixelize input.png --out output.png --target-width 126 --target-height 126 --phase-x 0.0 --phase-y -0.2 --device cuda ``` Run the optimizer plus baselines: @@ -122,7 +116,6 @@ That keeps benchmark assets, attribution exports, and tuning runs from polluting - `tests`: focused regression tests - `docs/spec.md`: product and technical spec - `docs/implementation-plan.md`: working roadmap -- `docs/tile-graph-algorithm-map.md`: detailed tile-graph dataflow and failure-point map - `docs/lean-optimizer-algorithm-map.md`: map of the live displacement-field optimizer - `examples/corpus/README.md`: local corpus layout and attribution workflow @@ -130,7 +123,6 @@ Core modules: - `inference.py`: target size and phase inference - `phase_field.py`: default displacement-field optimizer -- `tile_graph.py`: source-owned alternate reconstruction path - `metrics.py`: fidelity, adjacency, and motif metrics - `benchmark.py`: corpus benchmark runner - `tuning.py`: black-box hyperparameter search harness diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 06a1ff0..2b178df 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -2,22 +2,18 @@ ## Current machine -Repixelizer now has two real reconstruction engines: +Repixelizer now has one live reconstruction engine: - `phase-field`: the default optimizer in `src/repixelizer/phase_field.py` -- `tile-graph`: the source-owned alternate solver in `src/repixelizer/tile_graph.py` - -The old tray-based optimizer is gone. Good riddance. The live pipeline is: -`source image -> lattice inference -> edge analysis -> phase-field or tile-graph reconstruction -> cleanup -> optional palette fit -> diagnostics` +`source image -> lattice inference -> edge analysis -> phase-field reconstruction -> cleanup -> optional palette fit -> diagnostics` ## What is working - lattice size and phase inference are still shared and still CUDA-capable - `phase-field` is now the main optimizer path and produces the best-looking badge result in the repo so far -- `tile-graph` still provides a useful alternate path when literal source ownership matters more than smooth field behavior - compare mode, benchmark mode, diagnostics writing, and tuning all still work after the optimizer cutover - the repo now reports both: - `source_fidelity`: agreement with the inferred lattice portrait @@ -48,27 +44,13 @@ What we know: - the tracked blemish is now narrow and specific: the sword-tip stroke widens too much in one local region - the tracked focus fixture is `tests/fixtures/real/ai-badge-tip-focus.json` -### Tile-graph - -Useful artifacts: - -- full emblem win: `artifacts/full-emblem-tile-graph-atomic-v3-cuda/` -- pinned badge speed/quality checkpoint: `artifacts/tile-graph-reducebykey-v1-badge-126/` - -What we know: - -- source ownership is real now -- large-fixture cold-build cost is still the main pain -- the dominant remaining speed problem is connected-component labeling / region extraction, not the parity solver loop - ## Maps -The repo now keeps the living maps only: +The repo now keeps the living map: - `docs/lean-optimizer-algorithm-map.md` -- `docs/tile-graph-algorithm-map.md` -If a future pass cannot be explained cleanly against one of those maps, it should not land. +If a future pass cannot be explained cleanly against that map, it should not land. ## Current priorities @@ -104,18 +86,6 @@ Rules: - if a new term lands, it must belong cleanly in the one-field objective - if a result looks better and the metrics disagree, fix the metrics rather than worshipping them -### 3. Make tile-graph less slow - -Goal: - -- reduce cold-build latency on badge-scale inputs without reintroducing fake ownership or averaged patch lies - -Most likely targets: - -- connected-component labeling -- source-region extraction -- cache reuse across repeated fixed-lattice runs - ## Guardrails - prefer one clear hypothesis per pass diff --git a/docs/readme-assets/badge-example-sheet.png b/docs/readme-assets/badge-example-sheet.png index fb96849ccbda0404ed0f690cbc311c16de68fbd0..18b246b6ac4c62d93e33746679d1b72afd35cbfd 100644 GIT binary patch literal 404062 zcmd?QbySq?+b)cBcQ=BBv`CkLgo091(%s!Hof3i|-JsGT&CneK(m6CpcMUVMZ-4K8 zp7-5BR(wo;ZAAGWpa?rk!Y0(TK1l;Z0y#JhhNh7o+BqWsS>wERA4_UnHl?p0R zH?lYq4eFnhlZ1%ls%3#o$-Qj-b>c&eW}H(n26$D}9Xuu}a5*7*>MMthg*7chi2CnG z9eMl9k;?!0LIxWxlo9iv51h=R;MITs`Z|Uw0{P!}WeA@|l4Ae&STd=U8tni5Fsizl z(*N&Y{_}y|!m8A~JM`Y#LHWH@;9`PKXHXz6jnI*C;H_Kk{MV;XpCac4yg=dLcw_C* zdAsIc<8uzt?F`~>^*Zip@;sQqQcmaDn2(w@3=TX*R2(b2!g%_xL6eevR%4ooyMSll zjDL=+@FinJc=(@mD5FDYqxY#%`^^%KZinA5XZ;B5uWC!|m3vym3)`^0yx?xm>h>cj zcWrI$-ASACWVsH*%ug*GY51LFrm%BNAoQlt`*cmjb(7_%PIW?yyLFL#oHpXka>