Fast LAION aesthetic predictor baseline (stage 3) #12

Merged
xrisk merged 2 commits from feat/photo-aesthetic-baseline into main 2026-10-16 13:23:18 +00:00
Owner

Resolves #7. Builds directly on merged PR #10 (prefilters and original acquisition).

Summary

Adds a fast, deterministic LAION aesthetic predictor baseline (stage 3 of 3) as a lightweight scoring baseline in the clock-photo curation pipeline. Uses OpenAI CLIP ViT-L/14 with QuickGELU activations and a linear head (sa_0_4_vit_l_14_linear.pth, MIT). Outputs a 1–10 score with calibrated thresholding.

Changes

  • Maintainer Scorer (scripts/score-clock-aesthetics.py):
    • Scores clock photos via CLIP ViT-L/14 + linear head on MPS or CPU.
    • Weights downloaded on demand to ~/.cache/tv-dashboard/models/ and verified against expected SHA256 checksums; never committed (.gitignore updated for *.pth, *.pt, *.bin, *.safetensors).
    • Supports --prefilter-evidence to filter to prefilter-passing images, and --compare-clef for cross-stage comparison.
    • Emits sidecar atomically via sibling temp + fsync + os.replace.
  • Structural Schema (docs/photo-aesthetic.schema.json):
    • Versioned JSON Schema (v1, stage "aesthetic") validating records, metrics, reasons, and distributions.
  • Documentation & Task Routing (docs/photo-aesthetics.md, .wiki/wiki/references/task-routing.md):
    • Full operating instructions, architectural notes, calibration tables across 518 photos, and Clef comparison protocol.
  • Dependencies (pyproject.toml, uv.lock):
    • Declared [project.optional-dependencies] aesthetic = [...] (PyTorch, torchvision, open-clip-torch, Pillow, numpy).
  • Synthetic Test Suite (Tests/photo-aesthetic/test_aesthetic.py):
    • 10 unit tests covering determinism, thresholding, atomic writing, error handling, prefilter filtering, Clef comparison, and schema compliance.

Pool Benchmark & Calibration Evidence (M1 Pro)

  • Prepared Pool (518 assets at 1280px): 48.6s total (~93.8 ms/photo end-to-end), 518/518 scored, 0 errors.
    • Min: 2.8852, p10: 5.0420, p25: 5.4525, Median: 5.9343, Mean: 5.8819, p75: 6.3380, p90: 6.7115, Max: 7.8445, Std: 0.6751.
  • Original Pool (518 raw assets, 2.9 GiB): 104.5s total, 509/518 scored, 9 input byte limit errors (>32 MiB archival TIFFs).
    • Min: 2.9495, p10: 4.9878, p25: 5.4418, Median: 5.9196, Mean: 5.8747, p75: 6.3211, p90: 6.6999, Max: 7.7505, Std: 0.6785.
  • Stage-1 Passing Pool (279 assets): 58.5s total, 279/279 scored, 0 errors.
    • Min: 2.9495, p10: 5.1120, p25: 5.5329, Median: 6.0237, Mean: 5.9382, p75: 6.3435, p90: 6.7058, Max: 7.7505, Std: 0.6711.

Threshold Guide

  • 5.50 (Default balanced baseline): Keeps 73.2% of prepared pool (379/518) and 76.3% of stage-1 passing pool (213/279); prunes bottom quartile of drab/cluttered photos.
  • 5.00 (High-recall baseline): Keeps 90.7% (470/518).
  • 6.00 (Selective gallery): Keeps 45.6% (236/518).

Verification

  • Tests/photo-aesthetic: 10/10 passed.
  • Tests/photo-prefilters: 15/15 passed.
  • make test: Swift selftest, Reminders selftest, and JS contract tests passed.
  • Running kiosk instance (PID 51664) verified intact and undisrupted.
Resolves #7. Builds directly on merged PR #10 (prefilters and original acquisition). ## Summary Adds a fast, deterministic LAION aesthetic predictor baseline (stage 3 of 3) as a lightweight scoring baseline in the clock-photo curation pipeline. Uses OpenAI CLIP ViT-L/14 with QuickGELU activations and a linear head (sa_0_4_vit_l_14_linear.pth, MIT). Outputs a 1–10 score with calibrated thresholding. ## Changes - **Maintainer Scorer (`scripts/score-clock-aesthetics.py`)**: - Scores clock photos via CLIP ViT-L/14 + linear head on MPS or CPU. - Weights downloaded on demand to `~/.cache/tv-dashboard/models/` and verified against expected SHA256 checksums; never committed (`.gitignore` updated for `*.pth`, `*.pt`, `*.bin`, `*.safetensors`). - Supports `--prefilter-evidence` to filter to prefilter-passing images, and `--compare-clef` for cross-stage comparison. - Emits sidecar atomically via sibling temp + fsync + `os.replace`. - **Structural Schema (`docs/photo-aesthetic.schema.json`)**: - Versioned JSON Schema (`v1`, stage `"aesthetic"`) validating records, metrics, reasons, and distributions. - **Documentation & Task Routing (`docs/photo-aesthetics.md`, `.wiki/wiki/references/task-routing.md`)**: - Full operating instructions, architectural notes, calibration tables across 518 photos, and Clef comparison protocol. - **Dependencies (`pyproject.toml`, `uv.lock`)**: - Declared `[project.optional-dependencies] aesthetic = [...]` (PyTorch, torchvision, open-clip-torch, Pillow, numpy). - **Synthetic Test Suite (`Tests/photo-aesthetic/test_aesthetic.py`)**: - 10 unit tests covering determinism, thresholding, atomic writing, error handling, prefilter filtering, Clef comparison, and schema compliance. ## Pool Benchmark & Calibration Evidence (M1 Pro) - **Prepared Pool (518 assets at 1280px):** 48.6s total (~93.8 ms/photo end-to-end), 518/518 scored, 0 errors. - Min: 2.8852, p10: 5.0420, p25: 5.4525, Median: 5.9343, Mean: 5.8819, p75: 6.3380, p90: 6.7115, Max: 7.8445, Std: 0.6751. - **Original Pool (518 raw assets, 2.9 GiB):** 104.5s total, 509/518 scored, 9 input byte limit errors (>32 MiB archival TIFFs). - Min: 2.9495, p10: 4.9878, p25: 5.4418, Median: 5.9196, Mean: 5.8747, p75: 6.3211, p90: 6.6999, Max: 7.7505, Std: 0.6785. - **Stage-1 Passing Pool (279 assets):** 58.5s total, 279/279 scored, 0 errors. - Min: 2.9495, p10: 5.1120, p25: 5.5329, Median: 6.0237, Mean: 5.9382, p75: 6.3435, p90: 6.7058, Max: 7.7505, Std: 0.6711. ### Threshold Guide - **5.50 (Default balanced baseline):** Keeps 73.2% of prepared pool (379/518) and 76.3% of stage-1 passing pool (213/279); prunes bottom quartile of drab/cluttered photos. - **5.00 (High-recall baseline):** Keeps 90.7% (470/518). - **6.00 (Selective gallery):** Keeps 45.6% (236/518). ## Verification - `Tests/photo-aesthetic`: 10/10 passed. - `Tests/photo-prefilters`: 15/15 passed. - `make test`: Swift selftest, Reminders selftest, and JS contract tests passed. - Running kiosk instance (PID 51664) verified intact and undisrupted.
- Add scripts/score-clock-aesthetics.py maintainer tool using CLIP ViT-L/14 + LAION linear head
- Add atomic sidecar publication and structural schema docs/photo-aesthetic.schema.json
- Add calibration distributions over 518-photo pool and docs/photo-aesthetics.md
- Add cross-stage Clef comparison protocol and prefilter-passing filter support
- Add isolated aesthetic extra in pyproject.toml and updated uv.lock
- Add 10 synthetic offline tests in Tests/photo-aesthetic/test_aesthetic.py
- Document task routing and ignore model weight files in .gitignore
- Add ClockProps.minAestheticScore (default 5.5, clamped 1.0...9.5) with tolerant decode
- Add aesthetic.json loading and score filtering in ClockPhotoLibrary
- Add aesthetic threshold slider and live photo count in AdminView
- Re-push updated photo list from AppState when threshold changes
- Add unit/selftest coverage for aesthetic decoding, clamping, and score filtering
xrisk merged commit e6000e03d1 into main 2026-10-16 13:23:18 +00: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
xrisk/tvd!12
No description provided.