AI Image Detectors (Ensemble Weights)
This repository contains trained PyTorch model weights used for detecting AI-generated images vs real photographs.
The models are designed to be used together as an ensemble and are consumed by the Hugging Face Space:
๐ https://huggingface.co/spaces/divine2k/ai_image-classification
Models Included
| Model | Architecture | File |
|---|---|---|
| Model 1 | ResNet50 | resnet50_ai_real_final.pth |
| Model 2 | EfficientNet-B0 | efficientNet_BO_Final.pth |
| Model 3 | ConvNeXt Tiny | convNext_final.pth |
All models are binary classifiers:
- Output < 0.45 โ AI-generated
- Output 0.45โ0.60 โ Uncertain
- Output > 0.60 โ Real
Final prediction is obtained via majority voting.
Training Overview
- Task: AI-generated image detection
- Classes:
AI,Real - Training data size: ~30,000 high-resolution images
- Generators included:
- Stable Diffusion (1.5, SDXL)
- Midjourney
- DALLยทE
- Grok (limited)
- Fine-tuning strategy:
- Train classifier head
- Unfreeze final backbone layers
Intended Use
โ
Research
โ
Demonstrations
โ
Academic projects
โ
Detection benchmarking
โ Not intended for forensic or legal decisions
โ Not guaranteed to generalize to unseen generators or heavy post-processing
How to Use (PyTorch)
import torch
import torch.nn as nn
from torchvision.models import resnet50
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="divine2k/ai-image-detectors",
filename="resnet50_ai_real_final.pth"
)
model = resnet50(weights=None)
model.fc = nn.Linear(model.fc.in_features, 1)
model.load_state_dict(torch.load(path, map_location="cpu"))
model.eval()
โ ๏ธ Important: These files contain state_dict only. You must recreate the architecture before loading.
Limitations
Performance drops on:
- Heavily compressed images
- Strong post-processing (filters, resizing, screenshots)
- New generators unseen during training
Thresholds may require calibration per dataset
Ethical Considerations
This model is provided to support:
- Transparency in synthetic media
- Research into AI image detection
It should not be used to:
- Make accusations
- Enforce moderation without human review
- Claim absolute authenticity
License
MIT License You are free to use, modify, and redistribute with attribution.
Citation
If you use this work in research or demos, please reference:
divine2k/ai-image-detectors