mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-12-05 19:53:26 +01:00
63 lines
2.7 KiB
Markdown
63 lines
2.7 KiB
Markdown
# Source-pipeline classification
|
|
|
|
`classify_source` (and the CLI command `classify-source`) is an opt-in,
|
|
metadata-free pixel source-pipeline classifier across **10 AI provider families**
|
|
with Stage-2 model-version attribution.
|
|
|
|
This is not a SynthID detector. It does not decode or verify a watermark
|
|
payload, and it must not be used to claim that SynthID is present or absent
|
|
(`watermark_truth="unknown"`). The model describes the complete source/export
|
|
pixel pipeline, where renderer, geometry, encoding, post-processing, and
|
|
watermark state can be confounded.
|
|
|
|
Install the lightweight runtime:
|
|
|
|
```bash
|
|
uv add "remove-ai-watermarks[source-classify]"
|
|
```
|
|
|
|
It evaluates 956-dimensional forensic, spectral, and cross-channel chroma/grid
|
|
features (`124-d` spatial patch residuals + `768-d` phase-free log-power
|
|
spectrum + `64-d` radial-slope, Nyquist-grid, and azimuthal-anisotropy terms)
|
|
through 10 provider specialists and their subfamily sub-specialists with
|
|
positive-part zero-inflation sub-unit pooling, damped cross-provider margin
|
|
suppression ($\gamma = 0.60$), and stacked Stage-2 version classifiers.
|
|
|
|
It routes across all 10 canonical AI provider classes (`openai`, `google`,
|
|
`bytedance`, `flux`, `stable_diffusion`, `meta`, `midjourney`, `ideogram`,
|
|
`firefly`, `xai`) or abstains as `unknown`.
|
|
|
|
Call the CLI command or Python API explicitly:
|
|
|
|
```bash
|
|
remove-ai-watermarks classify-source metadata-stripped.png
|
|
remove-ai-watermarks classify-source metadata-stripped.png --json
|
|
```
|
|
|
|
```python
|
|
import remove_ai_watermarks as raiw
|
|
|
|
result = raiw.classify_source("metadata-stripped.png")
|
|
print(result.label) # one of the 10 providers or "unknown"
|
|
print(result.version_subfamily) # e.g. "google:gemini_3_pro_image", "openai:gpt_image_1_5", or None
|
|
print(result.reason) # "classified" | "abstained" | "feature_unavailable"
|
|
print(result.margins) # provider margins before thresholding
|
|
print(result.thresholds) # calibrated provider thresholds
|
|
print(result.watermark_truth) # always "unknown"
|
|
```
|
|
|
|
`feature_unavailable` is returned for images below the required 256x256
|
|
geometry or for a degenerate feature vector. `abstained` means no active
|
|
provider cleared its calibrated damped margin. Both are honest `unknown`
|
|
results.
|
|
|
|
The first call downloads the exact pinned revision of
|
|
[`wiltodelta/raiw-source-classify`](https://huggingface.co/wiltodelta/raiw-source-classify)
|
|
(`multi-provider-source-v3.npz`, verified by SHA-256). Set
|
|
`RAIW_SOURCE_CLASSIFY_WEIGHTS` to the `.npz` file itself or its parent directory
|
|
for an offline deployment.
|
|
|
|
This classifier is never invoked by `identify`, `has_invisible_target`, or `all`.
|
|
The [model card](source-classify-hf/README.md) records the evaluation and
|
|
robustness limits.
|