Code for the paper: CNN-generated images are surprisingly easy to spot… for now https://peterwang512.github.io/CNNDetection/
|size (curr.)||6507 kB|
Detecting CNN-Generated Images [Project Page]
- Install PyTorch (pytorch.org)
pip install -r requirements.txt
Download model weights
(2) Quick start
# Model weights need to be downloaded. python demo.py examples/real.png weights/blur_jpg_prob0.1.pth python demo.py examples/fake.png weights/blur_jpg_prob0.1.pth
demo.py simply runs the model on a single image, and outputs the uncalibrated prediction.
The testset evaluated in the paper can be downloaded here.
The zip file contains images from 13 CNN-based synthesis algorithms, including the 12 testsets from the paper and images downloaded from whichfaceisreal.com. Images from each algorithm are stored in a separate folder. In each category, real images are in the
0_real folder, and synthetic images are in the
Note: ProGAN, StyleGAN, StyleGAN2, CycleGAN testset contains multiple classes, which are stored in separate subdirectories.
A script for downloading the testset is as follows:
# Download the dataset cd dataset bash download_testset.sh cd ..
After the testset and the model weights are downloaded, one can evaluate the models by running:
# Run evaluation script. Model weights need to be downloaded. python eval.py
Besides print-outs, the results will also be stored in a csv file in the
results folder. Configurations such as the path of the dataset, model weight are in
eval_config.py, and one can modify the evaluation by changing the configurations. The following are the models’ performances on the released set:
(B) Citation, Contact
If you find this useful for your research, please consider citing this bibtex. Please contact Sheng-Yu Wang <sheng-yu_wang at berkeley dot edu> with any comments or feedback.