feat(classify): add graphic class for logos and diagrams (MK-9) #30

Merged
nrupard merged 2 commits from feat/classify-graphic-class-MK-9 into main 2026-05-21 18:25:05 +02:00
Member

What

MK-9: add a seventh classifier class, graphic, for logos / brand marks / simple diagrams - small saturated palette with smooth, low-edge shapes. These fit none of the existing six slots.

Depends on #29 (MK-8). This branch is stacked on the MK-8 branch (shared score() edits). Until #29 merges, the diff below also shows the MK-8 changes; it will shrink to just the graphic-class commit once #29 lands. Merge #29 first.

Changes (MK-9 commit only)

  • ImageClass::Graphic (+ as_str, from_label).
  • score(): graphic = small_palette_graphic * low_edges * (1 - bimodal) * (1 - color) * (1 - low_sat). color-photo now also gated on a LARGE palette so a saturated small-palette logo falls to graphic.
  • Distinguished: vs screenshot (LOW edges), vs color-photo (small palette), vs mono-photo (requires saturation), vs text scan (not bimodal).
  • classify.toml: graphic_palette_max = 64, graphic_edge_max = 0.10.
  • recipes/graphic.toml (anti-alias) keeps monkey image auto exhaustive over the class.
  • README class list + classify/auto doc-comments + --class help updated.
  • Synthetic graphic_blocks fixture + classifies_graphic test.

Acceptance status

  • graphic in ImageClass, dispatched in classify.
  • Existing six synthetic class tests still pass (79 tests green).
  • New synthetic graphic fixture classifies as graphic.
  • README class list + doc-comments updated.
  • lapce-logo / lets-chat PNG classify as graphic - blocked on the user fixture set.
  • Real-fixture unit test under tests/fixtures/classify/graphic/ - blocked on the user fixture set.

Notes

  • graphic_edge_max = 0.10 admits lapce (0.023) and lets-chat (0.074) but excludes the timeline diagram (0.227); acceptance only requires the two logos.
  • mono-photo edge-gating open question deferred; the 1 - low_sat gate already separates the synthetic cases.
  • Final graphic_palette_max / graphic_edge_max tuning awaits the real fixtures.

🤖 Generated with Claude Code

## What MK-9: add a seventh classifier class, `graphic`, for logos / brand marks / simple diagrams - small saturated palette with smooth, low-edge shapes. These fit none of the existing six slots. > **Depends on #29 (MK-8).** This branch is stacked on the MK-8 branch (shared `score()` edits). Until #29 merges, the diff below also shows the MK-8 changes; it will shrink to just the graphic-class commit once #29 lands. Merge #29 first. ## Changes (MK-9 commit only) - `ImageClass::Graphic` (+ `as_str`, `from_label`). - `score()`: `graphic = small_palette_graphic * low_edges * (1 - bimodal) * (1 - color) * (1 - low_sat)`. color-photo now also gated on a LARGE palette so a saturated small-palette logo falls to graphic. - Distinguished: vs screenshot (LOW edges), vs color-photo (small palette), vs mono-photo (requires saturation), vs text scan (not bimodal). - `classify.toml`: `graphic_palette_max = 64`, `graphic_edge_max = 0.10`. - `recipes/graphic.toml` (anti-alias) keeps `monkey image auto` exhaustive over the class. - README class list + `classify`/`auto` doc-comments + `--class` help updated. - Synthetic `graphic_blocks` fixture + `classifies_graphic` test. ## Acceptance status - [x] `graphic` in `ImageClass`, dispatched in classify. - [x] Existing six synthetic class tests still pass (79 tests green). - [x] New synthetic graphic fixture classifies as graphic. - [x] README class list + doc-comments updated. - [ ] lapce-logo / lets-chat PNG classify as graphic - **blocked on the user fixture set**. - [ ] Real-fixture unit test under `tests/fixtures/classify/graphic/` - **blocked on the user fixture set**. ## Notes - `graphic_edge_max = 0.10` admits lapce (0.023) and lets-chat (0.074) but excludes the timeline diagram (0.227); acceptance only requires the two logos. - mono-photo edge-gating open question deferred; the `1 - low_sat` gate already separates the synthetic cases. - Final `graphic_palette_max` / `graphic_edge_max` tuning awaits the real fixtures. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(classify): add graphic class for logos and simple diagrams (MK-9)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 40s
3662591b52
Add a seventh class, `graphic`, for logos, brand marks, and simple diagrams: images with a small saturated palette and smooth, low-edge shapes that fit none of the existing six slots (a logo is not a screenshot, not a photo, not a scan).

Scoring (`score()`):
- `graphic = small_palette_graphic * low_edges * (1 - bimodal) * (1 - color) * (1 - low_sat)`, where `small_palette_graphic` gates on `graphic_palette_max` and `low_edges` on `graphic_edge_max`. The saturation gate (`1 - low_sat`) keeps desaturated smooth images in mono-photo.
- color-photo is now additionally gated on a LARGE palette (`>= graphic_palette_max`), so a saturated logo with a tiny palette falls to graphic rather than color-photo.

Distinguished from neighbours: vs screenshot by LOW edge density (no UI seams), vs color-photo by small palette, vs mono-photo by requiring saturation, vs text scans by not being bimodal.

`classify.toml`: `graphic_palette_max = 64`, `graphic_edge_max = 0.10`. A default `recipes/graphic.toml` (anti-alias for the few hard seams) keeps `monkey image auto` exhaustive over the new class. README class list, the `classify`/`auto` doc-comments, and the `--class` help all list `graphic`.

Adds a synthetic `graphic_blocks` fixture (four saturated quadrants) and `classifies_graphic`; the existing six-class synthetic tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix(classify): raise graphic_palette_max to 256 so brand marks aren't color-photo (review)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 19s
Create release / Create release from merged PR (pull_request) Has been skipped
10d9c6bb32
Review caught that graphic_palette_max = 64 excluded the lets-chat acceptance fixture (palette ~196 per MK-6 validation): at 64 a 196-palette logo failed the small-palette gate and, worse, satisfied the large-palette gate that color-photo now requires, routing it to color-photo - the exact bug MK-9 fixes.

Measured the synthetic palettes to pick a safe split: color_photo 458, graphic_blocks 4, screenshot 5. Setting graphic_palette_max = 256 admits both observed brand marks (lapce ~19, lets-chat ~196) into graphic while keeping photographic palettes (hundreds) in color-photo. The synthetic suite is unchanged (color_photo 458 stays color-photo, graphic_blocks stays graphic).

Also clarifies two comments: `small_palette_graphic`/`large_palette` are intentional complements about the same split, and the toml threshold is a soft centre, not a hard cutoff.

Final value still subject to the real lets-chat/lapce fixtures, but 256 is the right starting split given the observed palettes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nrupard deleted branch feat/classify-graphic-class-MK-9 2026-05-21 18:25:05 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/monkey!30
No description provided.