Vivien Chappelier
typo
60ab62a
|
raw
history blame
2.02 kB
metadata
license: mit
tags:
  - resnet
  - stable-diffusion
  - stable-diffusion-diffusers

BZH watermark detector (demo)

You can use this classifier to detect watermarks generated with our SDXL-turbo watermarking demo.

Usage

from transformers import AutoModel, BlipImageProcessor
from PIL import Image
import sys
import torch

image_processor = BlipImageProcessor.from_pretrained("imatag/stable-signature-bzh-detector-resnet18")
commit_hash = "584a7bc01dc0f02e53bf8b8b295717ed09ed7294"
model = AutoModel.from_pretrained("imatag/stable-signature-bzh-detector-resnet18", trust_remote_code=True, revision=commit_hash)

img = Image.open(sys.argv[1]).convert("RGB")
inputs = image_processor(img, return_tensors="pt")
with torch.no_grad():
    p = torch.sigmoid(model(**inputs).logits).item()

print(f"approximate p-value: {p}")

Purpose

This model is an approximate version of IMATAG's BZH decoder for the watermark embedded in our SDXL-turbo watermarking demo. It works on this watermark only and cannot be used to decode other watermarks. It will produce an approximate p-value measuring the risk of mistakenly detecting a watermark on a benign (non-watermarked) image. For an exact p-value and improved robustness, please use the API instead.

For more details on this watermarking technique, check out our announcement and our lab's blog post.

For watermarked models with a different key, support for payload, other perceptual compromises, robustness to other attacks, or faster detection, please contact IMATAG.