https://github.com/sahal-mulki/spottingdiffusion
Official implementation of SpottingDiffusion : A CNN-based method of detecting AI generated images.
https://github.com/sahal-mulki/spottingdiffusion
ai ai-generated-images cnn cnn-classification code laion midjourney pretrained-model research-paper stable-diffusion tensorflow
Last synced: 4 months ago
JSON representation
Official implementation of SpottingDiffusion : A CNN-based method of detecting AI generated images.
- Host: GitHub
- URL: https://github.com/sahal-mulki/spottingdiffusion
- Owner: sahal-mulki
- License: other
- Created: 2023-01-07T20:02:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-23T13:03:40.000Z (about 1 year ago)
- Last Synced: 2025-08-02T14:40:09.528Z (11 months ago)
- Topics: ai, ai-generated-images, cnn, cnn-classification, code, laion, midjourney, pretrained-model, research-paper, stable-diffusion, tensorflow
- Language: Jupyter Notebook
- Homepage:
- Size: 85.2 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This repository is the official implementation of [SpottingDiffusion: Using transfer learning to detect Latent Diffusion Model-synthesized images](https://doi.org/10.59720/23-256)

# Table of Contents.
- [Table of Contents](#table-of-contents)
- [Abstract](#abstract)
- [Requirements](#requirements)
- [Training](#training)
- [Pretrained](#pretrained)
# Abstract
This study aims to present a novel method of detecting images made by “Latent Diffusion Models” as described by Rombach et al.
The issue of differentiating AI generated images from real ones has recently become one of great importance and debate; as extremely realistic AI generated images are rapidly becoming easier to make and disseminate.
The need of detecting these images arises when these technologies will inevitably be used to make misleading material with the intent of deceiving the human viewer. The authors of this study present a solution, an algorithmic way of differentiating images made by “Latent Diffusion Models” from real ones. In specific, we detail our research on detecting images produced by the “Stable Diffusion Latent Diffusion Model”.
# Requirements
You may also easily use the Google Colab version of the trainer, which has training and downloading automatically built in. 
### To install dependencies:
`pip install -r requirements.txt`
### To download datasets for training and evaluation:
Login with kaggle API, and then,
```
kaggle datasets download sahalmulki/stable-diffusion-generated-images
kaggle datasets download sahalmulki/spottingdiffusion-testing-dataset
mkdir testing
unzip /content/spottingdiffusion-testing-dataset.zip -d /testing/
```
# Training
### Run this command after downloading the dataset for training the model as specified in the paper:
`python train.py 12 0.3 0.00001`
### Evaluate the model on the testing dataset using this command:
`python evaluate.py /full-path-to-dir/testing pretrained/pretrained-spotting-diffusion`
Google Colab Notebook for Evaluation: 
# Pretrained
### A pretrained model for SpottingDiffusion is available in the SavedModel format in the `pretrained` directory.
# Cite this:
```
@article{spottingdiffusionmulki2024,
title={Spottingdiffusion: Using transfer learning to detect latent diffusion model-synthesized images},
DOI={10.59720/23-256},
journal={Journal of Emerging Investigators},
author={Sahal Mulki, Muhammad and Adil Mulki, Sadaf},
year={2024},
month={Nov}
}
```