Add visible watermark detection & upgrade invisible watermark confidence#17
Merged
Add visible watermark detection & upgrade invisible watermark confidence#17
Conversation
…dence Implement two key improvements: 1. Visible watermark detection: New detector analyzes image corners for bright text overlays characteristic of Chinese AI disclosure badges (e.g., "AI生成" on Dreamina images). Uses luminance clustering and text-run analysis to identify watermarks with MEDIUM confidence for known AI positions. 2. Invisible watermark confidence upgrade: Invisible watermark signals now report MEDIUM confidence when indicators are exceptionally strong (bit agreement > 0.90, energy spread > 1.0) or when all 3 indicators fire, instead of always reporting LOW confidence. Changes: - New module: src/detector/visible_watermark.rs (bottom-up text detection via corner region analysis) - Enhanced: src/detector/watermark.rs (confidence escalation logic, video frame confidence passthrough) - Enhanced: src/detector/mod.rs (integration of visible watermark detection) - Enhanced: src/known_tools.rs (added "dreamina" pattern) - Added: i18n strings in all 7 locale files - Added: 3 integration tests for visible watermark detection - Added: test fixture (Dreamina image with visible watermarks) Results: - Dreamina image: LOW → MEDIUM (now detects both invisible + visible watermarks) - Sora video: LOW → MEDIUM (exceptionally strong invisible watermark signals) - No false positives on clean images All 67 tests passing. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement visible watermark detection for images with AI disclosure badges (e.g., Dreamina's "AI生成") and upgrade invisible watermark confidence from LOW to MEDIUM for exceptionally strong signals or complete indicator sets.
Changes
src/detector/visible_watermark.rs): Analyzes image corners for bright text overlays characteristic of Chinese AI tools. Uses luminance clustering, horizontal run-length analysis, and bimodal distribution checks. Reports MEDIUM confidence for known AI positions (top-left, bottom-right) with 3+ indicators, LOW otherwise.src/detector/watermark.rs): Introduces "exceptionally strong" thresholds (bit agreement > 0.90, energy spread > 1.0). Confidence escalates to MEDIUM when all 3 indicators fire OR when 2 indicators with exceptionally strong values fire. Video frames now pass through actual confidence instead of hardcoded LOW.src/detector/mod.rs): Visible watermark detector runs in deep mode alongside invisible watermark analysis for both images and video frames.src/known_tools.rs): Added "dreamina" to AI tool patterns (complements existing "jimeng"/"即梦").tests/watermark_detection.rs): 3 new integration tests validate visible watermark detection, preventing false positives on clean and invisible-watermarked images.Results
Checklist
cargo fmt -- --checkpassescargo clippy -- -D warningspassescargo testpasses (67/67 tests)🤖 Generated with Claude Code