Skip to content

maheshepili/Ai-Detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Image & Video Detector

Detects whether an image or video is AI-generated using:

  • EfficientNet-B4 neural classifier
  • FFT frequency analysis for artifact detection
  • Ensemble scoring (80% neural + 20% FFT)

Quick Start

1. Install dependencies

pip install -r requirements.txt

2. Run the app

python app.py

Open http://localhost:5000 in your browser.


Project Structure

ai-detector/
├── app.py              # Flask web server
├── model.py            # Model loading + inference
├── train.py            # Fine-tuning script
├── requirements.txt
├── models/
│   └── detector.pth    # (optional) fine-tuned weights
├── templates/
│   └── index.html      # Frontend UI
└── data/               # (for training only)
    ├── train/
    │   ├── real/
    │   └── fake/
    └── val/
        ├── real/
        └── fake/

Training on your own dataset

  1. Organize images into data/train/real, data/train/fake, data/val/real, data/val/fake

  2. Run:

python train.py

The best checkpoint is saved to models/detector.pth and auto-loaded by the app.

Recommended public datasets

Dataset Link
CIFAKE https://www.kaggle.com/datasets/birdy654/cifake-real-and-ai-generated-synthetic-images
CNNDetection https://github.com/peterwang512/CNNDetection
GenImage https://github.com/GenImage-Dataset/GenImage
FaceForensics++ https://github.com/ondyari/FaceForensics (for deepfake video)

Upgrading the model

Swap efficientnet_b4 in model.py for any timm model, or load weights from:

  • UniversalFakeDetect: strongest for diffusion images
  • FaceForensics++: best for deepfake faces in video

Notes

  • No fine-tuned weights = ImageNet pretrained only (weaker, but still runs)

  • Video analysis samples 1 frame every 15 frames (configurable in model.py)

  • Heavy JPEG compression degrades detection accuracy

  • Confidence shown is for AI Generated — lower = more likely real

  • The Working Link (" https://maheshepili.github.io/Ai-Detector/ ")

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors