Spaces:
Sleeping
Sleeping
Commit History
-
fallback legacy
Ruzzel Mendoza18f4339 -
asd
Ruzzel Mendoza5d0b1a5
-
Fix transform_consistency default + expose agreement counts
Ruzzel MendozaReporting bug (from review of the production washed-out response): compute_transform_consistency returned the neutral (1.0, None) default even when there were NO agreeing block pairs, so every unrelated row showed a misleadingly perfect consistency of 1.0 next to a raw/calibrated score of 0. That is the root of the reported page of constants: raw_similarity 0 + calibrated_confidence 0 + transform_consistency 1.0 + content_blocks_used 5. Fix (reporting-only; zero score impact): - compute_transform_consistency([]) now returns (0.0, None). Only a non-empty set of agreements that is entirely geometrically uninformative (e.g. center-center) keeps the neutral (1.0, None); the MIN_CONSENSUS_BLOCKS cap continues to guard against single coincidental matches. - Algebra unchanged: with no block agreements the block contribution is already 0, so the consistency multiplier (0 or 1) does not change the score. Expose agreement counts on every match object and the compare payload: - transfor…6f114bb
-
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 Mendozaf83b9ab -
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 Mendoza61d2c38 -
Phase 3: transform/geometric consistency confidence multiplier - TRANSFORM_BLOCK_MAP: where each block position lands under 0/90/180/270/mirror/flip - compute_transform_consistency: agreeing block pairs vote for the transform implied by their position mapping (center matches excluded as uninformative, ambiguous pairs split votes); returns fraction of votes held by dominant transform - confidence_multiplier = consistency * evidence cap; cap ramps to 1 at MIN_CONSENSUS_BLOCKS (default 2) but never demands more agreeing blocks than the image has content blocks (sparse-art fairness) - final score = (0.3*transform + 0.7*block consensus) * multiplier; expose transform_consistency and dominant_transform in compare_hash_sets - tests: unit votes, identical=1.0 dominant '0', scrambled quadrants -> 0.5 + suppressed score, single lucky match capped at 0.5
Ruzzel Mendozaf98281a -
Phase 2: consensus-based scoring - replace single-minimum-distance logic in compare_blocks/compare_transforms with per-component best-match consensus: count pairs below tunable STRICT_MATCH_DISTANCE (default 12.0), derive similarity from (agreement ratio, avg distance of agreeing pairs) - expose agreements/agreement_ratio/content_blocks_used in results - retain old algorithm as compare_blocks_legacy/compare_transforms_legacy; compare_hash_sets now returns raw_similarity (new method) and raw_similarity_legacy (old method) side by side for transition-period validation - tests: identical -> ~100, one shared block -> legacy ~90 but consensus capped ~20, unrelated -> low
Ruzzel Mendozaf731132 -
Phase 1: entropy filtering for block matching - add block_entropy() (stddev of preprocessed grayscale block) and tunable MIN_BLOCK_STDDEV (env-overridable, default 5.0) - tag each block hash dict with its entropy score in generate_block_hashes - compare_blocks excludes pairs where either block is flat/low-detail; falls back to all blocks with low_content_warning when an image has no content - propagate content_blocks_used/low_content_warning through compare_hash_sets - legacy DB rows without entropy stay eligible (backward compat) - add pytest scaffolding and entropy-filtering tests
Ruzzel Mendoza4b85872