Synthetic-Image-Detection A deep learning model built with TensorFlow/Keras and deployed as a Streamlit app to classify images as either real photographs or AI-generated.

This model (best_real_vs_ai_detector.h5) detects whether an image is AI-generated or Real.
It is a fine-tuned VGG16 model trained on custom datasets of AI-generated and real images.


πŸ” Overview

The model outputs a single probability score:

  • Values > 0.5 β†’ REAL
  • Values ≀ 0.5 β†’ AI-GENERATED

It is used in an interactive Streamlit web app that allows users to upload an image, get predictions, and provide feedback to continuously improve the system.


🧩 Model Architecture

  • Base: VGG16 (pretrained on ImageNet)
  • Added Layers:
    • Flatten
    • Dense(512, ReLU)
    • Dropout(0.5)
    • Dense(1, Sigmoid)
  • Loss Function: Binary Crossentropy
  • Optimizer: Adam (learning rate = 1e-4)
  • Input Size: 150 Γ— 150 Γ— 3 RGB
  • Output: 1 neuron (binary classification)

πŸ“‚ Folder Structure

project/
β”‚
β”œβ”€β”€ app.py                  # Streamlit web interface
β”‚
β”œβ”€β”€ models/
β”‚   └── best_real_vs_ai_detector.h5   # Model file (auto-downloaded from Hugging Face)
β”‚
β”œβ”€β”€ feedback/               # Saved feedback images from the Streamlit app
β”‚   β”œβ”€β”€ correct_real/
β”‚   β”œβ”€β”€ correct_ai/
β”‚   β”œβ”€β”€ incorrect_real/
β”‚   └── incorrect_ai/
β”‚
β”œβ”€β”€ requirements.txt        # Dependencies for app and scripts
└── README.md               # Documentation

πŸ’» Usage
1️⃣ Install dependencies
pip install -r requirements.txt

2️⃣ Run the Streamlit app
streamlit run app.py


The first run will automatically download the model from Hugging Face into the models/ folder.

Then open the app in your browser:
http://localhost:8501


Upload an image, click Analyze, and the app will tell you if it’s Real or AI-Generated β€” with confidence percentage.

You can also provide feedback (Yes/No) to help future retraining.
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