├── .gitignore
├── README.md
├── data
└── transform.py
├── images
├── artifact-fake-v4.png
├── artifact-real-v4.png
├── header.png
└── visual_summary2.jpg
└── requirements.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | .hypothesis/
51 | .pytest_cache/
52 |
53 | # Translations
54 | *.mo
55 | *.pot
56 |
57 | # Django stuff:
58 | *.log
59 | local_settings.py
60 | db.sqlite3
61 | db.sqlite3-journal
62 |
63 | # Flask stuff:
64 | instance/
65 | .webassets-cache
66 |
67 | # Scrapy stuff:
68 | .scrapy
69 |
70 | # Sphinx documentation
71 | docs/_build/
72 |
73 | # PyBuilder
74 | target/
75 |
76 | # Jupyter Notebook
77 | .ipynb_checkpoints
78 |
79 | # IPython
80 | profile_default/
81 | ipython_config.py
82 |
83 | # pyenv
84 | .python-version
85 |
86 | # pipenv
87 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
89 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
90 | # install all needed dependencies.
91 | #Pipfile.lock
92 |
93 | # celery beat schedule file
94 | celerybeat-schedule
95 |
96 | # SageMath parsed files
97 | *.sage.py
98 |
99 | # Environments
100 | .env
101 | .venv
102 | env/
103 | venv/
104 | ENV/
105 | env.bak/
106 | venv.bak/
107 |
108 | # Spyder project settings
109 | .spyderproject
110 | .spyproject
111 |
112 | # Rope project settings
113 | .ropeproject
114 |
115 | # mkdocs documentation
116 | /site
117 |
118 | # mypy
119 | .mypy_cache/
120 | .dmypy.json
121 | dmypy.json
122 |
123 | # Pyre type checker
124 | .pyre/
125 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ArtiFact: A Large-Scale Dataset with Artificial and Factual Images for Generalizable and Robust Synthetic Image Detection [ICIP 2023]
2 |
3 |
4 |
5 | **Paper:**
6 | * IEEE Xplore: https://ieeexplore.ieee.org/document/10222083
7 | * ArXiv: https://arxiv.org/abs/2302.11970
8 |
9 | **Abstract:** Synthetic image generation has opened up new opportunities but has also created threats in regard to privacy, authenticity, and security. Detecting fake images is of paramount importance to prevent illegal activities, and previous research has shown that generative models leave unique patterns in their synthetic images that can be exploited to detect them. However, the fundamental problem of generalization remains, as even state-of-the-art detectors encounter difficulty when facing generators never seen during training. To assess the generalizability and robustness of synthetic image detectors in the face of real-world impairments, this paper presents a large-scale dataset named ArtiFact, comprising diverse generators, object categories, and real-world challenges. Moreover, the proposed multi-class classification scheme, combined with a filter stride reduction strategy addresses social platform impairments and effectively detects synthetic images from both seen and unseen generators. The proposed solution significantly outperforms other top teams by 8.34% on Test 1, 1.26% on Test 2, and 15.08% on Test 3 in the IEEE VIP Cup challenge at ICIP 2022, as measured by the accuracy metric.
10 |
11 | **Presentation**:
12 | [](https://youtu.be/hGXufeubNME)
13 |
14 | **Visual Summary**:
15 |
16 |
17 |
18 | # Update
19 | * [22 June 2023] - The work has been accepted to IEEE ICIP 2023 conference.
20 |
21 | # Result on [IEEE VIP Cup at ICIP 2022](https://grip-unina.github.io/vipcup2022/)
22 |
23 | Accuracy (%) of Top3 Teams on Leaderboard,
24 |
25 | | Team Names | Test 1 | Test 2 | Test 3 |
26 | | :-------------------- | :--------: | :--------: | :--------: |
27 | | Sherlock | 87\.70 | 77\.52 | 73\.45 |
28 | | FAU Erlangen-Nürnberg | 87\.14 | 81\.74 | 75\.52 |
29 | | **Megatron (Ours)** | **96\.04** | **83\.00** | **90\.60** |
30 |
31 | > **Note:** A small portion of the proposed ArtiFact dataset, totaling 222K images of 71K real images and 151K fake images from only 13 generators is used in the IEEE VIP Cup. Here all the Test data is kept confidential from all participating teams. Additionally, the generators used for the Test 1 data are known to all teams, whereas the generators for Test 2 and Test 3 are kept undisclosed.
32 |
33 | # Dataset Description
34 | * Total number of images: $2,496,738$
35 | * Number of real images: $964,989$
36 | * Number of fake images: $1,531,749$
37 | * Number of generators used for fake images: $25$ (including $13$ GANs, $7$ Diffusion, and $5$ miscellaneous generators)
38 | * Number of sources used for real images: $8$
39 | * Categories included in the dataset: `Human/Human Faces`, `Animal/Animal Faces`, `Places`, `Vehicles`, `Art`, and other real-life objects
40 | * Image Resolution: $200 \times 200$
41 |
42 | ## Data Distribution
43 |
44 | * Real
45 |
46 |
47 |
48 | * Fake
49 |
50 |
51 |
52 | # Download Dataset
53 |
54 | The dataset is hosted on Kaggle. The dataset can be downloaded i) directly from the browser using the link below or ii) can be downloaded using [kaggle-api](https://github.com/Kaggle/kaggle-api).
55 |
56 | ## i) Directly from Browser
57 | Link: [ArtiFact Dataset](https://www.kaggle.com/datasets/awsaf49/artifact-dataset)
58 |
59 |
60 | ## ii) Kaggle API
61 | ```shell
62 | !kaggle datasets download -d awsaf49/artifact-dataset
63 | ```
64 |
65 | # How to Use
66 | The dataset is organized into folders, each of which corresponds to a specific generator of synthetic images or source of real images. Each folder contains a `metadata.csv` file, which provides information about the images in the folder. It contains following columns,
67 |
68 | * `image_path` : The relative path of the image file.
69 | * `target` : The label for the image, which is either 0 for real or 1 for fake.
70 | * `category` : The category (cat or dog etc) of the image
71 |
72 |
73 | # Data Generation
74 |
75 | * Images are randomly sampled from different methods then transformed using impairments. The methods are listed below,
76 |
77 | Methods
78 |
79 |
80 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
81 | | :-------------- | :--------------------------------------------- | :----------------------------------------- | :---------------------------------- | :-------------------------------------------- | :--------------------------------------------- | :------------------------------------------------- | :---------------------------------------------------------------- | :------------------------------------------------ | :---------------------------------------------- | :------------------------------------------ | :------------------------------------------ | :----------------------------------------------------------- | :---------------------------------------------------- | :----------------------------------------- | :---------------------------------------- | :----------------------------------------------- | :------------------------------------------------ | :-------------------------------------------------------------------------- | :----------------------------------------- | :---------------------------------------------------------------------------------------- | :---------------------------------------- | :---------------------------------------- | :---------------------------------------------------------------------------- | :-------------------------------------------- | :----------------------------------------------------------- | :-------------------------------------------------- | :-------------------------------------------------- | :-------------------------------------------------------- | :------------------------------------------------ | :----------------------------------------------------- | :-------------------------------------- | :---------------------------------------------------------------- | :-------------------------------------------------------------- |
82 | | **Method** | ImageNet | COCO | LSUN | AFHQ | FFHQ | Metfaces | CelebAHQ | Landscape | Glide | StyleGAN2 | StyleGAN3 | Generative Inpainting | Taming Transformer | MAT | LaMa | Stable Diffusion | VQ Diffusion | Palette | StyleGAN1 | Latent Diffusion | CIPS | StarGAN | BigGAN | GANformer | ProjectedGAN | SFHQ | FaceSynthetics | Denoising Diffusion GAN | DDPM | DiffusionGAN | GauGAN | ProGAN | CycleGAN |
83 | | **Reference** | [link](https://www.image-net.org/download.php) | [link](https://cocodataset.org/\#download) | [link](https://github.com/fyu/lsun) | [link](https://github.com/clovaai/stargan-v2) | [link](https://github.com/NVlabs/ffhq-dataset) | [link](https://github.com/NVlabs/metfaces-dataset) | [link](https://github.com/tkarras/progressive*growing*of*gans) | [link](https://github.com/mahmoudnafifi/HistoGAN) | [link](https://github.com/openai/glide-text2im) | [link](https://github.com/NVlabs/stylegan2) | [link](https://github.com/NVlabs/stylegan3) | [link](https://github.com/JiahuiYu/generative*inpainting) | [link](https://github.com/CompVis/taming-transformer) | [link](https://github.com/fenglinglwb/mat) | [link](https://github.com/saic-mdal/lama) | [link](https://github.com/huggingface/diffusers) | [link](https://github.com/microsoft/VQ-Diffusion) | [link](https://github.com/Janspiry/Palette-Image-to-Image-Diffusion-Models) | [link](https://github.com/NVlabs/stylegan) | [link](https://github.com/compvis/latent-diffusion\#retrieval-augmented-diffusion-models) | [link](https://github.com/saic-mdal/CIPS) | [link](https://github.com/yunjey/StarGAN) | [link](https://github.com/open-mmlab/mmgeneration/tree/master/configs/biggan) | [link](https://github.com/dorarad/gansformer) | [link](https://github.com/autonomousvision/projected*gan) | [link](https://github.com/SelfishGene/SFHQ-dataset) | [link](https://github.com/microsoft/FaceSynthetics) | [link](https://github.com/NVlabs/denoising-diffusion-gan) | [link](https://github.com/hojonathanho/diffusion) | [link](https://github.com/Zhendong-Wang/Diffusion-GAN) | [link](https://github.com/NVlabs/SPADE) | [link](https://github.com/tkarras/progressive*growing*of*gans) | [link](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) |
84 |
85 |
86 |
87 | * All images went through RandomCrop and Random Impairments (Jpeg Compression & Downscale). To apply these transformation use [data/transform.py](https://github.com/awsaf49/artifact/blob/main/data/transform.py) which applies random transformation. All images are cropped and resized to $200 \times 200$ pixels and then compressed using JPEG at a random quality level.
88 |
89 | ```shell
90 | !python data/transform.py