Home

Awesome

GAN Image Detection

This repository contains the best GAN generated image detector, namely <ResNet50 NoDown>, among those presented in the paper:

Are GAN generated images easy to detect? A critical analysis of the state-of-the-art
Diego Gragnaniello, Davide Cozzolino, Francesco Marra, Giovanni Poggi and Luisa Verdoliva. <br />In IEEE International Conference on Multimedia and Expo (ICME), 2021.

The very same architecture has been trained with images generated either by the Progressive Growing GAN or the StyleGAN2 architecture. <br />To download the trained weights, run:

wget -e robots=off -nd -P ./weights -A .pth -r https://www.grip.unina.it/download/prog/GANdetection/weights

or manually download them from here and put them in the folder weights.

Requirements

Test on a folder

To test the network on an image folder and to collect the results in a CSV file, run the following command:

python main.py -m weights/gandetection_resnet50nodown_stylegan2.pth -i ./example_images -o out.csv

Traning-set

1) ProGAN Traning-set

For training using ProGAN images, we used the traning-set provided by "CNN-generated images are surprisingly easy to spot...for now"

2) StyleGAN2 Traning-set

For training using StyleGAN2 images, we generated the fake images and used different public datasets for pristine images. The 720K fake images can be downloaded here. The number of pristine images for each public dataset is reported in the following table:

DatasetSize#Images
LSUN cat256x256120000
LSUN church256x256120000
LSUN hourse256x256120000
LSUN car512x512120000
AFHQ cat512x5124700
AFHQ dog512x5124700
AFHQ wild512x5124700
AnimalWeb512x51214100
BreCaHAD512x5121800
FFHQ1024x102428800
MetFaces1024x102414100

We downloaded and processed the pristine images following the guide provided by StyleGAN2-ada. The links to public datasets are reported in the guide except AnimalWeb dataset that can be downloaded here.