metadata
license: mit
tags:
- image-classification
- ai-generated-image-detection
- vision-transformer
- vit
datasets:
- Rajarshi-Roy-research/Defactify_Image_Dataset
- HPAI-BSC/SuSy-Dataset
metrics:
- accuracy
- f1
pipeline_tag: image-classification
ai-detector
Vision Transformer (ViT) fine-tuné pour la détection d'images générées par IA
(projet SteganographIA — MIAGE TPI). Classifieur binaire real vs ai_generated.
Entraîné avec augmentation de robustesse (recompression JPEG, resize, flip, flou) reproduisant le pipeline des réseaux sociaux, et évalué in-distribution (Defactify) ET out-of-distribution (SuSy, générateurs non vus à l'entraînement).
Résultats
| Jeu d'évaluation | Accuracy | F1 (macro) |
|---|---|---|
| Defactify (test, in-distribution) | 0.934 | 0.934 |
| SuSy (out-of-distribution) | 0.868 | 0.868 |
Le score OOD, attendu plus bas, mesure la généralisation à des générateurs inconnus.
Détails d'entraînement
- Base :
google/vit-base-patch16-224 - Train :
Rajarshi-Roy-research/Defactify_Image_Dataset, rééquilibré 50/50 (undersampling stratifié sur les 5 générateurs). - Augmentation robustesse (JPEG QF 60-90, resize 0.5-0.9, flip, flou).
- lr 2e-5, batch 16, 3 epochs, fp16, early stopping sur le F1.
Usage
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
import torch
processor = AutoImageProcessor.from_pretrained("Cr2do/ai-detector")
model = AutoModelForImageClassification.from_pretrained("Cr2do/ai-detector")
image = Image.open("img.jpg").convert("RGB")
inputs = processor(image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
print(model.config.id2label[logits.argmax(-1).item()])
Limites
- Rappel plus faible sur des générateurs non vus (cf. score OOD).
- Images redimensionnées en 224x224 : artefacts très haute résolution perdus.