File size: 493 Bytes
ab3d5c6
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from transformers import AutoModelForImageClassification, BlipImageProcessor

from PIL import Image
import sys

image_processor = BlipImageProcessor.from_pretrained("imatag/stable-signature-bzh-detector-resnet18")
model = AutoModelForImageClassification.from_pretrained("imatag/stable-signature-bzh-detector-resnet18")
model.eval()

img = Image.open(sys.argv[1]).convert("RGB")
inputs = image_processor(img, return_tensors="pt")
p = model(**inputs).logits[0,0] < 0

print(f"watermarked: {p}")