Views
No views yet
Ateeqq/ai-vs-human-image-detector.
No fine-tuning, no architecture change, no recalibration — the weights are the
upstream ones, in a format browsers can run.pixel_values, float32 [batch, 3, 224, 224], RGB, normalized
with mean [0.5, 0.5, 0.5] and std [0.5, 0.5, 0.5].logits, float32 [batch, 2]. id2label = {0: "ai", 1: "hum"},
so the log-odds of "AI-generated" is logits[0] - logits[1].1import numpy as np, onnxruntime as ort
2from PIL import Image
3
4sess = ort.InferenceSession("model.onnx")
5im = Image.open("image.jpg").convert("RGB").resize((224, 224), Image.BILINEAR)
6x = ((np.asarray(im, np.float32) / 255.0 - 0.5) / 0.5).transpose(2, 0, 1)[None]
7logits = sess.run(None, {"pixel_values": x})[0][0]
8p_ai = 1 / (1 + np.exp(-(logits[0] - logits[1])))1pip install torch transformers onnx onnxruntime
2python3 scripts/convert-siglip.py # from the Forensic Lens reposha256: b0b82e15a57d1cb72a2920098fd39634c7013ff05a66ce7673c38bea12d3363b