Skip to content

littlejuyan/FusingGlobalandLocal

Repository files navigation

Fusing Global and Local Features for Generalized AI-Synthesized Image Detection [Paper Link]

1. Setup

Install packages: pip install -r requirements.txt

2. Dataset

###Training and validation dataset We used the same training dataset in the paper "CNN-generated images are surprisingly easy to spot...for now". The training and validation dataset can be downloaded from their repository. The dataset should be arranged as this:

Training and validation dataset
	|- train(90% of downloaded dataset)
		|_ 0_real
			xxxx.png
			...
		|_ 1_fake
			yyyy.png
			...
	|- val(10% of downloaded dataset)
		|_ 0_real
			xxxx.png
			...
		|_ 1_fake
			yyyy.png
			...

Testing dataset

For the testing dataset, we composed a dataset of synthetic images generated with 19 various generation models based on several existing datasets such as CNNDetection, Sheng-Yu Wang, et al., CVPR2020, Reverse_Engineering_GMs, Vishal Asnani, et al., and Celeb-DF, Yuezun Li, et al., CVPR2020. Besides, we also collect several models-generated datasets from SemaFor program, such as StyleGAN3, Taming Transformers, BGM, etc.

Before testing the model, please arrange the testing dataset as following:

Testing dataset
	|- Generation Model 1
		|_ 0_real
			xxxx.png
			...
		|_ 1_fake
			yyyy.png
			...
	|- Generation Model 2
		|_ 0_real
			xxxx.png
			...
		|_ 1_fake
			yyyy.png
			...
	|- Generation Model ...	

Train the model

We provide an example script to train our model by running bash train.sh, in which you can change the following parameters:

--name: the directory name you want to save your checkpoints in.

--blur_prob: the probability of the image processed with Gaussian blur.

--blur_sig: the Gaussian blur parameter σ

--jpg_prob: the probability of the image processed with JPEG compression.

--jpg_method: compression method, cv2 or pil.

--jpg_qual: JPEG compression quality parameter.

--dataroot: path of training and validation datasets.

Test the model

We provide an example script to test our model by running bash test.sh.

Acknowledgments

This repository borrows partially from this work.

This work is supported by the US Defense Advanced Research Projects Agency (DARPA) Semantic Forensic (SemaFor) program. We thank SemaFor TA4 teams and previous works for providing datasets for our training and testing.

Citation

If you find this useful for your research, please consider citing this bibtex.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published