digital-art-api / scripts

Commit History

  1. asd

    Ruzzel Mendoza
    5d0b1a5

  1. Phase 5: rotation-aware global pre-filter + scoring refinements - global_prefilter_distance: query phash('0') vs ALL SIX stored transform-variant phashes (6 Hamming ops, no re-hashing); scan_database skips a row only when every variant exceeds GLOBAL_PREFILTER_MAX_DISTANCE (default 28, env-overridable) - pre-filter is performance-only: never sets or influences scores of rows that pass; skip count logged - scan_database/check_distance_between_serp now return true top-5 sorted by calibrated_confidence (primary score) with the full new field set per match (was: history of interim bests) - scoring refinement for rotate-and-repost: final = 0.3*T*transform_cap + 0.7*B*block_multiplier so block geometry can no longer zero out transform evidence (pure rotations: T~65, blocks 0 -> final ~20, flagged) - background-coincidence guard: transform resemblance without ANY block corroboration is voided unless the alignment is tight (avg dist <= STRICT/2) - fixes the matching-background false positive at the global level while preserving rotation/mirror/flip detection - regression fixture verified: legacy 96.48% (old bug) vs new 0.0; sparse-art exact copy stays 100.0 (no over-suppression); real-data baseline re-verified: 78/78 unrelated pairs score 0.0, prefilter dists 18-32 vs cutoff 28 (kept: conservative, true copies at <=10) - tests 5/6/7 added: sparse-art multiplier, original-bug regression, prefilter + scan_database

    Ruzzel Mendoza
    f83b9ab
  2. Phase 4: baseline calibration + calibrated_confidence - scripts/calibrate_baseline.py: offline script (not wired to API) that cross-pairs registered artworks from Supabase (or a --from-json dump) through the consensus pipeline and persists config/calibration.json - lib/phash: load_calibration()/calibrated_confidence()/plagiarism_threshold(); percentile-table interpolation with normal-CDF tails, identity fallback until calibrated; compare_hash_sets now returns calibrated_confidence + calibration_loaded - ran against live DB: 13 artworks / 78 unrelated pairs. Result: legacy scores unrelated pairs 56.7-72.3% (reproduces reported false positives); new consensus scores all 78 pairs 0.0 (0/78 block agreements; best unrelated block distance min 17.7 vs STRICT_MATCH_DISTANCE 12) - threshold: degenerate baseline (stddev 0) -> documented rule threshold = best unrelated score + 5 = 5.0; switches to p99 once the catalog yields a spread - constants revisited vs data (follow-up brief item 4): STRICT_MATCH_DISTANCE=12 supported by 17.7+ gap; MIN_BLOCK_STDDEV=5 unverifiable until DB rows carry entropy (kept); prefilter cutoff validated in Phase 5 - tests: percentile interpolation, tail extrapolation/clamping, identity fallback, threshold lookup, compare_hash_sets field presence

    Ruzzel Mendoza
    61d2c38