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:
    1. Train classifier head
    2. 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
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using divine2k/ai-image-detectors 1