From a8d4bce14a4027a2ab9f4acc44c831fc87ce89fa Mon Sep 17 00:00:00 2001 From: Victor Kuznetsov Date: Thu, 27 Aug 2026 20:05:03 -0700 Subject: [PATCH] Align watermark content with detector coverage --- README.md | 9 +- docs/cli.md | 4 +- docs/known-limitations.md | 13 +- docs/module-internals.md | 45 ++++- docs/python-api.md | 4 +- docs/supported-signals.md | 10 +- docs/verification-plan.md | 10 +- docs/watermarking-landscape.md | 28 +-- scripts/README.md | 1 + .../assets/visible-mark-candidates/README.md | 26 +++ .../visible-mark-candidates/dola_alpha.png | Bin 0 -> 3463 bytes .../gemini_text_alpha.png | Bin 0 -> 1911 bytes .../mindvideo_alpha.png | Bin 0 -> 3085 bytes .../notebooklm_alpha.png | Bin 0 -> 2752 bytes .../samsung_en_alpha.png | Bin 0 -> 1750 bytes scripts/cjk_tail_probe.py | 2 +- scripts/detection_timing_report.py | 2 +- scripts/real_examples_e2e.py | 4 +- scripts/registered_mark_calibrate.py | 175 ++++++++++++++++++ scripts/render_vendor_silhouettes.py | 140 ++++++++++++-- scripts/vendor_cohort_harvest.py | 2 +- scripts/vendor_mark_calibrate.py | 8 +- scripts/visible_eval.py | 8 +- scripts/visible_groundtruth.py | 16 +- scripts/visible_recall_sample.py | 8 +- scripts/visible_sheets.py | 8 +- .../_internal/constants.py | 25 +-- src/remove_ai_watermarks/_text_mark_engine.py | 31 ++-- src/remove_ai_watermarks/api.py | 11 +- .../assets/microsoft_alpha.png | Bin 0 -> 2477 bytes src/remove_ai_watermarks/cli.py | 2 +- src/remove_ai_watermarks/dwt_dct.py | 2 +- src/remove_ai_watermarks/identify.py | 2 +- .../invisible_watermark.py | 2 +- src/remove_ai_watermarks/kling_engine.py | 18 +- src/remove_ai_watermarks/metadata.py | 2 +- src/remove_ai_watermarks/microsoft_engine.py | 104 +++++++++++ src/remove_ai_watermarks/pill_engine.py | 2 +- src/remove_ai_watermarks/qwen_engine.py | 6 +- src/remove_ai_watermarks/runninghub_engine.py | 6 +- src/remove_ai_watermarks/video.py | 4 +- src/remove_ai_watermarks/video_visible.py | 4 +- .../watermark_registry.py | 40 +++- tests/test_cli.py | 4 +- tests/test_identify.py | 58 ++++-- tests/test_invisible_engine.py | 2 +- tests/test_kling_engine.py | 2 +- tests/test_metadata.py | 9 +- tests/test_metadata_internals.py | 10 +- tests/test_microsoft_engine.py | 163 ++++++++++++++++ tests/test_platform.py | 2 +- tests/test_registered_mark_calibrate.py | 59 ++++++ tests/test_runninghub_engine.py | 2 +- tests/test_script_help.py | 1 + tests/test_text_mark_engine.py | 4 +- tests/test_text_mark_faint_mask.py | 2 +- tests/test_tiling.py | 2 +- tests/test_trustmark_detector.py | 2 +- tests/test_video.py | 8 +- tests/test_video_fidelity_probe.py | 2 +- tests/test_watermark_registry.py | 15 +- 61 files changed, 933 insertions(+), 198 deletions(-) create mode 100644 scripts/assets/visible-mark-candidates/README.md create mode 100644 scripts/assets/visible-mark-candidates/dola_alpha.png create mode 100644 scripts/assets/visible-mark-candidates/gemini_text_alpha.png create mode 100644 scripts/assets/visible-mark-candidates/mindvideo_alpha.png create mode 100644 scripts/assets/visible-mark-candidates/notebooklm_alpha.png create mode 100644 scripts/assets/visible-mark-candidates/samsung_en_alpha.png create mode 100644 scripts/registered_mark_calibrate.py create mode 100644 src/remove_ai_watermarks/assets/microsoft_alpha.png create mode 100644 src/remove_ai_watermarks/microsoft_engine.py create mode 100644 tests/test_microsoft_engine.py create mode 100644 tests/test_registered_mark_calibrate.py diff --git a/README.md b/README.md index 509b7e6..447ad7f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Remove AI provenance marks from images and video you generated yourself: -- known visible labels such as the Gemini sparkle and vendor text marks; +- known visible labels such as the Google Gemini sparkle watermark and vendor text marks; - invisible pixel watermarks through diffusion regeneration; - C2PA, EXIF, XMP, IPTC, and related AI metadata. @@ -169,8 +169,8 @@ the specificity order shown below. Pass an explicit mark to restrict detection to one provider. Sora covers the moving Sora 2 mascot and wordmark. Veo covers both the current four-point diamond and the legacy `Veo` text. Seedance covers the fixed boxed -`AI` label, Dola covers the fixed `Dola AI` text, Hailuo covers the composite -`MINIMAX | hailuo AI` label, and Kling covers the bottom-right `KLING AI` +`AI` label, Dola covers the fixed `Dola AI` text, Hailuo AI covers the composite +`MINIMAX | hailuo AI` label, and Kling AI covers the bottom-right `KLING AI` label with its version suffix. A completed encode is published atomically. No output is written when no stable mark is found. HDR, PQ/HLG, and greater-than-8-bit inputs are rejected before encoding rather @@ -321,6 +321,7 @@ Visible mark support includes: - Google Gemini and Nano Banana visible sparkle watermark; - Doubao, Jimeng, Qwen, Kling AI, Yuanbao, Baidu, LiblibAI, and RunningHub labels; +- one calibrated Microsoft top-right white AI-badge variant; - one calibrated Samsung Galaxy AI label variant. Metadata and provenance inspection covers C2PA, EXIF, XMP, IPTC, common @@ -404,7 +405,7 @@ invisible removal. detail. - Visible video removal recognizes the moving Sora 2 wordmark, the current Veo diamond plus legacy `Veo` text, the Seedance boxed `AI` label, and the fixed - Dola, Hailuo, and Kling labels. It does not recognize the older Sora Turbo + Dola, Hailuo AI, and Kling AI labels. It does not recognize the older Sora Turbo corner swirl or unregistered layouts from those providers. The classical OpenCV backend can smear structured backgrounds; use MI-GAN or LaMa when recovery quality matters. diff --git a/docs/cli.md b/docs/cli.md index 37aec29..e7aa169 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -317,7 +317,7 @@ remove-ai-watermarks video visible kling.mp4 --mark kling -o kling_clean.mp4 The command supports the moving Sora mascot and wordmark, two Veo corner variants, the Seedance boxed `AI` label, the `Dola AI` text label, the -composite `MINIMAX | hailuo AI` label, and the bottom-right Kling label. Sora +composite `MINIMAX | hailuo AI` label, and the bottom-right Kling AI label. Sora searches the whole frame at multiple scales. The other detectors search bounded lower-frame regions with separate synthetic silhouettes. Kling additionally requires its bright low-saturation label near the frame edge. Every mark @@ -328,7 +328,7 @@ provenance-aware marks; metadata alone never creates a detection. `--mark auto` is the default. It evaluates all providers in one decode pass and selects the first stable match in specificity order: Sora, Veo, Seedance, Dola, -Hailuo, then Kling. Their confidence scores are independently calibrated and +Hailuo AI, then Kling AI. Their confidence scores are independently calibrated and are not compared across providers. Pass an explicit `--mark` to scan only that provider. diff --git a/docs/known-limitations.md b/docs/known-limitations.md index 88a8153..d155801 100644 --- a/docs/known-limitations.md +++ b/docs/known-limitations.md @@ -31,11 +31,14 @@ an unsupported locale, a different position, or a crop may be missed. Known examples: +- The Microsoft detector covers one calibrated top-right white pill. Microsoft's + [documented feature](https://support.microsoft.com/en-us/topic/include-a-watermark-when-content-from-microsoft-365-is-ai-generated-b00a656e-ae61-4692-8086-67d004421030) + can instead use a Copilot icon, `AI-Generated` text, or another position. - Samsung detection is calibrated for the Italian `Contenuti generati dall'AI` text variant. - The Jimeng top-left pill has a weak visual detector and is intentionally subject to additional product and background checks. -- Kling support covers the calibrated variants rather than every Kling label. +- Kling AI support covers the calibrated variants rather than every Kling AI label. Use `erase --region` when you can see and select an unsupported or missed mark. @@ -310,11 +313,11 @@ supported AI provenance metadata without transcoding streams. `video visible` and `remove_video_visible` additionally support the moving Sora 2 mascot and wordmark, the current Veo four-point diamond, the legacy -`Veo` text, the Seedance boxed `AI` label, the fixed `Dola AI` text, the Hailuo -MINIMAX/Hailuo composite label, and the bottom-right Kling label with its +`Veo` text, the Seedance boxed `AI` label, the fixed `Dola AI` text, the Hailuo AI +MINIMAX/Hailuo AI composite label, and the bottom-right Kling AI label with its version suffix. Detection requires a recurring visual candidate across adjacent frames. Fixed-mark candidates must remain anchored rather than -drifting with a scene object. Kling also requires a bright low-saturation +drifting with a scene object. Kling AI also requires a bright low-saturation candidate near the expected frame edge. Provider provenance can recover low-contrast runs only after visual evidence exists for the marks that define a provenance prior, so metadata alone does not erase a clean API export. @@ -325,7 +328,7 @@ policies and selects the first stable result in specificity order. Use an explicit mark when the provider is already known. Historical Sora Turbo exports use a small OpenAI swirl in the corner rather than the moving mascot-and-wordmark design; that earlier variant is not -detected by the `sora` video mark. Hailuo and Kling coverage is specific to the +detected by the `sora` video mark. Hailuo AI and Kling AI coverage is specific to the verified lower-edge layouts; a new provider layout needs a separate calibrated silhouette. Other provider video labels are not supported yet. Google video SynthID has an oracle-certified VAE removal path, while other proprietary diff --git a/docs/module-internals.md b/docs/module-internals.md index 4d9dd5d..c274148 100644 --- a/docs/module-internals.md +++ b/docs/module-internals.md @@ -296,13 +296,13 @@ from the gate. The full-clip oracle floor is detected while `0.15` did not. [`video_visible.py`](../src/remove_ai_watermarks/video_visible.py) implements -the first pixel stages for Sora, Veo, Seedance, Dola, Hailuo, and Kling. The +the first pixel stages for Sora, Veo, Seedance, Dola, Hailuo AI, and Kling AI. The Sora detector searches a normalized frame with a fully synthetic mascot-and-text silhouette at several scales. The Veo detector uses separate synthetic silhouettes for the current four-point diamond and legacy `Veo` text. Seedance uses a synthetic rounded boxed-`AI` silhouette, while Dola uses -an OpenCV-font `Dola AI` silhouette. Hailuo uses a synthetic waveform, -MINIMAX/Hailuo text, separator, and ring. Kling combines synthetic font +an OpenCV-font `Dola AI` silhouette. Hailuo AI uses a synthetic waveform, +MINIMAX/Hailuo AI text, separator, and ring. Kling AI combines synthetic font variants with a ring approximation of its swirl; the logo path rescues wordmarks whose version or font differs, while the edge and white-label gates reject recurring scene texture. All fixed-mark searches are bounded to the @@ -323,23 +323,23 @@ Every per-frame result is untrusted. Each provider's floors, minimum-run policy, fill padding and mask style are one row in `VISIBLE_MARK_POLICIES`, and every mark enters the same `stabilize_localizations` entry point; the recurrence implementation underneath knows nothing about providers. That policy row also -carries `accepts_provenance`, which forces `provenance=False` for Hailuo and Kling +carries `accepts_provenance`, which forces `provenance=False` for Hailuo AI and Kling AI — they have no metadata that could confirm them, and the guarantee used to be structural (their wrappers took no `provenance` parameter at all). Provenance can relax a low-contrast run only after recurring visual evidence exists. Sora transition frames follow the nearest confirmed moving position only with Sora provenance. Seedance, Dola, -Hailuo, and Kling additionally require candidates to remain anchored to the +Hailuo AI, and Kling AI additionally require candidates to remain anchored to the start of a run. This rejects slowly drifting scene details that still have -high frame-to-frame overlap. Hailuo and Kling do not infer provenance from +high frame-to-frame overlap. Hailuo AI and Kling AI do not infer provenance from technical encoder tags; their confirmed public samples carried no provider metadata. Removal runs in a second decode pass. Sora, legacy Veo text, Dola text, -Seedance, Hailuo, and Kling use box masks. Seedance deliberately fills the +Seedance, Hailuo AI, and Kling AI use box masks. Seedance deliberately fills the complete localized box: a synthetic outline mask passed repeat detection but left part of the real translucent border visible during visual end-to-end -review. Hailuo expands beyond the matched core to cover both provider icons. -Kling expands around the wordmark or swirl to include the version and optional +review. Hailuo AI expands beyond the matched core to cover both provider icons. +Kling AI expands around the wordmark or swirl to include the version and optional `PRO` suffix. The square Veo diamond uses a synthetic shape mask so transparent corners do not erase unrelated pixels. Every mask goes through the shared `watermark_registry.fill` backends. ffmpeg encodes the changed video stream and @@ -451,7 +451,9 @@ For an AI C2PA claim, a recognized product in `claim_generator` takes precedence over the certificate issuer: an application can sign through an upstream model provider without becoming that provider's product. Only exact product mappings receive this precedence; an unknown claim generator still falls back to issuer -attribution. +attribution. An unmapped issuer org reads as unknown-signer C2PA with no platform; +that is how Ideogram was surfaced (4 corpus uploads signed "Ideogram, Inc", +2026-08-08) before its vendor row was added on 2026-08-27. ### Metadata scanning and stripping @@ -800,6 +802,29 @@ be represented by the shared base: - [`runninghub_engine.py`](../src/remove_ai_watermarks/runninghub_engine.py) - [`baidu_engine.py`](../src/remove_ai_watermarks/baidu_engine.py) - [`liblib_engine.py`](../src/remove_ai_watermarks/liblib_engine.py) +- [`microsoft_engine.py`](../src/remove_ai_watermarks/microsoft_engine.py) + +The measured Microsoft badge variant (2026-08-27 registration) is the first +`tr`-corner mark and the first `long`-side scale basis: the pill tracks the +render dimension, so a +1024x1536 portrait carries the same pill as 1536x1024, and a width basis +undersized the template by the aspect ratio (portrait carriers fell to +0.15-0.32 NCC until the basis was measured). The silhouette is a white pill with +its synthetic internal shapes knocked out - the holes are what separate it from +any other bright rounded corner element (a plain white pill scores below the gate +in the tests). It does not claim coverage of Microsoft's other documented icon, +wording, or position variants. + +The 2026-08-27 rerun used the registered engine through +`scripts/registered_mark_calibrate.py`, rather than a copied detector +configuration. The manifest kept three evidence classes separate: 17 visually +confirmed carriers, 343 Microsoft-provenance files without a visual adjudication, +and 1200 non-overlapping no-signal controls. At the strict 0.38 gate, 15/17 +confirmed carriers fired (min 0.249, p50 0.519, p90 0.578, max 0.579), while +0/1200 controls fired (p99 0.200, max 0.293). The provenance cohort produced +78/343 fires, but that is not a recall measurement because provenance identifies +the provider, not the presence of this visible layout. No provenance relaxation +ships until that cohort is visually labeled. The detector and removal mask must use compatible geometry. A detector that fires while producing an empty or misplaced mask is a removal failure even if diff --git a/docs/python-api.md b/docs/python-api.md index ff1d2a2..4d93f11 100644 --- a/docs/python-api.md +++ b/docs/python-api.md @@ -563,8 +563,8 @@ independently and are not compared across detectors. Pass one of those explicit values to restrict the scan to a single provider. The Veo detector recognizes the current four-point diamond and the legacy `Veo` text. Seedance recognizes the boxed `AI` label, Dola recognizes -its compact text label, Hailuo recognizes the composite MINIMAX/Hailuo label, -and Kling recognizes its bottom-right logo, wordmark, and version suffix. Each +its compact text label, Hailuo AI recognizes the composite MINIMAX/Hailuo AI label, +and Kling AI recognizes its bottom-right logo, wordmark, and version suffix. Each variant has an independent synthetic silhouette and calibrated temporal policy. After each accepted frame is filled, `temporal_consistency=True` motion-aligns the preceding accepted fill and blends it only when the warped prior mask diff --git a/docs/supported-signals.md b/docs/supported-signals.md index 96eb44e..557af50 100644 --- a/docs/supported-signals.md +++ b/docs/supported-signals.md @@ -10,7 +10,7 @@ The `visible` command registers these mark keys: | Key | Mark | Expected area | Important limit | | --- | --- | --- | --- | -| `gemini` | Google Gemini sparkle | Usually bottom right | Detection includes a false positive gate. | +| `gemini` | Google Gemini visible watermark (sparkle) | Usually bottom right | Detection includes a false positive gate. | | `doubao` | `豆包AI生成` | Bottom right | Vendor specific text detector. | | `jimeng` | `★ 即梦AI` | Bottom right | Vendor specific text detector. | | `qwen` | `千问AI生成` | Bottom right | Strict visual gate. | @@ -20,6 +20,7 @@ The `visible` command registers these mark keys: | `runninghub` | `RunningHub AI生成` | Top left | Strict visual and position gates. | | `baidu` | `百度 AI生成` | Bottom right | Detector and extended removal footprint. | | `liblib` | `LiblibAI` | Bottom center | Includes a minimum image size gate. | +| `microsoft` | One Microsoft white AI-badge variant | Top right | Strict gate; other documented icon, text, and position variants are not covered. | | `jimeng_pill` | `AI生成` pill | Top left | Weak detector with additional product and background gates. | `--mark auto` evaluates all registered marks and removes every selected match. @@ -38,7 +39,7 @@ when you can select the affected area yourself. | `seedance` | Boxed `AI` label | Fixed bottom-right corner | Requires an anchored recurring match; the full localized box is filled because a thinner synthetic shape mask leaves the real translucent rim behind. | | `dola` | `Dola AI` text | Fixed bottom-right corner | Requires an anchored recurring match; ByteDance or BytePlus provenance can relax only an existing visual run. | | `hailuo` | `MINIMAX \| hailuo AI` composite label | Fixed lower edge | Uses a synthetic waveform, text, separator, and ring silhouette; the complete recurring label box is filled. A TC260 label naming MiniMax as producer can relax only an existing stable run. | -| `kling` | Kling swirl, `KLING AI`, version, and optional `PRO` suffix | Fixed bottom-right edge | Combines a synthetic logo rescue with font variants, an edge gate, a white-label gate, and anchored temporal recurrence. | +| `kling` | Kling AI swirl, `KLING AI`, version, and optional `PRO` suffix | Fixed bottom-right edge | Combines a synthetic logo rescue with font variants, an edge gate, a white-label gate, and anchored temporal recurrence. | `video identify`, `video visible`, and `video all` share this registry and the same temporal arbiter. It is separate from the image registry because selection @@ -216,6 +217,7 @@ not a universal clean verdict. | OpenAI image generators | None registered | Diffusion regeneration for supported invisible signals | C2PA and generator provenance | | Meta Muse Image | None on Muse output (legacy `Imagined with AI` unregistered) | Diffusion regeneration for Content Seal, oracle-verified on the default profile | XMP IPTC `trainedAlgorithmicMedia` companion tag; no local Content Seal decoder | | Microsoft Paint and Photos | None registered | External Microsoft oracle for InvisMark; no validated local decoder | Paint C2PA soft-binding algorithm and identifier | +| Microsoft image outputs (measured variant) | One top-right white AI-badge variant | No registered pixel decoder | C2PA attribution | | Stable Diffusion and SDXL | None registered | Diffusion regeneration; optional open decoder | Embedded parameters and text metadata | | FLUX | None registered | Diffusion regeneration; optional open decoder | C2PA for supported sources | | Adobe Firefly | None registered | Optional TrustMark Variant P decoder | C2PA | @@ -223,8 +225,8 @@ not a universal clean verdict. | Luma AI | None registered | No registered pixel decoder | PNG text generator tags (Uni-1) | | ByteDance generators | Doubao and Jimeng marks | No registered pixel decoder | TC260 AIGC, supported C2PA, and exact app-export AIGC disclosures | | Qwen | Qwen mark | No registered pixel decoder | TC260 AIGC | -| Kling | Kling image and video marks | No registered pixel decoder | TC260 AIGC | -| Hailuo / MiniMax video | Hailuo composite video label | No registered pixel decoder | TC260 AIGC where present | +| Kling AI | Kling AI image and video marks | No registered pixel decoder | TC260 AIGC | +| Hailuo AI / MiniMax video | Hailuo AI composite video label | No registered pixel decoder | TC260 AIGC where present | | Baidu | Baidu mark | No registered pixel decoder | TC260 AIGC | | LiblibAI | LiblibAI mark | No registered pixel decoder | TC260 AIGC | | RunningHub | RunningHub mark | No registered pixel decoder | TC260 AIGC | diff --git a/docs/verification-plan.md b/docs/verification-plan.md index fa2113f..4f531ac 100644 --- a/docs/verification-plan.md +++ b/docs/verification-plan.md @@ -24,7 +24,7 @@ Performance depends on format, enabled extras, and hardware. Measure it locally ## Tier A -- self-evident oracles (full corpus, unattended) -Properties that are true or false without anyone labelling anything. These are the +Properties that are true or false without anyone labeling anything. These are the backbone: they scale to large local datasets and catch regressions with zero human cost. ### A1. Recorded-verdict regression @@ -128,7 +128,7 @@ which read like twelve broken features. It was one bad harness parameter (`--ste sitting on top of one real bug. An error that is IDENTICAL across unrelated rows is evidence of a common cause, not of many faults -- check the shared input first. -## Tier B -- constructed ground truth (automatable, no labelling) +## Tier B -- constructed ground truth (automatable, no labeling) Where reality gives no answer key, build one. This is the tier that closes the two biggest holes: fill quality and detector response at the edge of the operating range. @@ -169,7 +169,7 @@ Peak RSS and wall time per backend x input size, up to 25 MP. The memory-constra tier is a real constraint (MI-GAN must stay ~0.6-0.9 GB by cropping around the mask); a regression here is invisible today and would only surface under load. -## Tier C -- human-labelled accuracy (bounded by labelling effort) +## Tier C -- human-labeled accuracy (bounded by labeling effort) The machinery exists: `visible_recall_sample.py` -> `visible_sheets.py` -> `visible_groundtruth.py` -> `visible_eval.py`. @@ -291,7 +291,7 @@ on one file. The bar is never "handles it" but **never raises and never silently 4. **B2 detector curves** -- cheap, and directly guards the geometry class of bug. 5. **A5 contract sweep over a representative local set**. 6. **B4 resource ceilings**, **E robustness**. -7. **C recall expansion** -- gated by labelling appetite. +7. **C recall expansion** -- gated by labeling appetite. 8. **D oracles** -- manual, per release. Every tier writes a versioned snapshot so runs are comparable over time; a run that cannot @@ -326,7 +326,7 @@ Per mark, what actually goes away when metadata is stripped: ### Measure before improving -Use Tier B2 detector-response curves before tuning a detector with sparse labelled +Use Tier B2 detector-response curves before tuning a detector with sparse labeled examples. Sweep size, contrast, aspect, and background texture so geometry regressions are visible without exposing private evaluation statistics. diff --git a/docs/watermarking-landscape.md b/docs/watermarking-landscape.md index 3da0fec..11f5fa2 100644 --- a/docs/watermarking-landscape.md +++ b/docs/watermarking-landscape.md @@ -10,7 +10,7 @@ Who embeds what, and whether it is locally detectable (so we know which gaps are **Root cause and external confirmation (deep-research 2026-06-19, adversarially verified).** This is the SCHEME's ceiling, not our usage — there is no better decoder to adopt. The imwatermark maintainers state verbatim (both the ShieldMnt and Stability-AI READMEs) that the algorithm "cannot guarantee to decode the original watermarks 100% accurately even though we don't apply any attack." Independent measurement (WMAdapter, arXiv:2406.08337 Table 2) puts dwtDct at only **~0.79 bit accuracy on CLEAN images (~38/48 bits — already below our 44 gate)**, collapsing to ~0.50 (chance) under crop/JPEG. Two code-verified + locally-reproduced mechanisms drive the content-dependent failures: (1) the decoder reads each bit as the **highest-magnitude DCT coefficient per block**, so any content coefficient exceeding the encoded target flips the bit; (2) the default embed is in the **YUV chroma channel, which 8-bit-clamps on white/bright pixels** (a +36 chroma delta survives a white-fill round-trip as only +4, ~89% loss) — this is the mechanism behind the bright-flat / minimalist failures and the all-ones degenerate decode. No maintained fork or detector decodes this scheme reliably: the WAVES benchmark (arXiv:2401.08573) relegates DWT-DCT to supplementary appendix G.5 and targets Stable Signature / Tree-Ring / StegaStamp instead; learned encoder/decoder schemes reach ~0.98-0.99 clean but are a DIFFERENT watermark class (not what SDXL/FLUX stamp). `dwtDctSvd` does not help (SDXL embeds `dwtDct`; dwtDctSvd cannot decode it, and its clean accuracy ~0.72 is lower). **Authoritative conclusion: the open DWT-DCT mark cannot be turned from positive-only into a reliable real-world detector; keep it positive-only and rely on C2PA.** (Refuted along the way: that the library is unmaintained, and that it is robust to JPEG but only fails on geometric attacks — both did not survive verification.) Consequence for the FLUX hosted-output question (BFL Playground, FLUX.2 [pro] + FLUX.1 [dev], 2026-06-19): all samples carry the signed C2PA manifest (issuer "Black Forest Labs"); the open DWT-DCT decode returned `None`, but every available FLUX carrier (textured fox AND a minimalist-flat generation) failed the positive control (28/48), so the detector is blind on them and **whether BFL hosted output embeds the open pixel watermark is UNRESOLVED** (an earlier note here wrongly asserted it absent — overstated; a later note blamed "high texture" — also wrong, flat carriers fail too). What IS established: C2PA is the reliable FLUX identifier; the `_BITS_48` pattern is correct (round-trips on chatgpt/firefly/random). Resolving the hosted question needs a hosted FLUX carrier that first passes a >=44/48 positive control, which neither a textured nor a flat prompt produced — low priority (the open mark is only a stripped-metadata fallback). -- **C2PA / IPTC (covered by the issuer/marker scan):** OpenAI, Google, Adobe Firefly, Microsoft (Copilot + Designer; Bing Image Creator collected 2026-05-24 still signs as "Microsoft" and now runs **MAI-Image**, NOT OpenAI/DALL-E), **Stability AI** (collected from Brand Studio / DreamStudio successor; signs C2PA as "Stability AI Ltd", no SynthID, no imwatermark on its current Stable Image model — issuer added to `C2PA_ISSUERS`), and **Canva** (Magic Media signs C2PA as "Canva" + `trainedAlgorithmicMedia` with a generic `c2pa-rs` claim generator, no SynthID — issuer `b"Canva"` → "Canva (Magic Media)"; verified samples disproved the earlier assumption that Canva downloads always strip C2PA). Still unsampled: Getty, Shutterstock. Midjourney embeds NO C2PA and no invisible watermark (our `mj-*` sample carried only the IPTC tag). +- **C2PA / IPTC (covered by the issuer/marker scan):** OpenAI, Google, Adobe Firefly, Microsoft (Copilot + Designer; Bing Image Creator collected 2026-05-24 still signs as "Microsoft" and now runs **MAI-Image**, NOT OpenAI/DALL·E), **Stability AI** (collected from Brand Studio / DreamStudio successor; signs C2PA as "Stability AI Ltd", no SynthID, no imwatermark on its current Stable Image model — issuer added to `C2PA_ISSUERS`), and **Canva** (Magic Media signs C2PA as "Canva" + `trainedAlgorithmicMedia` with a generic `c2pa-rs` claim generator, no SynthID — issuer `b"Canva"` → "Canva (Magic Media)"; verified samples disproved the earlier assumption that Canva downloads always strip C2PA). Still unsampled: Getty, Shutterstock. Midjourney embeds NO C2PA and no invisible watermark (our `mj-*` sample carried only the IPTC tag). **Samsung Galaxy AI** signs supported edits with C2PA and may carry the proprietary `genAIType` marker. The registered visible detector covers the @@ -28,7 +28,7 @@ take precedence over issuer attribution. Supported mappings include Higgsfield AI, Topaz Labs Image API, and TikTok Ad Creative Toolbox; an unknown claim generator still falls back to the certificate issuer. -**ByteDance Volcano Engine (Volcengine)** — the cloud behind Doubao / Jimeng — signs its AI image output with a cert from `certificate_center@volcengine.com` + `trainedAlgorithmicMedia` (issuer `b"volcengine"` → "ByteDance (Volcano Engine)", platform "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)"); note this is the C2PA-signed surface, distinct from the XMP/PNG TC260 `AIGC` label Doubao also uses. ByteDance's **international brand (BytePlus / Seedream / Seededit)** signs the same content as **"Byteplus Pte. Ltd."**. The bare `volcengine` needle missed it, so BytePlus output was mis-attributed to "Adobe Firefly" through an incidental "Adobe XMP" toolkit string. Issuer `b"Byteplus"` now maps directly to "BytePlus (ByteDance)". ByteDance's consumer app **Dreamina** (the international Jimeng brand) signs as **"Bytedance Pte. Ltd."** with a `Dreamina/x.y` claim generator but, unlike the Volcano Engine surface, ships **no `trainedAlgorithmicMedia`**. Issuer `b"Dreamina"` maps to "ByteDance (Dreamina)" with **`asserts_ai=True`**. Registering the broader **issuer** `b"Bytedance Pte"` was deliberately avoided because that same entity also signs non-AI CapCut edits; keying on the `Dreamina` generator token is precise. +**ByteDance Volcano Engine (Volcengine)** — the cloud behind Doubao / Jimeng — signs its AI image output with a cert from `certificate_center@volcengine.com` + `trainedAlgorithmicMedia` (issuer `b"volcengine"` → "ByteDance (Volcano Engine)", platform "ByteDance Volcano Engine"); note this is the C2PA-signed surface, distinct from the XMP/PNG TC260 `AIGC` label Doubao also uses. ByteDance's **international brand (BytePlus / Seedream / Seededit)** signs the same content as **"Byteplus Pte. Ltd."**. The bare `volcengine` needle missed it, so BytePlus output was mis-attributed to "Adobe Firefly" through an incidental "Adobe XMP" toolkit string. Issuer `b"Byteplus"` maps directly to "BytePlus (ByteDance)". ByteDance's consumer app **Dreamina** (the international Jimeng brand) signs as **"Bytedance Pte. Ltd."** with a `Dreamina/x.y` claim generator but, unlike the Volcano Engine surface, ships **no `trainedAlgorithmicMedia`**. Issuer `b"Dreamina"` maps to "ByteDance Dreamina" with **`asserts_ai=True`**. Registering the broader **issuer** `b"Bytedance Pte"` was deliberately avoided because that same entity also signs non-AI CapCut edits; keying on the `Dreamina` generator token is precise. - **EXIF/XMP/PNG-text generator tag (caught by `exif_generator`):** **Ideogram** writes EXIF `Make="Ideogram AI"` (collected 2026-05-24 — no C2PA, no SynthID, no imwatermark; the Make tag is the only signal). Additional verified generator stamps include **NovelAI** (`Software`, `Source`, and `Title` PNG text chunks), **Reve** (`Software` or XMP `CreatorTool` = `reve.com`), and **Aphrodite AI** (`Make` or `Software` = `Aphrodite AI`). - **App-export provenance and AIGC JSON:** supported ByteDance-family exports can place a JSON object in EXIF `ImageDescription` or `UserComment`, independently of C2PA or TC260. Exact `product` values for Doubao, Xinghui, and Dreamina are removable product provenance, but do not alone prove that the pixels were generated. Dreamina additionally requires `exportType=generation` for that verdict. A nested Aweme `aigc_type=1` or private ByteDance `aigc_label_type=1` / `2` is an AIGC disclosure; `0` is inconclusive and can occur on a Dreamina generation export. Plain Aweme, retouch, and `lv` exports are preserved. The lower-case private field is deliberately not interpreted as the normative TC260 `Label`, whose values `1` / `2` / `3` mean generated / possibly generated / suspected generated under [GB 45438-2025](https://www.tc260.org.cn/upload/2025-03-15/1742009439794081593.pdf). - **xAI / Grok — its own EXIF signature scheme, NOT C2PA (DETECTED by `metadata.xai_signature`, built 2026-05-26).** @@ -70,7 +70,7 @@ payloads. Removal remuxes either container through ffmpeg with stream copy. - **Built in the dated batch:** soft-binding vendor detection, IPTC Photo Metadata AI-disclosure fields, C2PA detection and stripping for supported ISOBMFF video, the optional Adobe TrustMark decoder, and temporally stabilized - visible Sora, Veo, Seedance, Dola, Hailuo, and Kling removal. Other visible + visible Sora, Veo, Seedance, Dola, Hailuo AI, and Kling AI removal. Other visible video logos and proprietary audio-watermark detection remain outside the package. Metadata stripping for supported audio containers is a separate implemented @@ -116,12 +116,12 @@ every frame, then requires an anchored temporal run. This extra anchor check was necessary because a moving clean scene detail could retain enough adjacent overlap to pass a recurrence-only gate. -**Hailuo and Kling use larger fixed composite labels.** Verified Hailuo exports -carry a lower-edge waveform, `MINIMAX`, separator, Hailuo ring, and -`hailuo AI` text. Verified Kling exports carry a bottom-right swirl, +**Hailuo AI and Kling AI use larger fixed composite labels.** Verified Hailuo AI exports +carry a lower-edge waveform, `MINIMAX`, separator, Hailuo AI ring, and +`hailuo AI` text. Verified Kling AI exports carry a bottom-right swirl, `KLING AI`, a changing version suffix, and sometimes `PRO`. The detectors use -only synthetic primitives and fonts. Hailuo expands the matched core to cover -the complete composite. Kling combines a version-independent text core with a +only synthetic primitives and fonts. Hailuo AI expands the matched core to cover +the complete composite. Kling AI combines a version-independent text core with a synthetic ring rescue, then requires the recurring candidate to reach the expected frame edge and contain enough bright low-saturation pixels. Those extra gates were added after clean Luma and PixVerse scene details passed shape @@ -131,17 +131,17 @@ instead uses Florence-2 to identify arbitrary watermarks before LaMa inpainting. That is broader, but it carries a much heavier model and a less auditable detection boundary than the provider-specific synthetic path here. -**The faint-visible-mark precision/recall wall is fundamental, not a heuristic artifact.** The visible-watermark-detection literature has moved to LEARNED segmentation / object-detection (WDNet WACV'21 arXiv:2012.07616; SLBR ACM MM'21, open code+weights; the PRCV'18 large-scale detector; Su et al. survey 2025), but three verified findings bound what a learned detector actually buys: (1) a claim that a confidence threshold "cleanly separates" true from false matches even with a learned CNN front-end was **REFUTED** in verification (arXiv:1705.08593) -- the precision/recall wall persists even with learned features. (2) Learned detectors need a LARGE, pattern-diverse labeled dataset trained on synthetic composites (PRCV'18: 60k images / 80 watermark classes; CLWD: 60k / 160 marks), and off-distribution degradation is a documented real axis (models trained on limited-pattern LVW transfer worse; diversity of training patterns drives generalization). (3) Inference is cheap (WDNet ~8 ms at 256x256) -- the cost is the data pipeline, not runtime. Net: a learned detector shifts the frontier but does NOT remove the wall; for a SINGLE mark the cheapest next step is a small patch classifier (real-sparkle vs false-positive) on top of the existing NCC localizer, not a full segmentation model. SLBR is a ready baseline. The current NCC + false-positive gate (core-ring brightness margin + gradient-NCC crispness + white-core saturation) is a sound operating point, and the residual miss is the information-theoretic wall the literature confirms. +**Learned detectors change the visible-mark precision/recall tradeoff; they do not establish a universal separator.** The visible-watermark-detection literature has moved to learned segmentation and object detection (WDNet WACV'21 arXiv:2012.07616; SLBR ACM MM'21, open code and weights; the PRCV'18 large-scale detector; Su et al. survey 2025). The cited arXiv:1705.08593 paper reports a method that significantly reduces false matches and eliminates them after rejecting a small fraction of matches on its electron-microscopy task; it does not prove an information-theoretic limit for watermark detection. Learned watermark detectors also rely on large, pattern-diverse labeled datasets built with synthetic composites (PRCV'18: 60k images / 80 watermark classes; CLWD: 60k / 160 marks), and transfer depends on the diversity represented in training. Inference can be cheap (WDNet reports roughly 8 ms at 256x256), while the labeled-data and evaluation pipeline remain the larger project cost. A learned detector is therefore a possible future operating point, not evidence that the current NCC gate is theoretically optimal. -**Visible-mark landscape beyond the registry.** Since Muse Image (2026-07) Meta's own generation output carries NO visible mark, only the invisible proprietary Content Seal; the legacy visible "Imagined with AI" mark (bottom-LEFT, a small symbol) belongs to the pre-2026 Meta AI / "Imagine" pipeline and remains unregistered (string verified, position not). For third-party images Meta relies on C2PA / IPTC, not a visible mark. Samsung Galaxy AI additionally uses a **four-star icon** variant in a corner alongside the localized text wordmark `samsung_engine` calibrates (only the Italian text variant is covered) -- the icon is a distinct, uncovered variant. Every source agrees visible + metadata marks are trivially removable (crop / screenshot, ~2 s), which is the tool's premise. +**Visible-mark landscape beyond the registry.** Since Muse Image (2026-07) Meta's own generation output carries no visible mark, only the invisible proprietary Content Seal; the legacy visible "Imagined with AI" mark belongs to the pre-2026 Meta AI / "Imagine" pipeline and remains unregistered (string verified, position not). For third-party images Meta relies on C2PA / IPTC, not a visible mark. The Samsung detector covers only the measured Italian text wordmark; no separate icon-only variant has been verified. Visible overlays and embedded metadata can usually be removed without changing the underlying generation model, which is the tool's premise. **Regulatory driver -- China GB 45438-2025 is the strongest VISIBLE-mark mandate.** The CAC / TC260 "Measures for Labeling AI-Generated Synthesized Content" (issued March 2025, **effective 2025-09-01**, technical standard **GB 45438-2025**, building on the TC260 Aug-2023 practice guide) MANDATE a **visible** label for AI images -- a visible textual mark whose height must be **>= 5% of the image's shortest side** -- plus the metadata (implicit) label. Several such CJK text marks are now registered; see [supported signals](supported-signals.md) for the current list. By contrast EU AI Act Article 50 mandates only the MACHINE-READABLE mark (enforceable 2026-08-02, grace to 2026-12-02); a visible label is proposed and modality-specific (visible for images) but is NOT a hard "fixed icon" mandate -- a claim that Art 50 requires a clearly-visible fixed icon for images was refuted in verification. Primary-source dates verified against the article/standard text, not search summaries. ## Uncovered visible marks: implementation specs (deep-research 2026-07-18) -Compatibility testing showed that TC260-labelled images can still produce no visible-mark +Compatibility testing showed that TC260-labeled images can still produce no visible-mark detection. The main causes were a fixed Doubao localization defect and genuinely -uncovered vendors. Verification status is labelled per claim; treat (b)/(c) as leads, +uncovered vendors. Verification status is labeled per claim; treat (b)/(c) as leads, not ground truth. **GB 45438-2025 clause 5.2, the binding constraint for every Chinese mark (VERIFIED (a) -- full standard text extracted from the TC260-hosted PDF).** Verbatim requirements for an image's explicit label: @@ -153,7 +153,7 @@ not ground truth. Two consequences we can exploit: (1) the 5% floor is a **scale prior** -- a compliant CN mark's glyphs are large (>= 51 px on a 1024² image), so a CN silhouette ladder can be anchored at ~5-10% of the short side instead of swept broadly, which should cut false fires; (2) every compliant string shares the tail `AI生成` / `AI合成`, so a shared suffix silhouette plus a per-vendor prefix may beat five independent templates. NOT established: whether 文字高度 means cap height, em box, or rendered bounding box (a ~1.3x spread in template scale). Sources: `https://www.tc260.org.cn/upload/2025-03-15/1742009439794081593.pdf`, parent CAC measure `https://www.cac.gov.cn/2025-03/14/c_1743654684782215.htm` (the CAC text itself specifies no size or corner). -**Alibaba Qwen -- two surfaces that differ (API tier VERIFIED (a)).** Model Studio docs state verbatim that the API adds a `Qwen-Image` watermark 在图像右下角 and 默认值为 false -- so API output is **unwatermarked by default**, and when enabled the mark is a LATIN wordmark, not CJK, and not GB-compliant in wording. The consumer app's `千问AI生成` (bottom-right) is (b) secondary only -- no Alibaba primary page states it. So Qwen needs TWO templates, and its absence is never evidence of a clean image. Source: `https://help.aliyun.com/zh/model-studio/qwen-image-api`. +**Alibaba Cloud Qwen -- two surfaces that differ (API tier VERIFIED (a)).** Model Studio docs state verbatim that the API adds a `Qwen-Image` watermark 在图像右下角 and 默认值为 false -- so API output is **unwatermarked by default**, and when enabled the mark is a LATIN wordmark, not CJK, and not GB-compliant in wording. The consumer app's `千问AI生成` (bottom-right) is (b) secondary only -- no Alibaba primary page states it. So Qwen needs TWO templates, and its absence is never evidence of a clean image. Source: `https://help.aliyun.com/zh/model-studio/qwen-image-api`. **星绘 is ByteDance (VERIFIED (a): Baidu Baike + App Store listing, now branded 豆包旗下, team folded into Doubao April 2025).** So `星绘AI生成` is very likely the Doubao house style -- same typeface, same corner, possibly the same top-left `AI生成` pill. Starting from the Doubao `TextMarkConfig` and swapping the two lead glyphs is the cheap path. String/position themselves are (c) inferred. @@ -165,7 +165,7 @@ Two consequences we can exploit: (1) the 5% floor is a **scale prior** -- a comp **Meta `Imagined with AI` (string VERIFIED (a) from Meta's own newsroom; POSITION NOT VERIFIED).** Sources conflict on placement. Do not encode a corner without a verified sample. A dedicated 2026-08-27 sample hunt failed to obtain one: the Feb-2024 newsroom images are UI mockups whose photos carry no in-pixel mark; community posts (Threads `C8_rS_MuEId` titled "lower left corner", a Facebook share) corroborate bottom-LEFT verbally but their files defeat pixel verification; press screenshots predate the mark (Dec 2023); `imagine.meta.com` is dead (redirects to meta.ai) and its Wayback captures are broken SPA error pages. The mark's generator no longer exists (Muse output has no visible mark), so no fresh sample can be made. Removal stays on the generic `erase --region` path until a legacy capture surfaces. Source: `https://about.fb.com/news/2024/02/labeling-ai-generated-images-on-facebook-instagram-and-threads/`. -**Samsung English/other locales: still not established.** Samsung's own support page says only that "A Galaxy AI watermark will appear on AI-generated images" -- no string, no corner. Every community thread carrying the exact English string returned HTTP 403 to WebFetch, so the search paraphrase (bottom-left) is deliberately NOT recorded as fact. Feature-tier detail (b): the mark is applied by Generative Edit / sketch-to-image but reportedly NOT by Object Eraser, so Samsung absence is feature-dependent. The four-star icon variant: nothing found. +**Samsung English/other locales: still not established.** Samsung's own support page says only that "A Galaxy AI watermark will appear on AI-generated images" -- no string, no corner. Every community thread carrying the exact English string returned HTTP 403 to WebFetch, so the search paraphrase (bottom-left) is deliberately NOT recorded as fact. Feature-tier detail (b): the mark is applied by Generative Edit / sketch-to-image but reportedly NOT by Object Eraser, so Samsung absence is feature-dependent. No separate icon-only variant was established. **The one document that would settle ByteDance placement is BLOCKED.** Douyin's 《抖音关于人工智能生成内容标识的水印与元数据规范》 aims to give AI tools a unified watermark style and position, which would cover Doubao / Jimeng / 星绘 at once. Both mirrors return HTTP 403 to WebFetch; a secondary report (b, unconfirmed) says the watermark is `AI生成` + tool name + company name placed **top-left** -- which would explain the Jimeng pill's top-left position but contradicts the GB annex's bottom-right example. Worth one retry through Chrome MCP with a real browser session. diff --git a/scripts/README.md b/scripts/README.md index 3cc35fd..58f2a8b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -34,6 +34,7 @@ explicitly names a tracked canonical result. | `detector_response.py` | Measure detector response over mark size, contrast, background, and aspect. | | `fill_quality.py` | Measure visible-fill quality against constructed ground truth. | | `ladder_headroom.py` | Measure recall cost from the coarse scale ladder. | +| `registered_mark_calibrate.py` | Measure a registered detector without conflating visual positives, metadata cohorts, adjudicated negatives, and unlabeled controls. | | `synthid_corpus.py` | Ingest and inspect the local SynthID reference corpus. | | `vendor_cohort_harvest.py` | Partition TC260 carriers by producer code. | | `vendor_mark_calibrate.py` | Calibrate a candidate vendor text detector. | diff --git a/scripts/assets/visible-mark-candidates/README.md b/scripts/assets/visible-mark-candidates/README.md new file mode 100644 index 0000000..2a8eb93 --- /dev/null +++ b/scripts/assets/visible-mark-candidates/README.md @@ -0,0 +1,26 @@ +# Unregistered visible-mark candidates + +Synthetic detection silhouettes for marks that are measured but NOT registered: +none of these separates its positives from clean negatives yet, so shipping them +would attribute and fill corners on content that carries no mark (a false fill +is the worse error). Assets are regenerated by +`scripts/render_vendor_silhouettes.py`; a candidate is deleted from here on the +day its mark registers (the asset moves to the package `assets/`). + +Measurements below are local calibration snapshots. Candidate pools are +provenance cohorts, not automatically visible-mark positives; comparison controls +are independently selected no-signal images and are not adjudicated negatives. +Each needs capture-solved alphas or vendor-accurate font work before it can +ship; `scripts/vendor_mark_calibrate.py` is the candidate-detector harness. + +| Asset | Mark | Evidence | Result | +| --- | --- | --- | --- | +| `samsung_en_alpha.png` | Samsung Galaxy AI label, English locale ("AI-generated content", bottom-left) | 5 corpus files | POS 0.11-0.30 vs NEG max 0.40 (binary); tophat/gray tried, no separation. The registered Italian engine scores 0.18-0.31 on the same files -- same layout class, wrong glyph template. | +| `gemini_text_alpha.png` | "Generated with Gemini" text label (bottom-right; the registered gemini mark is the sparkle icon) | 3 corpus files | POS 0.07-0.22 vs NEG max 0.32; coverage gate finds the blob (0.29-0.35) but the Arial silhouette misses Google's letterforms. | +| `notebooklm_alpha.png` | NotebookLM wordmark (bottom-right) | 12 corpus files | locate geometry not yet fitted; POS max 0.12. | +| `dola_alpha.png` | DolaAI on images (the video mark is registered) | 12 corpus files | POS 0.11-0.21 vs NEG max 0.30. | +| `mindvideo_alpha.png` | MindVideo.AI (top-right) | 11 corpus files | POS 0.29-0.32 vs NEG max 0.30 -- borderline overlap, not shippable. | +| `xinghui_alpha.png` | 星绘AI生成 (parked before this set) | -- | prior parking, unchanged. | +| `qingyan_alpha.png` | 清言·AI生成 (parked before this set) | -- | prior parking, unchanged. | +| `hailuo_alpha.png` | Hailuo AI image wordmark (parked before this set; the VIDEO label is registered) | -- | prior parking, unchanged. | +| `catlogo_alpha.png` | outline cat-head + AI生成 (parked before this set) | -- | prior parking, unchanged. | diff --git a/scripts/assets/visible-mark-candidates/dola_alpha.png b/scripts/assets/visible-mark-candidates/dola_alpha.png new file mode 100644 index 0000000000000000000000000000000000000000..374e9602298059b97f9d6acfc4b068827f8c7dc7 GIT binary patch literal 3463 zcmV;24S4d2P)NQfp;L=hm-yTO35WlRYen_@5tp_foZ5m*$P*bpZt2Aj}=6Jm@ZfWefL zLkpOCsD=O$2UCTFghBKo5Na!ll{7gky}7TynJ4Y;J8a(fLwnzwJ9p=On!WGN%$-5V zgb5QSOqeiX!h{JECQO)kb+H=bdFcNDg}4-By!*A)^DurC;08lhH`wq&ObbM)#xOS+ zvdeEJH4$Iq;-VsFetuqdR_603PwuCsJx0EcpvkVk@#|RiQ=>{hAJ=5yR|<>GhJr!` zH!>5iocm7_@?ne(bNy}gtHYi!o`hL&=bKK*SN*T`M(LOCXRVORwepes_{A7sjjxP+ zlHY;cmliiKH^1e1z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O0!Ks`occ`?tVkomjm%0l6r;}*CPD9 z+Rw-Uwh*6CJ0l}QsM{JKJ8sd+i+B>D+%^pW236;tRs+b{xM<~Nz;shjXb3P`lE%sB zCR-t@R|kYTQ>KfAQtxBxRt)!|RCPq5tTTUUsE$y*k&z*kC?rL=lquick`|}Mi<(AH z)x*A>d!nUQSyl4B{e9@20+|BO!dtRRDMa<^h)^fWbd^w|&ht-X6q_DhPZ%vHEy5@E zT!E?d%E~t60FI6Pf=BdYcf|BjMpe<`YDe}wB>dZ_cw+#~KC@BhDt473t<~IY>byFF x3uV>@|LK2VYm0_$d>>`;w|RA_LmkK!{0k&lAC@TsNjLxi002ovPDHLkV1kAWhE4zg literal 0 HcmV?d00001 diff --git a/scripts/assets/visible-mark-candidates/mindvideo_alpha.png b/scripts/assets/visible-mark-candidates/mindvideo_alpha.png new file mode 100644 index 0000000000000000000000000000000000000000..e381f50ea31e7bb444f99161179b90df55ab0d32 GIT binary patch literal 3085 zcmV+o4D$1dP)PCMF000ZrNklyIrsOy=RNOv&mjsT zh#-OpB8dMJgf(ql_J4UiKZrPUJd_?3l6Es+XkQ!&Cz<)#k{mBEfyF>y=H~+J((gvR zpW5c!$VmT#nfX%OeNT=|9{$42cOO+Z`Z0zX>}|Yn(%q{k~B8i~czqe?)XZZNxA*{00A)yTztRLBP#7H5Jd4U<^v0yA$?G>N*#%xk@l z_mFJtUt#T;-!96=%BX-IlUxLT%FO4bd~BuSP4J}2!z7Gb&)H-U$~$-+@8J-el&2AU zEjj>VTcd}I$~G=UWlYJ<@TAE@Qa&?d53}JAGatDhfe#SVHC~xV1mG126Y64RQ$p~! z_5+wI(b-So>N!-P{S&&+@I6BGD@1heIuVU5;*bz7rM10j#LR2XW{tXOExz$9tn!mJ zqHksFxZ+YB^H^-b)y#X&ig`aHis`e!RyrJ3f0@7WTm>44u2U&8_hLGjP$Il(!)noa zS;t-HY{Njf(sSb9B&yl%6K`FJ=tE7(RaSPjRyEEj*qNG|+E}Fer>3SZ#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a|yS3Ks=5uo357y5cbq; z`$?AA%>E?OB}Z2c7rz!t_-WnZI~milna1V5BF%;5w(Zj zbTbfDc~xA+m`g0>=R#RSZ)0ob7Sdf)YI_B9Q^{APU7wsIfE+|`HIT6o?2U-TDxs`| zZM=2J037&7YGRH@PZS@Oc0mDN6Usqp7XdMr{$tW!YqMSOM+PtwoY5P{FH7J*8j$qH z?R`=kWJ}i4j-8k0g(K*02BIpjhzl2YG(SH9F#v*O3~5rKv{t82O9nvBHq z`gO&%SQ>8e;?#akBI?y^(6mh_!}cjSqYm;6cl1deoc9Kp^~&A3?Ja<)$}8f+)nilh z1hLm9ExRcCW@k9D-{u#61`HIn zziQ6zL9_pzISzZoubq2K}T%?0`R)H?n8V(Y1edct2tin zABcj{a#rmCXdh>2ov{GwDjNF(<|YG&lG^maA_QI%K4nW<9}SKGrA0p@;k zwAC461)1GCvi9`5B+~&*BlCw>k7>7^+yo0CLH=^)Hj-P@q7!;-)=;$pFpumX*W8qW z8DvhUsM@pL9^)Be5_zyk%uD00^Gq~=CFJ2g)vESBL@u%dqA0J7dvNAv>W3X&hLeY^ zn2X4kb&6JyEkvGn4%1|76)PY?{&ME(7V7OsN0B1|bk&TtrVQBTN$dJ2LFd+4`a$({ z1I@C3p=XuNwOavElvl?+FmvbVt`T5H6>Fo>>RZWMyRMYxe_7)_QXoc?WhZXAFK^2b zhM75|znnQ#Uv$b@TA2N2SVS?mX$>QeJ8x|^WdP{7G2d0Vy3U~BZzZW&c}~Y4)8#4; zv{{|!ym?}23k4AC@*(1k%%Rd`7U_fh6pCT}Rc!1kCJR}nZ?D>;FmNmSlu70Pzx5pK zLxj>k13%$ek;)jX@z>~>)*!0>q-(t5`xg83OQlS6-SrQs%rD>kJ^fNC3q;LNkKS}& s+V_q;Ek7gj{1-V7EYE+DgNKxV0hb8z&IP;i!T Path | None: class Results: - """Collects one row per checked behaviour. + """Collects one row per checked behavior. A FAIL keeps the command's OUTPUT. That is not cosmetic: the first run of this harness discarded it, an `all` invocation failed once with exit 1, and because the output was @@ -166,7 +166,7 @@ def check_visible(res: Results, tmp: Path) -> None: """Real marked images -> the PRODUCT'S DECISION is honoured, and a removed mark clears. The success criterion is not "the mark is always gone" -- it is "the product did what it - decided, and the decision is right". Two designed behaviours make a blind re-detect + decided, and the decision is right". Two designed behaviors make a blind re-detect misleading: * The pill is GATED (`_keep_pill`): a low-confidence pill with no corroboration is deliberately NOT removed, so `visible` correctly writes nothing and exits 2. That is diff --git a/scripts/registered_mark_calibrate.py b/scripts/registered_mark_calibrate.py new file mode 100644 index 0000000..0bed36b --- /dev/null +++ b/scripts/registered_mark_calibrate.py @@ -0,0 +1,175 @@ +"""Measure a registered visible-mark detector on independently labeled arms. + +The input is a JSONL manifest with exactly two fields per row: + +``path`` + Absolute path, or a path relative to the manifest. +``arm`` + ``positive`` for a visually confirmed carrier, ``metadata`` for a + provenance-only cohort, ``negative`` for an independently adjudicated + no-mark image, or ``control`` for an unlabeled comparison image with no + known local signal. + +The arms stay separate because metadata names a provider, not the presence of a +visible mark, and missing local signals do not make an image a true negative. The +script imports the registered engine and reads its shipped gate, so calibration +cannot silently use a copied configuration. + +Input images and manifests are read-only. Keep private inputs and generated +manifests outside the repository or in a gitignored evaluation directory. + + uv run python scripts/registered_mark_calibrate.py microsoft manifest.jsonl +""" + +from __future__ import annotations + +import argparse +import json +import math +import sys +from collections import Counter +from pathlib import Path +from typing import Any, Literal, TypedDict, cast + +REPO = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(REPO / "src")) + +from remove_ai_watermarks import watermark_registry # noqa: E402 +from remove_ai_watermarks.image_io import imread # noqa: E402 + +Arm = Literal["positive", "metadata", "negative", "control"] +_ARMS: tuple[Arm, ...] = ("positive", "metadata", "negative", "control") + + +class ManifestRow(TypedDict): + path: str + arm: Arm + + +class ArmSummary(TypedDict): + n: int + unreadable: int + min: float | None + p50: float | None + p90: float | None + p99: float | None + max: float | None + fires: int + + +def _percentile(ordered: list[float], fraction: float) -> float | None: + """Return a nearest-rank percentile from values sorted in ascending order.""" + if not ordered: + return None + return ordered[max(0, math.ceil(fraction * len(ordered)) - 1)] + + +def summarize(values: list[float], *, unreadable: int, fires: int) -> ArmSummary: + """Summarize one independently defined arm without inferring its label.""" + ordered = sorted(values) + return { + "n": len(values), + "unreadable": unreadable, + "min": _percentile(ordered, 0.0), + "p50": _percentile(ordered, 0.5), + "p90": _percentile(ordered, 0.9), + "p99": _percentile(ordered, 0.99), + "max": _percentile(ordered, 1.0), + "fires": fires, + } + + +def load_manifest(path: Path) -> list[ManifestRow]: + """Load and validate a manifest, resolving relative paths beside it.""" + rows: list[ManifestRow] = [] + seen: set[Path] = set() + with path.open(encoding="utf-8") as manifest: + for line_number, line in enumerate(manifest, 1): + if not line.strip(): + continue + raw = json.loads(line) + if not isinstance(raw, dict) or set(raw) != {"path", "arm"}: + raise ValueError(f"{path}:{line_number}: expected exactly path and arm") + raw_path = raw["path"] + raw_arm = raw["arm"] + if not isinstance(raw_path, str) or not raw_path: + raise ValueError(f"{path}:{line_number}: path must be a non-empty string") + if raw_arm not in _ARMS: + raise ValueError(f"{path}:{line_number}: arm must be one of {', '.join(_ARMS)}") + image_path = Path(raw_path) + if not image_path.is_absolute(): + image_path = path.parent / image_path + image_path = image_path.resolve() + if image_path in seen: + raise ValueError(f"{path}:{line_number}: duplicate image path {image_path}") + seen.add(image_path) + rows.append({"path": str(image_path), "arm": cast("Arm", raw_arm)}) + if not rows: + raise ValueError(f"{path}: manifest is empty") + return rows + + +def measure(mark: str, rows: list[ManifestRow]) -> tuple[float, dict[Arm, ArmSummary]]: + """Score every row with the registered engine and its current shipped gate.""" + registered_mark = watermark_registry.get_mark(mark) + # Calibration intentionally resolves the registry's concrete engine so it + # cannot drift onto a copied configuration. + engine = watermark_registry._engine(mark) + config = getattr(engine, "config", None) + gate = getattr(config, "detect_ncc_threshold", None) + if not isinstance(gate, int | float): + raise ValueError(f"registered mark {mark!r} does not expose a text-detector NCC gate") + + scores: dict[Arm, list[float]] = {arm: [] for arm in _ARMS} + unreadable: Counter[Arm] = Counter() + fires: Counter[Arm] = Counter() + for row in rows: + image = imread(row["path"]) + if image is None: + unreadable[row["arm"]] += 1 + continue + detection: Any = registered_mark.detect(image) + scores[row["arm"]].append(float(detection.confidence)) + fires[row["arm"]] += bool(detection.detected) + + threshold = float(gate) + return threshold, {arm: summarize(scores[arm], unreadable=unreadable[arm], fires=fires[arm]) for arm in _ARMS} + + +def _format_stat(value: float | None) -> str: + return "-" if value is None else f"{value:.3f}" + + +def print_report(mark: str, gate: float, summaries: dict[Arm, ArmSummary]) -> None: + """Print a compact human-readable calibration report.""" + print(f"registered mark: {mark} gate: {gate:.3f}") + print( + f"{'arm':10s} {'n':>5s} {'bad':>5s} {'min':>7s} {'p50':>7s} {'p90':>7s} {'p99':>7s} {'max':>7s} {'fires':>7s}" + ) + for arm in _ARMS: + row = summaries[arm] + print( + f"{arm:10s} {row['n']:5d} {row['unreadable']:5d} " + f"{_format_stat(row['min']):>7s} {_format_stat(row['p50']):>7s} " + f"{_format_stat(row['p90']):>7s} {_format_stat(row['p99']):>7s} " + f"{_format_stat(row['max']):>7s} {row['fires']:7d}" + ) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("mark", choices=watermark_registry.mark_keys()) + parser.add_argument("manifest", type=Path) + parser.add_argument("--json", action="store_true", help="emit machine-readable JSON") + args = parser.parse_args() + + rows = load_manifest(args.manifest) + gate, summaries = measure(args.mark, rows) + if args.json: + print(json.dumps({"mark": args.mark, "gate": gate, "arms": summaries}, sort_keys=True)) + else: + print_report(args.mark, gate, summaries) + + +if __name__ == "__main__": + main() diff --git a/scripts/render_vendor_silhouettes.py b/scripts/render_vendor_silhouettes.py index 237e09d..567e5c3 100644 --- a/scripts/render_vendor_silhouettes.py +++ b/scripts/render_vendor_silhouettes.py @@ -12,11 +12,14 @@ from __future__ import annotations import sys from pathlib import Path -from typing import Any +from typing import TYPE_CHECKING, Any import numpy as np from PIL import Image, ImageDraw, ImageFont +if TYPE_CHECKING: + from collections.abc import Callable + _ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(_ROOT / "src")) @@ -42,7 +45,7 @@ MARKS = { "kling_alpha.png": "可灵AI 3.0", # The "cat-logo" candidate stamps an outline cat-head plus bold "AI生成", # bottom-right. It remains unregistered pending sufficient calibration coverage. - "catlogo_alpha.png": "CATLOGO", # sentinel: drawn by draw_catlogo(), not font-rendered + "catlogo_alpha.png": "cat logo + AI生成", # RunningHub top-left text mark. "runninghub_alpha.png": "RunningHub AI生成", # LibLibAI bottom-center wordmark. @@ -53,6 +56,19 @@ MARKS = { "hailuo_alpha.png": "Hailuo AI", # Baidu bottom-right text run. "baidu_alpha.png": "百度", + # Measured Microsoft top-right white AI-badge variant. Sentinel: drawn by + # draw_msbadge(), not font-rendered. + "microsoft_alpha.png": "Made with AI", + # Samsung Galaxy AI label, English locale (the registered samsung_alpha.png is + # the Italian "Contenuti generati dall'AI" silhouette; EN is the literal + # translation with the same leading sparkle). Sentinel: draw_samsung_en(). + "samsung_en_alpha.png": "AI-generated content", + # Gemini text-form label (the registered gemini mark is the sparkle icon). + "gemini_text_alpha.png": "Generated with Gemini", + # Candidate wordmarks measured on a local evaluation corpus (unregistered). + "notebooklm_alpha.png": "NotebookLM", + "dola_alpha.png": "DolaAI", + "mindvideo_alpha.png": "MindVideo.AI", } _REGISTERED = {f"{key}_alpha.png" for key in mark_keys()} & MARKS.keys() @@ -74,6 +90,24 @@ MARK_OPTS: dict[str, dict[str, Any]] = { } +def _fit_font( + font_path: str, + reaches_target: Callable[[ImageFont.FreeTypeFont], bool], + *, + index: int = 0, +) -> ImageFont.FreeTypeFont: + """Return the smallest 8-200 px font that reaches a render target.""" + low, high = 8, 200 + while low < high: + size = (low + high) // 2 + font = ImageFont.truetype(font_path, size, index=index) + if reaches_target(font): + high = size + else: + low = size + 1 + return ImageFont.truetype(font_path, low, index=index) + + def render(text: str, width: int = 335, opts: dict[str, Any] | None = None) -> np.ndarray: """Binary glyph silhouette (255 = glyph), sized to the doubao asset's convention. @@ -91,13 +125,11 @@ def render(text: str, width: int = 335, opts: dict[str, Any] | None = None) -> n probe = Image.new("L", (10, 10)) d0 = ImageDraw.Draw(probe) lines = text.split("\n") - size = 8 - while size < 200: # grow until the LONGEST line fills the target width - f = ImageFont.truetype(font_path, size, index=font_index) - if max(d0.textbbox((0, 0), ln, font=f)[2] for ln in lines) >= width * 0.98: - break - size += 1 - font = ImageFont.truetype(font_path, size, index=font_index) + font = _fit_font( + font_path, + lambda f: max(d0.textbbox((0, 0), ln, font=f)[2] for ln in lines) >= width * 0.98, + index=font_index, + ) boxes = [d0.textbbox((0, 0), ln, font=font) for ln in lines] line_h = max(bb[3] - bb[1] for bb in boxes) gap = max(1, int(line_h * gap_frac)) @@ -138,13 +170,7 @@ def draw_catlogo(width: int = 335) -> np.ndarray: probe = Image.new("L", (10, 10)) d0 = ImageDraw.Draw(probe) text = "AI生成" - size = 8 - while size < 200: - f = ImageFont.truetype(_FONT, size) - if d0.textbbox((0, 0), text, font=f)[2] >= width * 0.60: - break - size += 1 - font = ImageFont.truetype(_FONT, size) + font = _fit_font(_FONT, lambda f: d0.textbbox((0, 0), text, font=f)[2] >= width * 0.60) bb = d0.textbbox((0, 0), text, font=font) tw, th = bb[2] - bb[0], bb[3] - bb[1] cs = int(th * 1.08) @@ -182,10 +208,90 @@ def draw_catlogo(width: int = 335) -> np.ndarray: return np.array(im) +def _star_pts(cx: float, cy: float, r: float, waist: float) -> list[tuple[float, float]]: + return [ + (cx, cy - r), + (cx + r * waist, cy - r * waist), + (cx + r, cy), + (cx + r * waist, cy + r * waist), + (cx, cy + r), + (cx - r * waist, cy + r * waist), + (cx - r, cy), + (cx - r * waist, cy - r * waist), + ] + + +def _sparkle(draw: ImageDraw.ImageDraw, cx: float, cy: float, r: float) -> None: + """Draw the four-point cutout used by synthetic candidate silhouettes.""" + draw.polygon(_star_pts(cx, cy, r, 0.22), fill=0) + + +def draw_msbadge(width: int = 335) -> np.ndarray: + """Synthetic silhouette for the measured Microsoft top-right white pill. + + The top-hat front-end sees the bright pill with dark-text holes, so the template + carries the same holes -- that is what discriminates this pill from any other + white rounded element in the top-right corner. The text and four-point cutout + approximate the measured internal shape; they do not assert one universal + Microsoft icon or wording. Geometry measured on 17 visually confirmed carriers + on 2026-08-27: pill 0.152W x 0.040W, margins ~0.010W right / ~0.007W top, + glyph height ~0.39 of pill height. + """ + h = round(width / 3.78) + im = Image.new("L", (width, h), 0) + d = ImageDraw.Draw(im) + d.rounded_rectangle([0, 0, width - 1, h - 1], radius=h // 2, fill=255) + font_path = "/System/Library/Fonts/Supplemental/Arial Bold.ttf" + text = "Made with AI" + probe = Image.new("L", (10, 10)) + d0 = ImageDraw.Draw(probe) + font = _fit_font(font_path, lambda f: d0.textbbox((0, 0), text, font=f)[3] >= h * 0.39) + bb = d0.textbbox((0, 0), text, font=font) + th = bb[3] - bb[1] + r = h * 0.20 # sparkle radius, ~half the text height + pad_l = h * 0.22 + cx = pad_l + r + cy = h / 2 - 1 + tx = int(pad_l + 2 * r + h * 0.22) + d.text((tx - bb[0], (h - th) // 2 - bb[1]), text, font=font, fill=0) + _sparkle(d, cx, cy, r) + return np.array(im) + + +def draw_samsung_en(width: int = 335) -> np.ndarray: + """Samsung Galaxy AI English label: "AI-generated content" with the leading + 4-point sparkle, light-gray glyphs (same class as the registered Italian asset).""" + text = "AI-generated content" + font_path = "/System/Library/Fonts/Supplemental/Arial.ttf" + probe = Image.new("L", (10, 10)) + d0 = ImageDraw.Draw(probe) + font = _fit_font(font_path, lambda f: d0.textbbox((0, 0), text, font=f)[2] >= width * 0.80) + bb = d0.textbbox((0, 0), text, font=font) + tw, th = bb[2] - bb[0], bb[3] - bb[1] + r = th * 0.55 + gap = th * 0.45 + im = Image.new("L", (int(tw + gap + 2 * r + 8), th + 8), 0) + d = ImageDraw.Draw(im) + # sparkle as bright glyph (this silhouette is light-glyph class, not a pill) + d.polygon(_star_pts(4 + r, 4 + th / 2, r, 0.22), fill=255) + d.text((4 + 2 * r + gap - bb[0], 4 - bb[1]), text, font=font, fill=255) + arr = np.array(im) + ys, xs = np.where(arr > 0) + return arr[ys.min() : ys.max() + 1, xs.min() : xs.max() + 1] + + +_CUSTOM_RENDERERS = { + "catlogo_alpha.png": draw_catlogo, + "microsoft_alpha.png": draw_msbadge, + "samsung_en_alpha.png": draw_samsung_en, +} + + def main() -> None: try: for name, text in MARKS.items(): - sil = draw_catlogo() if text == "CATLOGO" else render(text, opts=MARK_OPTS.get(name)) + renderer = _CUSTOM_RENDERERS.get(name) + sil = renderer() if renderer is not None else render(text, opts=MARK_OPTS.get(name)) output_dir = _PACKAGE_ASSETS if name in _REGISTERED else _CANDIDATE_ASSETS output_dir.mkdir(parents=True, exist_ok=True) output = output_dir / name diff --git a/scripts/vendor_cohort_harvest.py b/scripts/vendor_cohort_harvest.py index 3ec2561..f61226d 100644 --- a/scripts/vendor_cohort_harvest.py +++ b/scripts/vendor_cohort_harvest.py @@ -15,7 +15,7 @@ THE KEY ``001191110102MACQD9K64010000`` -> USCC ``91110102MACQD9K640``, which names a specific legal entity. So the metadata partitions carriers into per-ENTITY cohorts without looking at a single pixel. A cohort is a LABEL: once one frame - in it is eyeballed, every frame in it is a labelled example of that vendor's + in it is eyeballed, every frame in it is a labeled example of that vendor's mark. That is what turns "one confirmed positive" into "30+ per vendor". CLAUDE.md's "the generic TC260 label names no specific vendor" is about the diff --git a/scripts/vendor_mark_calibrate.py b/scripts/vendor_mark_calibrate.py index ebe1bdc..ecdd12d 100644 --- a/scripts/vendor_mark_calibrate.py +++ b/scripts/vendor_mark_calibrate.py @@ -14,7 +14,7 @@ WHERE THE POSITIVES COME FROM absence) visible directly. NEGATIVES - The 432 frames hand-labelled `present: []` in the 2026-07-18 round -- already-adjudicated + The 432 frames hand-labeled `present: []` in the 2026-07-18 round -- already-adjudicated no-visible-mark images, so the false-fire arm rests on human labels rather than on the absence of a detection. @@ -115,7 +115,7 @@ def load_sets(cohort: str) -> tuple[list[str], list[str]]: # The 2026-07-18 labels are in the vocabulary of the REGISTERED marks only # (gemini/doubao/jimeng/jimeng_pill): `present: []` means "no registered mark", NOT # "no mark at all" -- 146 of the 432 sit in a TC260 cohort, and qwen-cohort frames - # visibly carrying 千问AI生成 are labelled `present: []` there (measured 2026-07-21: + # visibly carrying 千问AI生成 are labeled `present: []` there (measured 2026-07-21: # they made up the clean arm's whole top tail, clean p99 0.37 -> 0.69). A gate read # off that arm is meaningless, so the clean arm excludes every frame in ANY TC260 # cohort -- cohort membership is the cheap proxy for "may carry a CJK AI label". @@ -168,7 +168,7 @@ def report(pos: list[dict[str, Any]], neg: list[dict[str, Any]], name: str) -> N p = np.array([r["score"] for r in pos]) n = np.array([r["score"] for r in neg]) - print(f"\n{'=' * 78}\n{name}: candidate-cohort vs hand-labelled clean\n{'=' * 78}") + print(f"\n{'=' * 78}\n{name}: candidate-cohort vs hand-labeled clean\n{'=' * 78}") print(f"\n{'arm':10s} {'n':>5s} {'p10':>7s} {'p50':>7s} {'p90':>7s} {'p95':>7s} {'p99':>7s} {'max':>7s}") for label, arr in (("cohort", p), ("clean", n)): if not len(arr): @@ -602,7 +602,7 @@ def main() -> None: crossfire(pools, cand, a.workers, a.gate) return - print(f"cohort {a.cohort}: {len(pos_paths)} candidates | clean: {len(neg_paths)} hand-labelled") + print(f"cohort {a.cohort}: {len(pos_paths)} candidates | clean: {len(neg_paths)} hand-labeled") print(f"scale_basis={a.scale_basis} overrides={overrides}") pos = run(pos_paths, a.asset, name, a.workers, a.scale_basis, overrides) neg = run(neg_paths, a.asset, name, a.workers, a.scale_basis, overrides) diff --git a/scripts/visible_eval.py b/scripts/visible_eval.py index a1ec918..bbb1b42 100644 --- a/scripts/visible_eval.py +++ b/scripts/visible_eval.py @@ -1,7 +1,7 @@ """Benchmark harness for the visible-mark detectors. Run this before AND after any detector change. It re-runs perception over the -hand-labelled ground truth and reports, per mark, how often a fire is correct -- +hand-labeled ground truth and reports, per mark, how often a fire is correct -- with Wilson intervals, so a change inside the noise is visible as such. uv run python scripts/visible_eval.py # score current code @@ -10,10 +10,10 @@ with Wilson intervals, so a change inside the noise is visible as such. WHAT THIS SET CAN AND CANNOT MEASURE -- read before quoting a number: - * PRECISION: sound. Every labelled crop is centred on the region a detector + * PRECISION: sound. Every labeled crop is centered on the region a detector pointed at, so "the detector fired mark K here, was K actually there" is exactly the question the labels answer. - * RECALL: NOT measurable here, and the harness refuses to print it. The labelled + * RECALL: NOT measurable here, and the harness refuses to print it. The labeled images were SAMPLED WHERE DETECTORS FIRED (relaxation additions plus controls), so images carrying a mark that every detector missed are absent by construction. Computing recall on this set would divide by a denominator that excludes exactly @@ -133,7 +133,7 @@ def report(res: dict, prev: dict | None = None) -> None: conf = {k: v for k, v in res["confusion"][m].items() if k != m} if conf: print(f" {m:12s} {dict(sorted(conf.items(), key=lambda kv: -kv[1]))}") - print("\n'scope' = images whose crop could rule on that mark; 'missed' = labelled marks it did not fire on.") + print("\n'scope' = images whose crop could rule on that mark; 'missed' = labeled marks it did not fire on.") print("NOTE: 'missed' is NOT recall -- this set was sampled where detectors fired, so images") print(" every detector missed are absent by construction. Use it only to catch a change") print(" LOSING marks it used to find; an unbiased random sample is needed for true recall.") diff --git a/scripts/visible_groundtruth.py b/scripts/visible_groundtruth.py index ea81c69..6fb56f0 100644 --- a/scripts/visible_groundtruth.py +++ b/scripts/visible_groundtruth.py @@ -1,6 +1,6 @@ -"""Consolidate the hand-labelled contact-sheet rounds into ONE ground-truth file. +"""Consolidate the hand-labeled contact-sheet rounds into ONE ground-truth file. -Ground truth is `uid -> the set of visible marks actually present`, hand-labelled +Ground truth is `uid -> the set of visible marks actually present`, hand-labeled blind against contact sheets with a two-sided control in every round. Rounds so far: 2026-07-18 text-mark/pill round : 423 cells (doubao / jimeng / jimeng_pill arms) @@ -10,12 +10,12 @@ DATA SAFETY: treat the input dataset as sensitive. This script reads a gitignore dataset and writes a gitignored ground-truth file. Neither the images nor this output may be committed; only the harness is. See the repo CLAUDE.md. -The labels record what the LABELLER SAW in the crop, one of: +The labels record what the labeler saw in the crop, one of: doubao | jimeng | pill | sparkle | other_ai_label | none | uncertain `other_ai_label` is a real visible AI label from a vendor we do NOT have a mark for (千问 / 百度 / 星绘 / 抖音); it is NOT a positive for any registered mark, but it is also not "clean" -- it is exactly what the relaxed jimeng detector confuses. -`uncertain` rows are EXCLUDED from scoring rather than coerced, so a labeller's +`uncertain` rows are EXCLUDED from scoring rather than coerced, so a labeler's honest doubt never becomes a fabricated data point. """ @@ -32,7 +32,7 @@ SEEN_TO_MARK = { "pill": "jimeng_pill", "sparkle": "gemini", } -# Which marks a crop centred on `key` lets the labeller rule on (same corner = visible +# Which marks a crop centered on `key` lets the labeler rule on (same corner = visible # in the same crop). Doubao and Jimeng share the bottom-right corner. _ADJUDICATES = { "doubao": ("doubao", "jimeng"), @@ -83,7 +83,7 @@ def main() -> None: type=Path, nargs="?", default=Path(".local-eval/textmark-relaxation"), - help="Directory containing the blinded labelling rounds", + help="Directory containing the blinded labeling rounds", ) root = parser.parse_args().root out = root / "groundtruth.jsonl" @@ -105,8 +105,8 @@ def main() -> None: m["uid"], {"uid": m["uid"], "path": m["path"], "present": [], "seen": [], "rounds": [], "adjudicated": []}, ) - # ADJUDICATION SCOPE -- load-bearing. A crop centred on one mark only lets - # the labeller rule on marks visible IN THAT CROP. A pill crop (top-left) + # ADJUDICATION SCOPE -- load-bearing. A crop centered on one mark only lets + # the labeler rule on marks visible IN THAT CROP. A pill crop (top-left) # says nothing about a bottom-right wordmark, so scoring jimeng against a # pill-round image would book real detections as false fires (~61% of pills # carry a wordmark). Bottom-right marks co-adjudicate each other: one crop diff --git a/scripts/visible_recall_sample.py b/scripts/visible_recall_sample.py index 8117726..21547f2 100644 --- a/scripts/visible_recall_sample.py +++ b/scripts/visible_recall_sample.py @@ -1,8 +1,8 @@ """Build an UNBIASED random sample for measuring visible-mark RECALL. -Every earlier labelling round sampled where detectors FIRED, so images that every +Every earlier labeling round sampled where detectors FIRED, so images that every detector missed were absent by construction and recall was unmeasurable. This round -samples at random within a provenance class and shows the labeller the corners where +samples at random within a provenance class and shows the labeler the corners where a mark can physically be, so a MISSED mark is visible as such. Design decisions that matter: @@ -13,11 +13,11 @@ Design decisions that matter: recall over all uploads would mostly measure how often each vendor appears. * NATIVE RESOLUTION crops, never a downscaled whole image: a 220px preview destroys a faint mark (measured in an earlier round), which would inflate the miss count with - the labeller's own blindness rather than the detector's. + the labeler's own blindness rather than the detector's. * BOTH corners per image (top-left pill, bottom-right wordmark/strip/sparkle), so one pass adjudicates every registered mark instead of one mark per crop. * The detector's verdict is NOT shown and is not in the sheet order -- the manifest - holds it and must not be opened until labelling ends. + holds it and must not be opened until labeling ends. """ from __future__ import annotations diff --git a/scripts/visible_sheets.py b/scripts/visible_sheets.py index a01d633..a3fecc1 100644 --- a/scripts/visible_sheets.py +++ b/scripts/visible_sheets.py @@ -1,14 +1,14 @@ -"""Build BLIND contact sheets for hand-labelling relaxation additions. +"""Build BLIND contact sheets for hand-labeling relaxation additions. Crops are centered on the DETECTED REGION (not the corner), padded by ~0.9x the mark size, and resized to 240px with INTER_NEAREST -- a downscaled preview destroys a faint mark, so nothing here may smooth. The manifest is written to a separate file that must -NOT be read until labelling is finished. +NOT be read until labeling is finished. Each sheet mixes three strata in shuffled order: add - the relaxation additions whose precision we are measuring - pos - strict-consistent detections (a mark is really there): labeller sensitivity - clean - verified-clean negatives (no mark can be there): labeller specificity + pos - strict-consistent detections (a mark is really there): labeler sensitivity + clean - verified-clean negatives (no mark can be there): labeler specificity The two control strata are what make a low measured precision trustworthy. """ diff --git a/src/remove_ai_watermarks/_internal/constants.py b/src/remove_ai_watermarks/_internal/constants.py index de0fe00..1cd7a65 100644 --- a/src/remove_ai_watermarks/_internal/constants.py +++ b/src/remove_ai_watermarks/_internal/constants.py @@ -81,29 +81,32 @@ C2PA_AI_VENDORS: tuple[C2paAiVendor, ...] = ( _vendor( b"volcengine", "ByteDance (Volcano Engine)", - "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)", - "ByteDance", + "ByteDance Volcano Engine", + "Volcano Engine", ), _vendor( "北京火山引擎科技有限公司", "ByteDance (Volcano Engine)", - "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)", - "ByteDance", - ), - _vendor( - b"Byteplus", "BytePlus (ByteDance)", "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)", "ByteDance" + "ByteDance Volcano Engine", + "Volcano Engine", ), + _vendor(b"Byteplus", "BytePlus (ByteDance)", "BytePlus (ByteDance)", "BytePlus"), _vendor( b"Dreamina", "ByteDance (Dreamina)", - "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)", - "ByteDance", + "ByteDance Dreamina", + "Dreamina", asserts_ai=True, ), _vendor(b"Canva", "Canva", "Canva (Magic Media)", "Canva"), _vendor(b"Eleven Labs", "ElevenLabs", "ElevenLabs", "ElevenLabs"), _vendor(b"fal-ai", "fal.ai", "fal.ai", "fal.ai", asserts_ai=True), _vendor(b"Bria", "Bria Artificial Intelligence", "Bria AI", "Bria", asserts_ai=True), + # Ideogram signs its downloads' Content Credentials with "Ideogram, Inc"; the + # issuer token is the org prefix (same substring-match class as "Bria" in + # "Bria Artificial Intelligence"). Found as an unmapped signer on 4 corpus + # uploads 2026-08-08 that identify reported as unknown-signer C2PA. + _vendor(b"Ideogram", "Ideogram", "Ideogram", "Ideogram", asserts_ai=True), _vendor(b"Truepic", "Truepic", None, None), ) @@ -116,7 +119,7 @@ C2PA_IDENTITY_AI_ORGS = frozenset(vendor.org for vendor in C2PA_AI_VENDORS if ve C2PA_CLAIM_GENERATOR_PLATFORMS: tuple[tuple[str, str], ...] = ( ("adobe_firefly", "Adobe Firefly"), ("firefly", "Adobe Firefly"), - ("dreamina", "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)"), + ("dreamina", "ByteDance Dreamina"), ("higgsfield ai", "Higgsfield AI"), ("topaz labs image api", "Topaz Labs"), ("tiktok ad creative toolbox", "TikTok Ad Creative Toolbox"), @@ -201,7 +204,7 @@ C2PA_ACTIONS = {f"c2pa.{action}".encode(): action for action in _C2PA_ACTION_NAM # what stops a newly registered TC260 vendor from silently falling back to ByteDance. # # What a TC260 label confirms when its producer is absent or unmapped. Historical -# behaviour, kept as the fallback so an unrecognized producer never regresses to no +# behavior, kept as the fallback so an unrecognized producer never regresses to no # relaxation at all: ByteDance's two products are the ones the relaxed band was # calibrated on (see _text_mark_engine._DEFAULT_PROVENANCE_NCC_FACTOR). TC260_FALLBACK_VENDORS: frozenset[str] = frozenset({"doubao", "jimeng"}) diff --git a/src/remove_ai_watermarks/_text_mark_engine.py b/src/remove_ai_watermarks/_text_mark_engine.py index 4c29dab..da3542d 100644 --- a/src/remove_ai_watermarks/_text_mark_engine.py +++ b/src/remove_ai_watermarks/_text_mark_engine.py @@ -52,8 +52,8 @@ _MIN_DETECT_SHORT_SIDE = 200 # This used to be ONE shared 0.7 for every text mark. Measured 2026-07-18 on the # `auto` path (the default -- no flag, driven by TC260 metadata), it turned out to # mean two completely different things per mark. Blind hand-label of the ADDITIONS -# (accepted with provenance, rejected without) over a labelled TC260 evaluation set, -# two-sided control (labeller sensitivity 100%/96%, specificity 100%/100%): +# (accepted with provenance, rejected without) over a labeled TC260 evaluation set, +# two-sided control (labeler sensitivity 100%/96%, specificity 100%/100%): # # mark band precision 95% CI n # doubao whole arm 76% 61-87% 42 @@ -89,8 +89,8 @@ class TextMarkConfig: name: str # short label for log lines (e.g. "Doubao") asset_name: str # bundled alpha PNG under assets/ (e.g. "doubao_alpha.png") corner: Literal[ - "br", "bl", "tl", "bc" - ] # bottom-right (Doubao/Jimeng), bottom-left (Samsung), top-left (RunningHub), bottom-center (LiblibAI) + "br", "bl", "tl", "tr", "bc" + ] # br (Doubao/Jimeng), bl (Samsung), tl (RunningHub), tr (Microsoft), bc (LiblibAI) margin_floor: int # min margin in px for locate (4 for br marks, 2 for Samsung) # locate geometry (fraction of scale_base -- see scale_base()) width_frac: float @@ -131,7 +131,7 @@ class TextMarkConfig: template_blur: float = 0.0 # Which image dimension the mark's size and margins scale with. VENDOR-SPECIFIC, # measured, not assumed -- see TextMarkEngine.scale_base. "short" = min(h, w), "width" = w. - scale_basis: Literal["short", "width"] = "width" + scale_basis: Literal["short", "width", "long"] = "width" # Scale rungs ``_ladder_best`` sweeps (the detection comb). PER-MARK: a vendor # whose stamp sizes do not land on the shared 3-rung comb carries its own ladder # (measured for 千问, whose marks sit in two size modes ~1.6x apart -- one fraction @@ -309,7 +309,7 @@ class TextMarkEngine: provenance relaxation it stopped trying because many Jimeng false additions were actually Doubao marks. - Measured separability on hand-labelled examples, scoring BOTH templates + Measured separability on hand-labeled examples, scoring BOTH templates against the same glyph blob: feature separability (0.5 = useless, 1.0 = perfect) @@ -480,10 +480,19 @@ class TextMarkEngine: China's GB 45438-2025 clause 5.2(e) mandates glyph height >= 5% of "the shortest side" for CN marks, which is why a short-side basis is the natural - prior -- but Jimeng's measured behaviour overrides the prior, and measurement + prior -- but Jimeng's measured behavior overrides the prior, and measurement wins over the standard's wording. + + "long" (max of the two sides) is the Microsoft badge's measured basis: the + pill tracks the RENDER dimension, so on a 1024x1536 portrait it scales with + the 1536 (a width basis undersized the template by the aspect ratio and the + portrait carriers fell to 0.15-0.32 NCC; measured 2026-08-27). """ - return min(image.shape[:2]) if self.config.scale_basis == "short" else image.shape[1] + if self.config.scale_basis == "short": + return min(image.shape[:2]) + if self.config.scale_basis == "long": + return max(image.shape[:2]) + return image.shape[1] def locate(self, image: NDArray[Any]) -> TextMarkLocation: """Anchor the watermark box in the configured corner, scaled by ``scale_basis``. @@ -499,14 +508,14 @@ class TextMarkEngine: wm_h = max(16, int(base * c.height_frac)) margin_x = max(c.margin_floor, int(base * c.margin_x_frac)) margin_b = max(c.margin_floor, int(base * c.margin_bottom_frac)) - if c.corner == "br": + if c.corner == "br" or c.corner == "tr": x = max(0, w - margin_x - wm_w) elif c.corner == "bc": # bottom-center: horizontally centered, margin_x unused x = max(0, (w - wm_w) // 2) else: x = min(margin_x, max(0, w - wm_w)) - # "tl" anchors at the top instead: margin_bottom_frac is then the TOP margin. - y = min(margin_b, max(0, h - wm_h)) if c.corner == "tl" else max(0, h - margin_b - wm_h) + # "tl"/"tr" anchor at the top instead: margin_bottom_frac is then the TOP margin. + y = min(margin_b, max(0, h - wm_h)) if c.corner in ("tl", "tr") else max(0, h - margin_b - wm_h) wm_w = min(wm_w, w - x) wm_h = min(wm_h, h - y) return TextMarkLocation(x=x, y=y, w=wm_w, h=wm_h) diff --git a/src/remove_ai_watermarks/api.py b/src/remove_ai_watermarks/api.py index 757907b..7e20f13 100644 --- a/src/remove_ai_watermarks/api.py +++ b/src/remove_ai_watermarks/api.py @@ -73,7 +73,7 @@ def _tc260_vendors(path: Path) -> frozenset[str]: An absent, unreadable or unmapped producer falls back to the historical pair rather than to nothing: the caller has already established that the AIGC signal fired, so - the image IS China-AIGC labelled, and dropping to no relaxation would lose the + the image IS China-AIGC labeled, and dropping to no relaxation would lose the detections the fallback recovers today. The re-read is deliberately isolated -- a failure here must narrow the answer, never discard the rest of the provenance. """ @@ -156,9 +156,10 @@ def remove_visible( ) -> tuple[NDArray[Any], list[str]]: """Remove every detected known visible AI mark through localize then fill. - The registry currently covers the Gemini sparkle; Doubao, Jimeng, Qwen, Kling, - Yuanbao, Samsung, RunningHub, Baidu, and LiblibAI text marks; and the Jimeng - pill. Returns ``(result_bgr, [labels removed])``. + The registry currently covers the Gemini visible watermark; Doubao, Jimeng, + Qwen, Kling AI, Yuanbao, Samsung, RunningHub, Baidu, and LiblibAI text marks; + one Microsoft top-right AI-badge variant; and the Jimeng pill. Returns + ``(result_bgr, [labels removed])``. ``source`` is a file path OR a BGR ndarray. For a PATH, metadata provenance is read automatically (so ``sensitivity="auto"`` recovers a moved/faint mark whenever the @@ -184,7 +185,7 @@ def remove_visible( from remove_ai_watermarks import watermark_registry # Reject a removed sensitivity loudly; `Sensitivity` is a Literal and not enforced - # at runtime, so a 0.15 caller would otherwise get `auto` behaviour in silence. + # at runtime, so a 0.15 caller would otherwise get `auto` behavior in silence. watermark_registry.validate_sensitivity(sensitivity) loaded = _load_visible_input(source) result, removed = watermark_registry.remove_auto_marks( diff --git a/src/remove_ai_watermarks/assets/microsoft_alpha.png b/src/remove_ai_watermarks/assets/microsoft_alpha.png new file mode 100644 index 0000000000000000000000000000000000000000..fc533353b1a29b5254e601784b08d957a47c27f4 GIT binary patch literal 2477 zcmV;e2~zfnP)b))7C!y5kVHr%Xc19XP3dT0Fd&K##U~Vt!i+jqP~rwPF4VXJgG;$!X_YIXoEnV_ zifaUCa2Ny?NC1U^NVF8oFp!`|WXS}GLJTA!$+gb8z1;5C@Ad8XItKK9KW^VXeY$V= z*XNvj?&(yX22x;hYQJS@0cj~J{m|v1pvd&eSiGZ(O#h_CKBU-$1ZazOK(Xlo&5u~I zDFIjNLT*Aurwo`ZpNdX7Fe#%|Z2ExaX`hNtKVV*bDmwjv#phGe=@%>>pNdZZV6pjB zbS458i%&&oVqorkDmoJdbK_IdnK)Sd^`=6?F!@yGnGBedPeo^PV0JzgoykIHP{q$+ z!TD6?nLId$%07cdNXk6rzUBYUK`bi!3>G0d^Hc^Z0pwBHXRuIw28)nNmVyJ5vri13 zQUUb88b{h8LsG0uG9>Tl1ymjiNuvy}bE3JsZ~7O!vmE6o$z0(ky6>B!ZceNH_5Ho| zBcoRa#{gQ2@?UK8c~0Xyv{`6ch9p8AvNkH!x9ujeorq-xe?RE^q(u$1X)N(|7L&10 z?&`iWrZRo|`H#@)X!=ui0%y(Fw=W(O^ZT}4o$T(T8Ds3H#LxfwQvetT09!V7HlLc{ z@MXtqMuz6u<>>?rH2A0eL%M00O&bB=k8u2<`7HprsNhThc*mcWhooyEvH>)681hM% zEpGyVi0x?IGne=4mXdX9c-H5F^!;lGWaSQf!g=eP?iiSxaoUJE+oA^f3uZ2_^L`=r zpXB{f*k2&zOV4VVbl^Nq8zG!uHM<}?=bV{aV?4vV^#Cv)E(3rgZ-5UlU|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J+t@tc{TUB-DeN_fI~#oJTmx%jNXyQ+{kvDjj|@$ zWMe3$TW%Dx;zN@$Jt-vx-9FXdb_NAaa(%>^ae5x5K z2oQ_PK7$44QyFOT;2bLZ3>G?{%0QEa&Y)qRiqPa>@MrqFA~YG8?5X$}EQG>-z*qh~ z!QxJ^Peo{=5SSDFT@jiXMBZ%iQxTd7Y^>SmBSolx*g12|?}|{ra4_b~mlUD?;N&YR z|5SwffhI$rD%VTGg*>-m6b7o00000NkvXXu0mjfn!MGe literal 0 HcmV?d00001 diff --git a/src/remove_ai_watermarks/cli.py b/src/remove_ai_watermarks/cli.py index 55874be..fe4a60d 100644 --- a/src/remove_ai_watermarks/cli.py +++ b/src/remove_ai_watermarks/cli.py @@ -541,7 +541,7 @@ def _should_skip_invisible_scrub(force: bool, image_path: Path) -> bool: @click.option("-v", "--verbose", is_flag=True, help="Enable verbose logging.") @click.pass_context def main(ctx: click.Context, verbose: bool) -> None: - """Remove visible and invisible AI watermarks from images, plus provenance metadata from video.""" + """Remove visible and invisible AI watermarks, plus metadata provenance marks, from images and video.""" from dotenv import load_dotenv load_dotenv() # Load .env (e.g. HF_TOKEN) diff --git a/src/remove_ai_watermarks/dwt_dct.py b/src/remove_ai_watermarks/dwt_dct.py index ba6fe13..f557879 100644 --- a/src/remove_ai_watermarks/dwt_dct.py +++ b/src/remove_ai_watermarks/dwt_dct.py @@ -97,7 +97,7 @@ class _DecodeMaxDct: return decoded def _plane_bits(self, trimmed: NDArray[Any], channel: int, scale: int) -> NDArray[Any]: - """Block bits for one colour plane, a strip of block-rows at a time. + """Block bits for one color plane, a strip of block-rows at a time. ``dwt2`` is ``dwtn``: it transforms along axis 0, then along axis 1 over both halves, and three of the four bands it returns are discarded here. diff --git a/src/remove_ai_watermarks/identify.py b/src/remove_ai_watermarks/identify.py index 442d139..6198f4e 100644 --- a/src/remove_ai_watermarks/identify.py +++ b/src/remove_ai_watermarks/identify.py @@ -1105,7 +1105,7 @@ def _collect_visible_signals( sparkle_conf = _visible_sparkle(image_path, image=image) if sparkle_conf is not None and sparkle_conf >= _SPARKLE_THRESHOLD: signals.append(Signal("visible_sparkle", f"NCC confidence {sparkle_conf:.2f}", "medium")) - watermarks.append(f"Visible Gemini sparkle (confidence {sparkle_conf:.2f})") + watermarks.append(f"Google Gemini visible watermark (sparkle; confidence {sparkle_conf:.2f})") if platform is None: platform = "Google Gemini family (visible sparkle detected)" diff --git a/src/remove_ai_watermarks/invisible_watermark.py b/src/remove_ai_watermarks/invisible_watermark.py index d693f00..3a73eea 100644 --- a/src/remove_ai_watermarks/invisible_watermark.py +++ b/src/remove_ai_watermarks/invisible_watermark.py @@ -99,7 +99,7 @@ def detect_invisible_watermark(image_path: Path, *, image: NDArray[Any] | None = # ``image`` lets a caller that has already decoded these pixels hand them in # (mirrors gemini_engine.detect_sparkle_confidence). The decoder only reads the - # array -- it converts colour spaces into fresh buffers -- so no copy is needed. + # array -- it converts color spaces into fresh buffers -- so no copy is needed. img = image if image is not None else image_io.imread(image_path) if img is None: return None diff --git a/src/remove_ai_watermarks/kling_engine.py b/src/remove_ai_watermarks/kling_engine.py index 757458b..e57c6c5 100644 --- a/src/remove_ai_watermarks/kling_engine.py +++ b/src/remove_ai_watermarks/kling_engine.py @@ -1,6 +1,6 @@ -"""Kling (可灵, Kuaishou) visible watermark detector/localizer. +"""Kling AI (可灵AI, Kuaishou) visible watermark detector/localizer. -Kling stamps its generations with a thin, light-gray "可灵AI 3.0" text strip in the +Kling AI stamps its generations with a thin, light-gray "可灵AI 3.0" text strip in the bottom-right corner, preceded by the vendor's spiral logo (not part of the detection silhouette -- logos vary between releases, the text run is what discriminates). Known variants: an "Omni" suffix release, a latin "KlingAI 3.0" release, and a @@ -9,7 +9,7 @@ suffix variants are only caught when the core run is bold enough (measured below Detection matches the bundled glyph silhouette against the corner; removal is the shared **localize -> fill** (the glyph-bbox :meth:`footprint_mask` feeds -``region_eraser``), NOT reverse-alpha. This module supplies only Kling's tuned +``region_eraser``), NOT reverse-alpha. This module supplies only Kling AI's tuned :class:`TextMarkConfig` (``assets/kling_alpha.png`` -- a font-rendered synthetic silhouette from ``scripts/render_vendor_silhouettes.py``, never cut from an upload). It also feeds ``identify`` as the medium-confidence ``visible_kling`` @@ -26,7 +26,7 @@ producer USCC 91110108335469089C names the entity, 2026-07-21; harness * ``alpha_height_frac`` comes from the silhouette aspect (0.239) at the fitted width, matching the aspect the fit converged on (0.25). * Gate 0.35, one step above the clean arm's max: on the cohort-vs-clean run - (cohort-contamination-guarded, 286 hand-labelled clean frames) the clean arm + (cohort-contamination-guarded, 286 hand-labeled clean frames) the clean arm scored p99 0.304 / max 0.320, and every cohort frame >= 0.35 carries a visible 可灵AI 3.0 mark (9 of ~19 eyeballed visible marks fire = ~47% recall of visible marks; the misses are the faint "Omni"-suffix release, the latin "KlingAI" @@ -38,7 +38,7 @@ producer USCC 91110108335469089C names the entity, 2026-07-21; harness provenance relaxation exists for this mark. * No rival margin: at the shipped gate the template fires on 1 of 400 Doubao-marked frames (0.2%, a 豆包 frame sitting INSIDE the Kling cohort, still - below the gate), 0 of 298 Jimeng-marked frames and 0 of 286 hand-labelled clean + below the gate), 0 of 298 Jimeng-marked frames and 0 of 286 hand-labeled clean frames, and a 0.10 rival margin costs zero genuine Kling detections -- so it is simply unnecessary (same conclusion shape as Qwen). """ @@ -74,7 +74,7 @@ LOGO_MIN_LUMA = 150 TOPHAT_DELTA = 12 DETECT_MIN_COVERAGE = 0.04 # unused by the tophat front-end (kept for config parity) -# Calibrated 2026-07-21 on the vendor cohort vs 286 hand-labelled clean frames +# Calibrated 2026-07-21 on the vendor cohort vs 286 hand-labeled clean frames # (cohort-contamination-guarded): clean p99 0.304 / max 0.320, and every cohort # frame scoring >= 0.35 carries a visible 可灵AI 3.0 mark. 0.35 was picked over # 0.33 (also zero clean fires) for margin against unseen clean content at a cost @@ -87,7 +87,7 @@ _ALPHA_WIDTH_FRAC = 0.12 _ALPHA_HEIGHT_FRAC = 0.0287 _CONFIG = TextMarkConfig( - name="Kling", + name="Kling AI", asset_name="kling_alpha.png", corner="br", margin_floor=4, @@ -114,7 +114,7 @@ _CONFIG = TextMarkConfig( def _alpha_template() -> NDArray[Any] | None: - """The bundled Kling alpha template (float [0,1]), or None.""" + """The bundled Kling AI alpha template (float [0,1]), or None.""" return _text_mark_engine.load_alpha_template(_CONFIG.asset_name) @@ -124,7 +124,7 @@ def _glyph_silhouette() -> NDArray[Any] | None: class KlingEngine(TextMarkEngine): - """Detect/localize the visible Kling "可灵AI 3.0" watermark (locate -> mask; mask feeds the fill).""" + """Detect/localize the visible Kling AI "可灵AI 3.0" watermark (locate -> mask; mask feeds the fill).""" def __init__(self) -> None: super().__init__(_CONFIG) diff --git a/src/remove_ai_watermarks/metadata.py b/src/remove_ai_watermarks/metadata.py index 90379c0..02beb63 100644 --- a/src/remove_ai_watermarks/metadata.py +++ b/src/remove_ai_watermarks/metadata.py @@ -413,7 +413,7 @@ def _scan_head_impl(image_path: Path, size: int) -> bytes: # packet larger than this is not a provenance label. _DECODED_TEXT_LIMIT = 512 * 1024 # Decoder values that are binary payloads with their own readers, not metadata text. -# An ICC profile is colour data and can run to hundreds of kilobytes; appending it +# An ICC profile is color data and can run to hundreds of kilobytes; appending it # would bloat the buffer every later detector re-scans, for no signal. _DECODER_BINARY_KEYS = frozenset({"icc_profile"}) diff --git a/src/remove_ai_watermarks/microsoft_engine.py b/src/remove_ai_watermarks/microsoft_engine.py new file mode 100644 index 0000000..38ef3c4 --- /dev/null +++ b/src/remove_ai_watermarks/microsoft_engine.py @@ -0,0 +1,104 @@ +"""Microsoft top-right AI-badge detector/localizer. + +This engine covers one measured Microsoft output variant: a white pill with dark +internal shapes in the top-right corner. The evaluated files used both "Made with +AI" and "AI-Generated" wording. This is narrower than Microsoft's documented +watermark feature, which can use a Copilot icon or text and can place the mark in +other positions. A Microsoft provenance signal therefore does not establish that +this exact visible variant is present. + +Detection matches a synthetic pill silhouette (white pill with the sparkle and +text KNOCKED OUT) against the top-hat blob of the located box: the holes are what +discriminate this pill from any other bright rounded element in the corner. +Removal is the shared **localize -> fill**; the glyph-bbox :meth:`footprint_mask` +covers the whole pill including its text. + +The tuned numbers below were remeasured on 2026-08-27 with the registered engine +and ``scripts/registered_mark_calibrate.py``. The arms were kept distinct: 17 +visually confirmed carriers, 343 Microsoft-provenance files whose visible-mark +status was not adjudicated, and 1200 non-overlapping no-signal controls: + + * Geometry is single-mode and tight: pill 0.152 x 0.040 of the LONG side + (aspect 3.73-3.89 over 720..1536 px), margins ~0.010/0.007 of the same basis. One size + mode, so the shared 3-rung ladder is untouched and the locate box simply + wraps the pill with NCC slack. + * STRICT ONLY (``provenance_ncc_factor`` 1.0): controls max 0.293 / p99 + 0.200; confirmed carriers p50 0.519 / p90 0.578 / max 0.579, with 15/17 + above the 0.38 gate. Provenance alone does not relax the gate: only 78/343 + files in that cohort crossed it, and the rest were not visually labeled. + * Front-end "binary": the pill is a bold opaque overlay; the tophat blob is + solid with dark-text holes, exactly the template's shape. +""" + +# pyright: reportUnusedFunction=false + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from remove_ai_watermarks import _text_mark_engine +from remove_ai_watermarks._text_mark_engine import TextMarkConfig, TextMarkEngine + +if TYPE_CHECKING: + from numpy.typing import NDArray + +# Locate geometry as a fraction of the image LONG side (measured; scale_basis="long": +# on 1024x1536 portraits the pill tracks the 1536, and a width basis undersized +# the template until the portrait carriers fell to 0.15-0.32 NCC). +# The box wraps the measured pill rect (0.152W x 0.040W) with NCC slack; margins +# sit inside the pill's own ~0.010W-right / ~0.007W-top insets. +WM_WIDTH_FRAC = 0.170 +WM_HEIGHT_FRAC = 0.055 +MARGIN_RIGHT_FRAC = 0.004 +MARGIN_TOP_FRAC = 0.003 + +# Glyph appearance: a bright near-white pill (luma ~245), gray-scale (sat < 60). +MAX_SATURATION = 60 +LOGO_MIN_LUMA = 170 +TOPHAT_DELTA = 10 + +# Calibrated 2026-08-27: non-overlapping no-signal controls (n=1200) max 0.293 / +# p99 0.200; visually confirmed carriers (n=17) p50 0.519 / p90 0.578 / max +# 0.579, with 15/17 above the 0.38 gate. The two misses score 0.249 and 0.315. +DETECT_MIN_COVERAGE = 0.30 # the pill fills most of its box; content corners do not +DETECT_NCC_THRESHOLD = 0.38 + +# Pill silhouette geometry (fraction of width): 0.152W x 0.040W, aspect ~3.78. +_ALPHA_NATIVE_WIDTH = 335 +_ALPHA_WIDTH_FRAC = 0.152 +_ALPHA_HEIGHT_FRAC = 0.040 + +_CONFIG = TextMarkConfig( + name="Microsoft top-right AI badge", + asset_name="microsoft_alpha.png", + corner="tr", + margin_floor=2, + width_frac=WM_WIDTH_FRAC, + height_frac=WM_HEIGHT_FRAC, + margin_x_frac=MARGIN_RIGHT_FRAC, + margin_bottom_frac=MARGIN_TOP_FRAC, + max_saturation=MAX_SATURATION, + logo_min_luma=LOGO_MIN_LUMA, + tophat_delta=TOPHAT_DELTA, + morph_open_size=5, + detect_min_coverage=DETECT_MIN_COVERAGE, + detect_ncc_threshold=DETECT_NCC_THRESHOLD, + alpha_width_frac=_ALPHA_WIDTH_FRAC, + alpha_height_frac=_ALPHA_HEIGHT_FRAC, + min_gw=24, + detect_frontend="binary", + scale_basis="long", + provenance_ncc_factor=1.0, +) + + +def _alpha_template() -> NDArray[Any] | None: + """The bundled Microsoft pill template (float [0,1]), or None.""" + return _text_mark_engine.load_alpha_template(_CONFIG.asset_name) + + +class MicrosoftEngine(TextMarkEngine): + """Detect/localize the measured Microsoft top-right AI badge.""" + + def __init__(self) -> None: + super().__init__(_CONFIG) diff --git a/src/remove_ai_watermarks/pill_engine.py b/src/remove_ai_watermarks/pill_engine.py index 5125a45..a6fd6bb 100644 --- a/src/remove_ai_watermarks/pill_engine.py +++ b/src/remove_ai_watermarks/pill_engine.py @@ -64,7 +64,7 @@ _MASK_W, _MASK_H = 0.205, 0.115 # width of W, height of W # # Measured through the PRODUCT path (the `_keep_pill` gate), not the raw detector, by # ``scripts/pill_gate_audit.py`` -- the raw path bypasses the gate and reads as a -# disaster that the shipped behaviour does not have. Re-run it when the gate changes. +# disaster that the shipped behavior does not have. Re-run it when the gate changes. _FLAT_TEXTURE_MAX = 6.0 _silhouette: NDArray[Any] | None = None diff --git a/src/remove_ai_watermarks/qwen_engine.py b/src/remove_ai_watermarks/qwen_engine.py index 641f460..1847cc1 100644 --- a/src/remove_ai_watermarks/qwen_engine.py +++ b/src/remove_ai_watermarks/qwen_engine.py @@ -23,7 +23,7 @@ whose producer USCC 91440101MA9Y9T4H7A names the entity, 2026-07-21; harness ratio 1.64 -- wider than the shared 3-rung ladder's 1.5625 span), so a single fraction on the shared ladder covers ~75% of marks and the rest land in the comb's collapse zone. Qwen therefore carries its OWN 2-rung ladder - (``TextMarkConfig.ladder``), one rung centred on each mode; the shared + (``TextMarkConfig.ladder``), one rung centered on each mode; the shared default is untouched for every other mark. * The mark also sits FARTHER off the corner than Doubao's box assumes (right margin ~0.025 vs 0.004 of the short side), so Doubao's locate box clipped the @@ -38,7 +38,7 @@ whose producer USCC 91440101MA9Y9T4H7A names the entity, 2026-07-21; harness arm would be mostly false fills. No provenance relaxation exists for this mark. * No rival margin: at the shipped gate the template fires on 0 of 400 - Doubao-marked frames, 0 of 298 Jimeng-marked frames and 0 of 286 hand-labelled + Doubao-marked frames, 0 of 298 Jimeng-marked frames and 0 of 286 hand-labeled clean frames (the shared tail correlates at ~0.22, far below the gate), while a 0.10 rival margin would have suppressed ~10% of genuine Qwen detections. """ @@ -74,7 +74,7 @@ LOGO_MIN_LUMA = 150 TOPHAT_DELTA = 12 DETECT_MIN_COVERAGE = 0.04 # unused by the tophat front-end (kept for config parity) -# Calibrated 2026-07-21 on the vendor cohort vs 286 hand-labelled clean frames +# Calibrated 2026-07-21 on the vendor cohort vs 286 hand-labeled clean frames # (cohort-contamination-guarded): clean p99 0.301 / max 0.316, and every cohort # frame scoring >= 0.45 carries a visible 千问AI生成 mark (86% of the eyeballed # visible marks fire, the misses being white-on-near-white contrast losses). diff --git a/src/remove_ai_watermarks/runninghub_engine.py b/src/remove_ai_watermarks/runninghub_engine.py index 103232a..f93f793 100644 --- a/src/remove_ai_watermarks/runninghub_engine.py +++ b/src/remove_ai_watermarks/runninghub_engine.py @@ -32,7 +32,7 @@ whose producer USCC names the entity, harvested 2026-07-22 by * STRICT ONLY (``provenance_ncc_factor`` 1.0): raw gray NCC is contrast-DEPENDENT and the sub-gate band of a corner-anchored gray match is unmeasured beyond the clean arm, so no provenance relaxation exists. - * Gate 0.34: on 283 hand-labelled clean frames (cohort-contamination-guarded) + * Gate 0.34: on 283 hand-labeled clean frames (cohort-contamination-guarded) corner-anchored gray NCC p99 is 0.264 / max 0.304, while the 4 positives score 0.38-0.54. 0.34 sits above the clean max with a small margin; the positives are few, so the margin is deliberately thin on the recall side. @@ -75,14 +75,14 @@ LOGO_MIN_LUMA = 150 TOPHAT_DELTA = 12 DETECT_MIN_COVERAGE = 0.04 # unused by the gray front-end (kept for config parity) -# Calibrated 2026-07-22 on the vendor cohort vs 283 hand-labelled clean frames: +# Calibrated 2026-07-22 on the vendor cohort vs 283 hand-labeled clean frames: # corner-anchored gray NCC, clean p99 0.264 / max 0.304; positives 0.38-0.54. DETECT_NCC_THRESHOLD = 0.34 # Detection-silhouette geometry (fraction of the image width), measured on the # positives: mark width is ~0.320 of width on all three frame sizes (266px at 832, # 345px at 1080, 491px at 1536), and the NCC is razor-sharp in size (0.537 on-size, -# 0.223 at +5.6% -- the same comb behaviour Qwen measured), so the nominal sits +# 0.223 at +5.6% -- the same comb behavior Qwen measured), so the nominal sits # exactly on the measured size with a TIGHT ladder around it, not the shared 3 rungs # (whose nearest rung landed 5.6% off and collapsed the match to 0.22). _ALPHA_WIDTH_FRAC = 0.32 diff --git a/src/remove_ai_watermarks/video.py b/src/remove_ai_watermarks/video.py index c4716f0..aac4900 100644 --- a/src/remove_ai_watermarks/video.py +++ b/src/remove_ai_watermarks/video.py @@ -1,8 +1,8 @@ """High-level video processing API. The product path covers provenance identification, container-level AI metadata -removal, temporally stabilized visible Sora, Veo, Seedance, Dola, Hailuo, and -Kling removal, and an oracle-certified opt-in VAE profile for video SynthID. +removal, temporally stabilized visible Sora, Veo, Seedance, Dola, Hailuo AI, and +Kling AI removal, and an oracle-certified opt-in VAE profile for video SynthID. The visible pixel path reuses the image package's shared fill backends. """ diff --git a/src/remove_ai_watermarks/video_visible.py b/src/remove_ai_watermarks/video_visible.py index 01947ed..0ce442b 100644 --- a/src/remove_ai_watermarks/video_visible.py +++ b/src/remove_ai_watermarks/video_visible.py @@ -4,8 +4,8 @@ Supported marks use fully synthetic silhouettes made from geometric primitives, OpenCV's built-in font, and Pillow's bundled font. Sora detection searches the full frame because the wordmark moves. Veo detection covers both the current four-point diamond and legacy ``Veo`` text. Seedance detects the boxed ``AI`` -label, Dola detects its compact text label, Hailuo detects the composite -MINIMAX/Hailuo label, and Kling detects its version-independent wordmark core. +label, Dola detects its compact text label, Hailuo AI detects the composite +MINIMAX/Hailuo AI label, and Kling AI detects its version-independent wordmark core. A single frame is never enough to authorize removal: the temporal arbiter requires the candidate to recur at the same location across adjacent frames. This keeps isolated lookalikes in clean videos from becoming removal masks. diff --git a/src/remove_ai_watermarks/watermark_registry.py b/src/remove_ai_watermarks/watermark_registry.py index 086209e..669b509 100644 --- a/src/remove_ai_watermarks/watermark_registry.py +++ b/src/remove_ai_watermarks/watermark_registry.py @@ -20,7 +20,7 @@ Entries: - ``gemini`` -- Google Gemini / Nano Banana visible watermark (sparkle), bottom-right. - ``doubao`` -- ByteDance Doubao "豆包AI生成" text strip, bottom-right. - ``jimeng`` -- ByteDance Jimeng / Dreamina "★ 即梦AI" wordmark, bottom-right. - - ``qwen`` -- Alibaba Qwen "千问AI生成" text strip, bottom-right. + - ``qwen`` -- Alibaba Cloud Qwen "千问AI生成" text strip, bottom-right. - ``kling`` -- Kuaishou Kling AI "可灵AI 3.0" text strip, bottom-right. - ``yuanbao`` -- Tencent Yuanbao "元宝 / AI生成" two-line mark, bottom-right. - ``samsung`` -- Samsung Galaxy AI "Contenuti generati dall'AI" strip, bottom-left. @@ -28,6 +28,7 @@ Entries: - ``runninghub`` -- RunningHub "RunningHub AI生成" text, top-left (gray front-end). - ``baidu`` -- Baidu "百度 AI生成" text + white tag, bottom-right. - ``liblib`` -- LiblibAI "LiblibAI" wordmark, bottom-center. + - ``microsoft`` -- one measured Microsoft white AI-badge variant, top-right. """ from __future__ import annotations @@ -147,7 +148,7 @@ _REMOVED_SENSITIVITIES = { "vendor made it or where the mark is. If you can see a mark the detector missed, " "act on what you see: erase(image, region=(x, y, w, h)), or the CLI " "`--mark --no-detect` for a known text mark. Use sensitivity='auto' for " - "the default evidence-driven behaviour." + "the default evidence-driven behavior." ) } @@ -156,7 +157,7 @@ def validate_sensitivity(value: str) -> Sensitivity: """Reject a removed sensitivity LOUDLY instead of silently falling back to ``auto``. ``Sensitivity`` is a ``Literal``, which is not enforced at runtime, so a caller - upgrading from 0.15 would pass ``"assume_ai"`` and quietly get ``auto`` behaviour -- + upgrading from 0.15 would pass ``"assume_ai"`` and quietly get ``auto`` behavior -- a silent semantic change on the one release where they most need to be told. """ if value in _REMOVED_SENSITIVITIES: @@ -368,7 +369,7 @@ _GEMINI_AUTO_MIN_CONF = GEMINI_SPARKLE_TRUST_CONF # that never had a mark rather than on moved ones. # # Measured blind on 954 unique Google-metadata uploads (detector never saw the -# metadata), hand-labelled against a two-sided control (labeller sensitivity ~88%, +# metadata), hand-labeled against a two-sided control (labeler sensitivity ~88%, # specificity 100%). "Additions" = accepted with provenance but not without: # # band precision 95% CI population @@ -409,6 +410,7 @@ _ENGINE_CLASS: dict[str, tuple[str, str]] = { "runninghub": ("runninghub_engine", "RunningHubEngine"), "baidu": ("baidu_engine", "BaiduEngine"), "liblib": ("liblib_engine", "LibLibEngine"), + "microsoft": ("microsoft_engine", "MicrosoftEngine"), } @@ -485,7 +487,14 @@ def fill(image: NDArray[Any], mask: NDArray[Any], *, backend: Backend = "auto") def _gemini_wrap(d: Any, *, provenance: bool) -> MarkDetection: gate = _GEMINI_PROVENANCE_MIN_CONF if provenance else _GEMINI_AUTO_MIN_CONF detected = bool(d.detected) and d.confidence >= gate - return MarkDetection("gemini", "Google Gemini sparkle", "bottom-right", detected, d.confidence, d.region) + return MarkDetection( + "gemini", + "Google Gemini visible watermark (sparkle)", + "bottom-right", + detected, + d.confidence, + d.region, + ) def _gemini_detect(image: NDArray[Any], *, provenance: bool = False) -> MarkDetection: @@ -561,12 +570,14 @@ def _text_mark( label_regime: str | None = "tc260", provenance_signals: tuple[str, ...] = ("aigc",), tc260_producer_codes: tuple[str, ...] = (), + provenance_platform_tokens: tuple[str, ...] = (), ) -> KnownMark: """Build a text-mark registry row from its shared detector and mask adapters. ``product`` defaults to the key (one mark, one product); pass it only when two marks share a product. ``label_regime`` and ``provenance_signals`` default to the - China-AIGC label because every text mark registered so far except Samsung uses it. + China-AIGC label because every text mark registered so far except Samsung and + Microsoft uses it. """ return KnownMark( key, @@ -580,6 +591,7 @@ def _text_mark( _text_mark_mask(key), provenance_signals=provenance_signals, tc260_producer_codes=tc260_producer_codes, + provenance_platform_tokens=provenance_platform_tokens, _detect_both=_text_mark_detect_both(key, label, location), ) @@ -616,7 +628,7 @@ def _pill_features(image: NDArray[Any]) -> dict[str, float]: _REGISTRY: tuple[KnownMark, ...] = ( - # Gemini is a Google C2PA/SynthID product, not a China-AIGC labeller: label_regime + # Gemini is a Google C2PA/SynthID product, not a China-AIGC labeler: label_regime # is None so it can never act as a TC260 sibling in _keep_pill. KnownMark( "gemini", @@ -651,7 +663,7 @@ _REGISTRY: tuple[KnownMark, ...] = ( "qwen", "Qwen 千问AI生成 text", "bottom-right", - platform="Alibaba Qwen (visible 千问AI生成 mark detected)", + platform="Alibaba Cloud Qwen (visible 千问AI生成 mark detected)", tc260_producer_codes=("91440101MA9Y9T4H7A",), ), _text_mark( @@ -698,6 +710,18 @@ _REGISTRY: tuple[KnownMark, ...] = ( platform="LiblibAI (visible LiblibAI mark detected)", tc260_producer_codes=("91110105MACJ6K1C8A",), ), + # One measured Microsoft visible-mark variant: a white top-right pill with + # dark internal shapes. Microsoft's documented feature also permits other + # icon, text, and placement variants, which this detector does not cover. + _text_mark( + "microsoft", + "Microsoft top-right AI badge", + "top-right", + label_regime=None, + provenance_signals=(), + platform="Microsoft (visible top-right AI badge detected)", + provenance_platform_tokens=("microsoft",), + ), # Same product as the Jimeng wordmark -- the one pair that cross-relaxes. KnownMark( "jimeng_pill", diff --git a/tests/test_cli.py b/tests/test_cli.py index dcd2b92..eca229f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -228,8 +228,8 @@ class TestVisibleCommand: # The transparent corners must remain transparent. assert out[0, 0, 3] == 0 assert out[199, 199, 3] == 0 - # The opaque centre remains opaque (the watermark region default is bottom-right, - # which doesn't overlap the centre square at 200x200). + # The opaque center remains opaque (the watermark region default is bottom-right, + # which doesn't overlap the center square at 200x200). assert out[100, 100, 3] == 255 def test_visible_keeps_alpha_opaque_in_watermark_region(self, runner, tmp_path): diff --git a/tests/test_identify.py b/tests/test_identify.py index 8f01b39..4b1d002 100644 --- a/tests/test_identify.py +++ b/tests/test_identify.py @@ -17,7 +17,11 @@ from unittest.mock import patch import pytest from remove_ai_watermarks._internal.c2pa import c2pa_info_from_manifest_store -from remove_ai_watermarks._internal.constants import C2PA_AI_VENDORS, C2PA_CLAIM_GENERATOR_PLATFORMS +from remove_ai_watermarks._internal.constants import ( + C2PA_AI_VENDORS, + C2PA_CLAIM_GENERATOR_PLATFORMS, + C2PA_IDENTITY_AI_ORGS, +) from remove_ai_watermarks.identify import ( ProvenanceEvidence, ProvenanceReport, @@ -179,7 +183,7 @@ class TestProvenanceEvidence: assert report.is_ai_generated is True assert report.confidence == "high" - assert report.platform == "OpenAI (ChatGPT / gpt-image / DALL-E / Sora)" + assert report.platform == "OpenAI (ChatGPT / GPT Image / DALL·E / Sora)" assert not any("not anchored" in caveat for caveat in report.caveats) def test_external_metadata_record_builds_equivalent_evidence(self, tmp_path: Path): @@ -244,7 +248,7 @@ class TestProvenanceEvidence: report = identify_from_evidence(evidence_from_metadata_record(record, path=path)) assert report.is_ai_generated is True - assert report.platform == "OpenAI (ChatGPT / gpt-image / DALL-E / Sora)" + assert report.platform == "OpenAI (ChatGPT / GPT Image / DALL·E / Sora)" assert [signal.name for signal in report.signals] == ["c2pa"] def test_external_generator_bytes_are_normalized(self, tmp_path: Path): @@ -374,13 +378,12 @@ class TestAttributePlatform: assert platform assert "Canva" in platform - def test_byteplus_attributes_to_bytedance(self): + def test_byteplus_keeps_its_product_name(self): # ByteDance's intl brand signs as "Byteplus Pte. Ltd."; the registry maps - # it to the ByteDance platform (was mis-read as Adobe via an incidental + # it to the ByteDance family (was mis-read as Adobe via an incidental # "Adobe XMP" file string before the entry existed). platform = _attribute_platform(["BytePlus (ByteDance)"]) - assert platform - assert "ByteDance" in platform + assert platform == "BytePlus (ByteDance)" def test_empty_is_none(self): assert _attribute_platform([]) is None @@ -444,7 +447,7 @@ class TestIdentifyNonPng: path = self._c2pa_jpeg(tmp_path, b"certificate_center@volcengine.com ... trainedAlgorithmicMedia") r = identify(path, check_visible=False, check_invisible=False) assert r.is_ai_generated is True - assert "ByteDance" in (r.platform or "") + assert r.platform == "ByteDance Volcano Engine" def test_bytedance_chinese_legal_name_attributed(self, tmp_path: Path): # Some Volcano Engine certs name the signer with the Chinese legal entity @@ -454,7 +457,7 @@ class TestIdentifyNonPng: path = self._c2pa_jpeg(tmp_path, blob) r = identify(path, check_visible=False, check_invisible=False) assert r.is_ai_generated is True - assert "ByteDance" in (r.platform or "") + assert r.platform == "ByteDance Volcano Engine" @pytest.mark.parametrize( ("claim_generator", "platform"), @@ -498,7 +501,7 @@ class TestIdentifyNonPng: path = self._c2pa_jpeg(tmp_path, b"Bytedance Pte. Ltd. Dreamina/7.5.0 c2pa.created") r = identify(path, check_visible=False, check_invisible=False) assert r.is_ai_generated is True - assert "ByteDance" in (r.platform or "") + assert r.platform == "ByteDance Dreamina" def test_elevenlabs_attributed(self, tmp_path: Path): path = self._c2pa_jpeg(tmp_path, b"Eleven Labs Inc. ... trainedAlgorithmicMedia") @@ -895,7 +898,7 @@ class TestIdentifyAigcPngChunk: assert "doubao" in signal.detail -# ── HuggingFace-hosted job marker (medium confidence) ─────────────── +# ── Hugging Face-hosted job marker (medium confidence) ───────────── class TestIdentifyHuggingFaceJob: @@ -917,7 +920,7 @@ class TestIdentifyHuggingFaceJob: assert r.is_ai_generated is True assert r.confidence == "medium" assert r.platform is not None - assert "HuggingFace" in r.platform + assert "Hugging Face" in r.platform signal = next(s for s in r.signals if s.name == "hf_job") assert signal.confidence == "medium" @@ -1221,7 +1224,7 @@ class TestSynthIDProvenanceEvidence: png = self._png(tmp_path, "dreamina.png", self._png_chunk(b"caBX", b"jumbc2pa Dreamina/7.5.0 c2pa.created")) r = identify(png, check_visible=False, check_invisible=False) assert r.is_ai_generated is True - assert "ByteDance" in (r.platform or "") + assert r.platform == "ByteDance Dreamina" class TestReportSerializable: @@ -1452,7 +1455,7 @@ class TestIdentifyAIGC: class TestVendorOf: def test_openai_variants(self): - assert _vendor_of("OpenAI (ChatGPT / gpt-image / DALL-E / Sora)") == "OpenAI" + assert _vendor_of("OpenAI (ChatGPT / GPT Image / DALL·E / Sora)") == "OpenAI" assert _vendor_of("DALL-E 3") == "OpenAI" def test_google_variants(self): @@ -1478,17 +1481,32 @@ class TestVendorOf: # entered clash detection (a coverage hole). They now normalize to one origin. assert _vendor_of("Microsoft (Copilot / Designer)") == "Microsoft" assert _vendor_of("Copilot") == "Microsoft" - assert _vendor_of("ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)") == "ByteDance" + assert _vendor_of("ByteDance Volcano Engine") == "ByteDance" + assert _vendor_of("BytePlus (ByteDance)") == "ByteDance" assert _vendor_of("Dreamina/1.2") == "ByteDance" assert _vendor_of("Canva (Magic Media)") == "Canva" assert _vendor_of("Black Forest Labs (FLUX)") == "Black Forest Labs" assert _vendor_of("Eleven Labs Inc.") == "ElevenLabs" + assert _vendor_of("Ideogram") == "Ideogram" - def test_bytedance_issuers_share_one_platform(self): - expected = "ByteDance (Doubao / Jimeng / Dreamina / Volcano Engine)" - platforms = {vendor.platform for vendor in C2PA_AI_VENDORS if vendor.needle == "ByteDance"} - assert platforms == {expected} - assert ("dreamina", expected) in C2PA_CLAIM_GENERATOR_PLATFORMS + def test_ideogram_issuer_attributed(self): + # Corpus evidence 2026-08-08: four uploads signed "Ideogram, Inc" read as + # unknown-signer C2PA with no platform. The issuer token is the org prefix. + platforms = {v.issuer: v.platform for v in C2PA_AI_VENDORS} + assert platforms[b"Ideogram"] == "Ideogram" + assert "Ideogram" in C2PA_IDENTITY_AI_ORGS + assert _issuers_in(b"...CN=Ideogram, Inc...trainedAlgorithmicMedia") == ["Ideogram"] + + def test_bytedance_issuers_keep_the_source_product(self): + platforms = { + vendor.issuer: vendor.platform + for vendor in C2PA_AI_VENDORS + if vendor.org.startswith("ByteDance") or vendor.org.startswith("BytePlus") + } + assert platforms[b"volcengine"] == "ByteDance Volcano Engine" + assert platforms[b"Byteplus"] == "BytePlus (ByteDance)" + assert platforms[b"Dreamina"] == "ByteDance Dreamina" + assert ("dreamina", "ByteDance Dreamina") in C2PA_CLAIM_GENERATOR_PLATFORMS class TestIntegrityClashesHelper: diff --git a/tests/test_invisible_engine.py b/tests/test_invisible_engine.py index c14dfe6..e98ead6 100644 --- a/tests/test_invisible_engine.py +++ b/tests/test_invisible_engine.py @@ -245,7 +245,7 @@ class TestEngineResolvesThePolishPerProfile: This is the change that stopped a library caller and a CLI caller on one profile from producing different pixels, and it had no test: rebinding - ``resolve_adaptive_polish`` to ``bool(value)`` -- exactly the pre-commit behaviour -- + ``resolve_adaptive_polish`` to ``bool(value)`` -- exactly the pre-commit behavior -- left the whole suite green. """ diff --git a/tests/test_kling_engine.py b/tests/test_kling_engine.py index 65566ce..c98d8f4 100644 --- a/tests/test_kling_engine.py +++ b/tests/test_kling_engine.py @@ -72,7 +72,7 @@ class TestConfig: assert KlingEngine().config.provenance_ncc_factor == 1.0 def test_gate_above_clean_arm_max(self): - # Clean arm scored p99 0.304 / max 0.320 on 286 hand-labelled frames; the + # Clean arm scored p99 0.304 / max 0.320 on 286 hand-labeled frames; the # gate must sit above that with margin. assert KlingEngine().config.detect_ncc_threshold > 0.32 diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 9f1093a..54830bd 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -1562,7 +1562,7 @@ class TestAIGCLabel: class TestHuggingFaceJob: - """HuggingFace-hosted job marker (``hf-job-id`` PNG text chunk).""" + """Hugging Face-hosted job marker (``hf-job-id`` PNG text chunk).""" def _hf_png(self, tmp_path: Path, job_id: str = "ec8380a6-2091-423a-b835-209420f99ee1") -> Path: p = tmp_path / "hfjob.png" @@ -1622,10 +1622,13 @@ class TestSoftBinding: from remove_ai_watermarks._internal.c2pa import soft_binding_vendors_in assert soft_binding_vendors_in(b"...alg...com.adobe.trustmark.P...") == ["Adobe TrustMark"] - assert soft_binding_vendors_in(b"com.digimarc.validate.1") == ["Digimarc"] + assert soft_binding_vendors_in(b"com.digimarc.validate.1") == ["Digimarc Validate"] assert soft_binding_vendors_in(b"ai.steg.api blah") == ["Steg.AI"] # Registry-verified vendors added in v0.6.x. - assert soft_binding_vendors_in(b"ai.trufo.gen1.image") == ["Trufo"] + assert soft_binding_vendors_in(b"ai.trufo.pawprint.watermark") == ["Trufo PawPrint"] + assert soft_binding_vendors_in(b"com.aiwatermark.pixelseal.1") == ["AIWatermark PixelSeal"] + assert soft_binding_vendors_in(b"com.aiwatermark.videoseal.1") == ["AIWatermark VideoSeal"] + assert soft_binding_vendors_in(b"com.aiwatermark.audioseal.1") == ["AIWatermark AudioSeal"] assert soft_binding_vendors_in(b"io.iscc.v0") == ["ISCC (content code)"] def test_vendors_in_empty_when_absent(self): diff --git a/tests/test_metadata_internals.py b/tests/test_metadata_internals.py index e3f6acc..752053c 100644 --- a/tests/test_metadata_internals.py +++ b/tests/test_metadata_internals.py @@ -266,8 +266,8 @@ class TestC2PA: def test_content_fingerprint_does_not_trigger_invisible_removal(self): info = { - "soft_binding": "Adobe (content fingerprint)", - "soft_binding_vendors": ["Adobe (content fingerprint)"], + "soft_binding": "Adobe Image Comparator Network", + "soft_binding_vendors": ["Adobe Image Comparator Network"], } assert c2pa_info_has_removal_hint(info) is False @@ -1007,7 +1007,7 @@ class TestTc260ContainerRouting: def _riff_chunk(chunk_id: bytes, payload: bytes) -> bytes: return chunk_id + len(payload).to_bytes(4, "little") + payload + (b"\x00" if len(payload) & 1 else b"") - def _labelled_avi(self) -> bytes: + def _labeled_avi(self) -> bytes: info = self._riff_chunk(b"AIGC", _TC260_AIGC_VALUE) body = b"AVI " + self._riff_chunk(b"LIST", b"INFO" + info) return b"RIFF" + len(body).to_bytes(4, "little") + body @@ -1016,7 +1016,7 @@ class TestTc260ContainerRouting: from remove_ai_watermarks.metadata import aigc_label target = tmp_path / "clip.bin" # correct AVI bytes, wrong suffix - target.write_bytes(self._labelled_avi()) + target.write_bytes(self._labeled_avi()) label = aigc_label(target) assert label is not None assert label["Label"] == "1" @@ -1025,7 +1025,7 @@ class TestTc260ContainerRouting: from remove_ai_watermarks.metadata import aigc_label target = tmp_path / "clip.avi" - target.write_bytes(self._labelled_avi()) + target.write_bytes(self._labeled_avi()) assert aigc_label(target) is not None def test_webp_yields_nothing_from_the_riff_reader(self, tmp_path: Path): diff --git a/tests/test_microsoft_engine.py b/tests/test_microsoft_engine.py new file mode 100644 index 0000000..f9437f4 --- /dev/null +++ b/tests/test_microsoft_engine.py @@ -0,0 +1,163 @@ +"""Tests for the measured Microsoft top-right AI-badge engine. + +The covered variant is a white top-right pill with dark internal shapes. The +2026-08-27 calibration kept visually confirmed carriers, provenance-only files, +and no-signal controls separate. These tests pin the load-bearing constants -- +especially the long-side scale basis and the internal holes as the discriminator. +""" + +from __future__ import annotations + +import cv2 +import numpy as np +import pytest + +from remove_ai_watermarks import watermark_registry as registry +from remove_ai_watermarks.microsoft_engine import ( + _ALPHA_HEIGHT_FRAC, + _ALPHA_WIDTH_FRAC, + MicrosoftEngine, + _alpha_template, +) + +_INSET = 0.010 # measured pill inset from the top/right edges (long-side fraction) + + +def _pill_geometry(w: int, h: int) -> tuple[int, int, int, int]: + long_side = max(w, h) + pw = int(_ALPHA_WIDTH_FRAC * long_side) + ph = max(4, int(_ALPHA_HEIGHT_FRAC * long_side)) + pad = int(_INSET * long_side) + return w - pad - pw, pad, pw, ph + + +def _compose(w: int, h: int, bg: float = 110.0): + """Composite the synthetic pill at its measured size onto a flat background.""" + img = np.full((h, w, 3), bg, np.uint8) + at = _alpha_template() + x0, y0, pw, ph = _pill_geometry(w, h) + pill = cv2.resize(at, (pw, ph)) + region = img[y0 : y0 + ph, x0 : x0 + pw] + bright = pill > 0.6 + region[bright] = 245 + # Internal holes are dark ink inside the pill, not background. + region[~bright] = 45 + return img, (x0, y0, pw, ph) + + +def _plain_pill(w: int, h: int, text: str | None = None) -> np.ndarray: + """Return a white rounded pill without the expected holes, or with foreign text.""" + img = np.full((h, w, 3), 110.0, np.uint8) + x0, y0, pw, ph = _pill_geometry(w, h) + cv2.rectangle(img, (x0, y0), (x0 + pw, y0 + ph), (245, 245, 245), -1) + cv2.circle(img, (x0 + ph // 2, y0 + ph // 2), ph // 3, (110, 110, 110), -1) + if text: + cv2.putText(img, text, (x0 + ph, y0 + ph // 2 + ph // 6), cv2.FONT_HERSHEY_SIMPLEX, ph / 90.0, (45, 45, 45), 1) + return img + + +class TestLocate: + def test_box_anchored_top_right(self): + eng = MicrosoftEngine() + loc = eng.locate(np.zeros((1024, 1024, 3), np.uint8)) + assert loc.x + loc.w == pytest.approx(1024 - int(0.004 * 1024), abs=2) + assert loc.y == pytest.approx(int(0.003 * 1024), abs=2) + + def test_box_scales_with_long_side_not_width(self): + # Measured: the pill tracks the render dimension, so a 1024x1536 portrait + # carries the SAME pill size as 1536x1024. A width basis undersized the + # template by the aspect ratio and dropped every portrait carrier. + eng = MicrosoftEngine() + portrait = eng.locate(np.zeros((1536, 1024, 3), np.uint8)) + landscape = eng.locate(np.zeros((1024, 1536, 3), np.uint8)) + assert portrait.w == landscape.w + small = eng.locate(np.zeros((720, 480, 3), np.uint8)) + assert small.w < portrait.w + + +class TestConfig: + def test_strict_only_no_provenance_relaxation(self): + # Provenance names Microsoft, not the presence of this visible layout. + assert MicrosoftEngine().config.provenance_ncc_factor == 1.0 + + def test_long_scale_basis(self): + assert MicrosoftEngine().config.scale_basis == "long" + + def test_threshold_and_geometry_pins(self): + from remove_ai_watermarks.microsoft_engine import ( + DETECT_NCC_THRESHOLD, + MARGIN_RIGHT_FRAC, + WM_WIDTH_FRAC, + ) + + assert pytest.approx(0.38) == DETECT_NCC_THRESHOLD # controls max 0.293; carriers max 0.579 + assert pytest.approx(0.170) == WM_WIDTH_FRAC + assert pytest.approx(0.004) == MARGIN_RIGHT_FRAC + + def test_registry_row(self): + mark = registry.get_mark("microsoft") + assert mark.location == "top-right" + assert mark.label == "Microsoft top-right AI badge" + assert mark.in_auto + assert mark.provenance_platform_tokens == ("microsoft",) + assert mark.label_regime is None # not a China-TC260 mark + + +class TestDetect: + @pytest.mark.parametrize(("w", "h"), [(1024, 1024), (1536, 1024), (1024, 1536), (720, 480), (1206, 1194)]) + def test_composites_detected_across_sizes(self, w, h): + eng = MicrosoftEngine() + img, _box = _compose(w, h) + det = eng.detect(img) + assert det.detected, f"{w}x{h}: conf={det.confidence:.3f}" + assert det.confidence >= 0.38 + + def test_portrait_composite_region_covers_pill(self): + eng = MicrosoftEngine() + img, (x, y, pw, ph) = _compose(1024, 1536) + det = eng.detect(img) + assert det.detected + rx, ry, rw, _rh = det.region + assert abs((rx + rw) - (x + pw)) < 0.08 * pw + assert abs(ry - y) < 0.4 * ph + + def test_clean_gradient_not_detected(self): + eng = MicrosoftEngine() + ramp = np.tile(np.linspace(0, 255, 1024, dtype=np.uint8), (1024, 1)) + img = cv2.cvtColor(ramp, cv2.COLOR_GRAY2BGR) + assert not eng.detect(img).detected + + def test_plain_white_pill_not_detected(self): + # The expected internal holes are the discriminator: any other bright rounded + # element in the corner must not attribute Microsoft. + eng = MicrosoftEngine() + assert not eng.detect(_plain_pill(1024, 1024)).detected + + def test_foreign_text_pill_not_detected(self): + eng = MicrosoftEngine() + assert not eng.detect(_plain_pill(1024, 1024, text="Sample Text")).detected + + def test_busy_content_corner_not_detected(self): + # A photo-like textured corner must stay under the gate. + eng = MicrosoftEngine() + rng = np.random.default_rng(7) + img = rng.integers(0, 255, (1024, 1024, 3), dtype=np.uint8) + img = cv2.GaussianBlur(img, (0, 0), 3) + assert not eng.detect(img).detected + + +class TestMask: + def test_footprint_covers_the_pill(self): + eng = MicrosoftEngine() + img, (x, y, pw, ph) = _compose(1536, 1024) + det = eng.detect(img) + assert det.detected + mask = eng.footprint_mask(img, detection=det) + assert mask.shape[:2] == img.shape[:2] + ys, xs = np.where(mask > 0) + assert xs.min() >= x - 0.15 * pw + assert xs.max() <= x + pw + 0.15 * pw + assert ys.min() >= y - 0.3 * ph + assert ys.max() <= y + ph + 0.3 * ph + # the fill must cover the pill area, not just the text glyphs + assert float(mask[y : y + ph, x : x + pw].mean()) > 0.4 diff --git a/tests/test_platform.py b/tests/test_platform.py index 9378c9e..5747d0e 100644 --- a/tests/test_platform.py +++ b/tests/test_platform.py @@ -285,7 +285,7 @@ class TestResolveStrength: assert SDXL_ZIMAGE_UNKNOWN_STRENGTH == SDXL_ZIMAGE_GEMINI_STRENGTH assert resolve_strength(None, "openai", "sdxl-zimage") == SDXL_ZIMAGE_OPENAI_STRENGTH assert resolve_strength(None, "google", "sdxl-zimage") == SDXL_ZIMAGE_GEMINI_STRENGTH - # An unrecognised issuer takes the stricter Gemini value, not the OpenAI one. + # An unrecognized issuer takes the stricter Gemini value, not the OpenAI one. assert resolve_strength(None, "adobe", "sdxl-zimage") == SDXL_ZIMAGE_UNKNOWN_STRENGTH assert resolve_strength(None, None, "sdxl-zimage") == SDXL_ZIMAGE_UNKNOWN_STRENGTH diff --git a/tests/test_registered_mark_calibrate.py b/tests/test_registered_mark_calibrate.py new file mode 100644 index 0000000..01df9c3 --- /dev/null +++ b/tests/test_registered_mark_calibrate.py @@ -0,0 +1,59 @@ +"""Contracts for the registered visible-mark calibration harness.""" + +from __future__ import annotations + +import importlib.util +import json +from pathlib import Path + +import pytest + +SCRIPT = Path(__file__).parents[1] / "scripts" / "registered_mark_calibrate.py" +SPEC = importlib.util.spec_from_file_location("registered_mark_calibrate", SCRIPT) +assert SPEC +assert SPEC.loader +module = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(module) + + +def test_manifest_preserves_evidence_arms(tmp_path: Path) -> None: + manifest = tmp_path / "manifest.jsonl" + manifest.write_text( + "\n".join( + [ + json.dumps({"path": "carrier.png", "arm": "positive"}), + json.dumps({"path": "provider.png", "arm": "metadata"}), + json.dumps({"path": "comparison.png", "arm": "control"}), + ] + ), + encoding="utf-8", + ) + + rows = module.load_manifest(manifest) + + assert [row["arm"] for row in rows] == ["positive", "metadata", "control"] + assert all(Path(row["path"]).is_absolute() for row in rows) + + +def test_manifest_rejects_one_file_in_multiple_arms(tmp_path: Path) -> None: + manifest = tmp_path / "manifest.jsonl" + manifest.write_text( + "\n".join( + [ + json.dumps({"path": "same.png", "arm": "positive"}), + json.dumps({"path": "same.png", "arm": "control"}), + ] + ), + encoding="utf-8", + ) + + with pytest.raises(ValueError, match="duplicate image path"): + module.load_manifest(manifest) + + +def test_summary_never_relabels_a_control() -> None: + summary = module.summarize([0.1, 0.4], unreadable=1, fires=1) + + assert summary["n"] == 2 + assert summary["unreadable"] == 1 + assert summary["fires"] == 1 diff --git a/tests/test_runninghub_engine.py b/tests/test_runninghub_engine.py index 83936c3..28c36df 100644 --- a/tests/test_runninghub_engine.py +++ b/tests/test_runninghub_engine.py @@ -71,7 +71,7 @@ class TestConfig: assert RunningHubEngine().config.provenance_ncc_factor == 1.0 def test_gate_above_clean_arm_max(self): - # Clean arm scored p99 0.273 / max 0.295 on 286 hand-labelled frames. + # Clean arm scored p99 0.273 / max 0.295 on 286 hand-labeled frames. assert RunningHubEngine().config.detect_ncc_threshold > 0.295 def test_registry_row(self): diff --git a/tests/test_script_help.py b/tests/test_script_help.py index c61b316..5af0b05 100644 --- a/tests/test_script_help.py +++ b/tests/test_script_help.py @@ -17,6 +17,7 @@ ROOT = Path(__file__).resolve().parents[1] "visible_groundtruth.py", "visible_recall_sample.py", "visible_sheets.py", + "registered_mark_calibrate.py", ], ) def test_script_help_exits_cleanly(script: str) -> None: diff --git a/tests/test_text_mark_engine.py b/tests/test_text_mark_engine.py index 019e4fd..c715283 100644 --- a/tests/test_text_mark_engine.py +++ b/tests/test_text_mark_engine.py @@ -1,6 +1,6 @@ """Policy-level tests for the shared text-mark engine config. -These assert calibrated TUNING, not algorithm behaviour -- +These assert calibrated TUNING, not algorithm behavior -- they exist so a future edit cannot silently revert a calibrated constant back to a value that was measured to be wrong. The measurements themselves live in `docs/module-internals.md` and in the comment at @@ -74,7 +74,7 @@ class TestScaleBasis: assert doubao_engine._CONFIG.scale_basis == "short" def test_jimeng_scales_with_width(self): - """Measured, not an oversight: the short-side basis took jimeng's labelled + """Measured, not an oversight: the short-side basis took jimeng's labeled landscape positives from 13/13 to 0/13.""" from remove_ai_watermarks import jimeng_engine diff --git a/tests/test_text_mark_faint_mask.py b/tests/test_text_mark_faint_mask.py index c94f35f..1ee3ec3 100644 --- a/tests/test_text_mark_faint_mask.py +++ b/tests/test_text_mark_faint_mask.py @@ -118,7 +118,7 @@ class TestFaintMaskStaysTight: loc = eng.locate(img) roi = loc.w * loc.h # The mark's own glyph box is ~40% of the corner ROI and the mask pads it, so a - # correct mask lands near 60%. The pre-fix behaviour measured 120.9% (the whole + # correct mask lands near 60%. The pre-fix behavior measured 120.9% (the whole # ROI plus padding), which this bound excludes. assert area < 0.85 * roi, f"mask covers {100 * area / roi:.0f}% of the corner box" diff --git a/tests/test_tiling.py b/tests/test_tiling.py index c44f6dc..60171a0 100644 --- a/tests/test_tiling.py +++ b/tests/test_tiling.py @@ -100,7 +100,7 @@ class TestRunTiled: def test_identity_generate_reconstructs_image(self): # A blend of identical (unchanged) tiles must reproduce the input exactly, # regardless of overlap -- the feather weights are a partition-of-unity once - # normalised. This is the seam-free guarantee. + # normalized. This is the seam-free guarantee. rng = np.random.default_rng(0) arr = rng.integers(0, 256, size=(1500, 1300, 3), dtype=np.uint8) image = Image.fromarray(arr) diff --git a/tests/test_trustmark_detector.py b/tests/test_trustmark_detector.py index 9c6a106..4083f26 100644 --- a/tests/test_trustmark_detector.py +++ b/tests/test_trustmark_detector.py @@ -3,7 +3,7 @@ TrustMark is an optional dependency (extra ``trustmark``) that downloads model weights on first use, so the decode path is only exercised when it is installed (mirrors the imwatermark handling). The always-on test pins the graceful -absent/error behaviour: detect must return None, never raise. +absent/error behavior: detect must return None, never raise. """ from __future__ import annotations diff --git a/tests/test_video.py b/tests/test_video.py index 9600fb3..d210de6 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -860,6 +860,12 @@ class TestVideoMetadataApi: class TestVideoProvenanceApi: + def test_c2pa_platform_keeps_the_bytedance_surface_name(self): + from remove_ai_watermarks.video import _platform_from_video_metadata + + assert _platform_from_video_metadata({"issuer": "BytePlus (ByteDance)"}) == "BytePlus (ByteDance)" + assert _platform_from_video_metadata({"issuer": "ByteDance (Volcano Engine)"}) == "ByteDance Volcano Engine" + def test_identifies_metadata_without_pixel_scan(self, tmp_path: Path): from remove_ai_watermarks.video import identify_video @@ -870,7 +876,7 @@ class TestVideoProvenanceApi: assert report.source == source assert report.is_ai_generated is True assert report.confidence == "high" - assert report.platform == "OpenAI (ChatGPT / gpt-image / DALL-E / Sora)" + assert report.platform == "OpenAI (ChatGPT / GPT Image / DALL·E / Sora)" assert report.visible_mark is None assert report.total_frames is None assert report.has_ai_metadata is True diff --git a/tests/test_video_fidelity_probe.py b/tests/test_video_fidelity_probe.py index a976e6c..a23039b 100644 --- a/tests/test_video_fidelity_probe.py +++ b/tests/test_video_fidelity_probe.py @@ -142,7 +142,7 @@ def test_pairing_follows_the_engine_sampling_rule_not_just_the_frame_count( in the suite that constrains the sampler's phase at all. The clips encode losslessly, so the aligned pairing is exact and clears any - floor; the misaligned one compares frames a full colour step apart and lands + floor; the misaligned one compares frames a full color step apart and lands near 9 dB, which is what leaves the 25 dB ceiling a wide moat rather than a tuned threshold. """ diff --git a/tests/test_watermark_registry.py b/tests/test_watermark_registry.py index c9f5e2b..67ce8c4 100644 --- a/tests/test_watermark_registry.py +++ b/tests/test_watermark_registry.py @@ -25,6 +25,7 @@ class TestCatalog: "runninghub", "baidu", "liblib", + "microsoft", "jimeng_pill", ] @@ -113,6 +114,7 @@ class TestScan: "runninghub", "baidu", "liblib", + "microsoft", "jimeng_pill", } @@ -219,7 +221,7 @@ class TestProvenanceGate: # 0.38 is inside the measured 13%-precision band and above the engine's own # 0.35 floor, so the engine reports `detected` and only the registry gate can # reject it. Hardcoded on purpose: if the gate is ever lowered back under this - # value, this test must fail on the BEHAVIOUR below, not on its own arithmetic. + # value, this test must fail on the behavior below, not on its own arithmetic. self._stub(monkeypatch, 0.38) img = np.zeros((256, 256, 3), np.uint8) assert reg.get_mark("gemini").detect(img).detected is False @@ -555,9 +557,12 @@ class TestMarkKnowledgeIsOnTheRow: if mark.label_regime == "tc260" and mark.key != "jimeng_pill": assert "aigc" in mark.provenance_signals, mark.key - def test_only_gemini_claims_platform_tokens(self): + def test_platform_token_marks_are_the_c2pa_attributed_ones(self): + # Gemini (Google C2PA) and Microsoft (issuer "Microsoft") are the marks whose + # vendor a C2PA platform string can confirm; every other mark reaches its + # provenance through TC260 codes or product signals instead. by_token = {m.key for m in reg.known_marks() if m.provenance_platform_tokens} - assert by_token == {"gemini"} + assert by_token == {"gemini", "microsoft"} class TestPillSuppressors: @@ -589,7 +594,7 @@ class TestPillSuppressors: assert not reg._keep_pill({"liblib", "jimeng"}, provenance=frozenset(), footprint_flat=1.0) def test_pill_survives_gemini_and_samsung(self): - """Neither is a TC260 labeller, and neither can put "jimeng" into provenance, + """Neither is a TC260 labeler, and neither can put "jimeng" into provenance, so neither may veto the arm it could not have enabled.""" assert reg._keep_pill({"gemini", "jimeng"}, provenance=frozenset(), footprint_flat=1.0) assert reg._keep_pill({"samsung", "jimeng"}, provenance=frozenset(), footprint_flat=1.0) @@ -632,4 +637,4 @@ class TestProvenanceMaskThreading: ) monkeypatch.setattr(eng, "footprint_mask", lambda image, *, force=False, region=None, dilate=None: None) _, removed = reg.remove_auto_marks(np.zeros((256, 256, 3), np.uint8), sensitivity="strict", backend="cv2") - assert "Google Gemini sparkle" not in removed + assert "Google Gemini visible watermark (sparkle)" not in removed