File size: 2,437 Bytes
8ef3cab
 
 
 
 
 
 
 
 
 
 
 
60fb2ee
6e860fb
ef440de
6e860fb
 
 
 
 
 
 
 
ef440de
 
6e860fb
ef440de
6e860fb
ef440de
6e860fb
ef440de
 
 
6e860fb
ef440de
 
 
 
 
6e860fb
7acc0ed
6e860fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
title: Deepfake Detect
emoji: 📈
colorFrom: indigo
colorTo: pink
sdk: gradio
app_file: app.py
pinned: false
license: gpl-3.0
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference

# GAN-image-detection
This repository contains a GAN-generated image detector developed to distinguish real images from synthetic ones.

The detector is based on an ensemble of CNNs.
The backbone of each CNN is the EfficientNet-B4.
Each model of the ensemble has been trained in a different way following the suggestions presented in [this paper](https://ieeexplore.ieee.org/abstract/document/9360903) in order to increase the detector robustness to compression and resizing.

## Run the detector

### Prerequisites
1. Create and activate the conda environment
```bash
conda env create -f environment.yml
conda activate gan-image-detection
```
2. Download the model's weights from [this link](https://www.dropbox.com/s/g1z2u8wl6srjh6v/weigths.zip) and unzip the file under the main folder
```bash
wget https://www.dropbox.com/s/g1z2u8wl6srjh6v/weigths.zip
unzip weigths.zip
```

### Test the detector on a single image
We provide a simple script to obtain the model score for a single image.
```bash
python gan_vs_real_detector.py --img_path $PATH_TO_TEST_IMAGE
```

## Performance
We provide a [notebook](https://github.com/polimi-ispl/GAN-image-detection/blob/main/roc_curves.ipynb) with the script for computing the ROC curve for each dataset.

## How to cite
Training procedures have been carried out following the suggestions presented in the following paper.

Plaintext:
```
S. Mandelli, N. Bonettini, P. Bestagini, S. Tubaro, "Training CNNs in Presence of JPEG Compression: Multimedia Forensics vs Computer Vision", IEEE International Workshop on Information Forensics and Security (WIFS), 2020, doi: 10.1109/WIFS49906.2020.9360903.
```

Bibtex:
```bibtex
@INPROCEEDINGS{mandelli2020training,
  author={Mandelli, Sara and Bonettini, Nicolò and Bestagini, Paolo and Tubaro, Stefano},
  booktitle={IEEE International Workshop on Information Forensics and Security (WIFS)}, 
  title={Training {CNNs} in Presence of {JPEG} Compression: Multimedia Forensics vs Computer Vision}, 
  year={2020},
  doi={10.1109/WIFS49906.2020.9360903}}
```

## Credits
[Image and Sound Processing Lab - Politecnico di Milano](http://ispl.deib.polimi.it/)
- Sara Mandelli
- Nicolò Bonettini
- Paolo Bestagini
- Stefano Tubaro