File size: 7,442 Bytes
0ddc865
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# CleanFD Backup

**CleanFD** is a comprehensive modularized library for benchmarking AI-generated image detection methods. This backup includes the complete project with all detectors, datasets, pretrained models, and evaluation scripts.

## Download & Extract

```bash
# huggingface_hub 설치 (필요시)
pip install huggingface_hub

# 다운로드
huggingface-cli download leekwoon/cleanfd_backup --repo-type dataset --local-dir ./cleanfd_backup

# 무결성 확인 (선택사항)
cd cleanfd_backup
md5sum -c checksums.md5

# 파일 합치기 및 압축 해제
cat data.tar.gz.part_* | tar -xzvf -
```

## Directory Structure

```
cleanfd/
├── cleanfd/                # Core library modules
│   ├── detector/           # Detector implementations
│   │   ├── aeroblade_detector.py
│   │   ├── aide_detector.py
│   │   ├── bfree_detector.py
│   │   ├── c2pclip_detector.py
│   │   ├── clipdet_detector.py
│   │   ├── corvi_detector.py
│   │   ├── corvi_plus_detector.py
│   │   ├── corvi_mask_gated_detector.py
│   │   ├── dda_detector.py
│   │   ├── drct_detector.py
│   │   ├── npr_detector.py
│   │   ├── rajan_detector.py
│   │   ├── rajan_plus_detector.py
│   │   ├── rajan_mask_gated_detector.py
│   │   ├── rine_detector.py
│   │   ├── safe_detector.py
│   │   ├── ufd_detector.py
│   │   └── warpad_detector.py
│   ├── dataset/            # Dataset utilities
│   │   ├── corvi_dataset.py
│   │   ├── rajan_dataset.py
│   │   ├── inpaint_dataset.py
│   │   ├── folder_dataset.py
│   │   └── transforms.py
│   ├── nn_classifier/      # Neural network modules
│   │   ├── resnet.py
│   │   └── sae.py
│   └── utils/              # Utilities
│       └── early_stopping.py
├── configs/                # Hydra configuration files
│   ├── aeroblade.yaml
│   ├── aide.yaml
│   ├── bfree.yaml
│   ├── c2pclip.yaml
│   ├── clipdet.yaml
│   ├── corvi.yaml
│   ├── corvi_plus.yaml
│   ├── corvi_mask_gated.yaml
│   ├── dda.yaml
│   ├── drct.yaml
│   ├── npr.yaml
│   ├── rajan.yaml
│   ├── rajan_plus.yaml
│   ├── rajan_mask_gated.yaml
│   ├── rine.yaml
│   ├── safe.yaml
│   ├── ufd.yaml
│   └── warpad.yaml
├── data/                   # Dataset directory
│   ├── train/              # Training data
│   │   ├── real/           # Real images
│   │   │   ├── coco/       # COCO dataset
│   │   │   └── lsun/       # LSUN dataset
│   │   └── fake/           # AI-generated images
│   │       ├── aligned/    # Aligned inversions
│   │       ├── ldm/        # Latent Diffusion Model
│   │       ├── sd21_inpainted_*/
│   │       └── lsun_inpaint_*/
│   ├── val/                # Validation data
│   │   ├── real/
│   │   └── fake/
│   ├── test/               # Test data
│   │   ├── real/
│   │   │   └── redcaps/    # RedCaps dataset
│   │   └── fake/           # Various generators
│   └── test_processed/     # Processed test data
│       ├── real/
│       └── fake/
├── pretrained/             # Pretrained model weights
│   ├── DRCT-2M/
│   ├── GenImage/
│   ├── aide/
│   ├── bfree/
│   ├── c2pclip/
│   ├── clipdet/
│   ├── dda/
│   ├── npr/
│   ├── rine/
│   ├── safe/
│   └── ufd/
├── pipelines/              # Training/evaluation pipelines
│   ├── aeroblade.py
│   ├── aide.py
│   ├── bfree.py
│   ├── c2pclip.py
│   ├── clipdet.py
│   ├── corvi.py
│   ├── corvi_plus.py
│   ├── corvi_mask_gated.py
│   ├── dda.py
│   ├── drct.py
│   ├── npr.py
│   ├── rajan.py
│   ├── rajan_plus.py
│   ├── rajan_mask_gated.py
│   ├── rine.py
│   ├── safe.py
│   ├── ufd.py
│   └── warpad.py
├── results/                # Experiment results
│   ├── corvi/
│   ├── corvi_plus/
│   ├── corvi_mask_gated_*/
│   ├── rajan/
│   ├── rajan_plus/
│   ├── rajan_mask_gated_*/
│   └── ...
├── scripts/                # Utility scripts
│   ├── eval.py
│   ├── analyze_results.py
│   ├── analyze_results_v2.py
│   └── analyze_results.sh
├── notebooks/              # Jupyter notebooks
│   ├── figures/            # Figure generation
│   ├── captum/             # Interpretability
│   └── ...
├── requirements.txt        # Python dependencies
└── setup.py               # Package setup
```

## Supported Detectors

### Frequency-based Methods
- **DRCT**: Dual-Residual ConvNeXt Transformer
- **RINE**: Reconstruction-based detection
- **SAFE**: Spectral Analysis for Fake Evidence

### Gradient-based Methods
- **Corvi**: Core visual features detector
- **Corvi+**: Enhanced Corvi with additional processing
- **Rajan**: Gradient-based detector
- **Rajan+**: Enhanced Rajan detector

### Masked/Gated Methods
- **Corvi Mask Gated**: Corvi with attention gating
- **Rajan Mask Gated**: Rajan with attention gating

### CLIP-based Methods
- **AIDE**: CLIP-based detector
- **C2P-CLIP**: Contrastive-to-Positive CLIP
- **CLIPDet**: CLIP-based detection
- **UFD**: Universal Fake Detector

### Other Methods
- **Aeroblade**: Aerospace-inspired detector
- **BFree**: Boundary-free detector
- **DDA**: Domain Discriminative Attention
- **NPR**: Neural Pattern Recognition
- **WarpAD**: Warping-based Anomaly Detection

## Dataset Information

### Training Data
- **Real Images**: COCO, LSUN
- **Fake Images**: 
  - Aligned inversions (Rajan method)
  - Latent Diffusion Model (LDM) generations
  - Stable Diffusion v2.1 inpainted images
  - LSUN inpainted images

### Test Data
- **Real Images**: RedCaps dataset
- **Fake Images** (12 generators):
  - Stable Diffusion (SD)
  - Midjourney
  - Kandinsky
  - Playground
  - PixelArt
  - LCM
  - Flux
  - Wuerstchen
  - Amused
  - Chameleon
  - Loki
  - WildRF

### Data Processing
- **test**: Original test images
- **test_processed**: Images with perturbations (JPEG, WebP, resize)

## Key Features

- **Unified Interface**: Consistent API for all detectors
- **Hydra Configuration**: Flexible experiment management
- **Comprehensive Evaluation**: Multiple metrics (AP, ACC)
- **Perturbation Testing**: Robustness evaluation with various image processing
- **Modular Design**: Easy to add new detectors and datasets
- **Reproducible**: Configuration-based experiments

## Usage Example

```bash
# Train a detector
python pipelines/corvi.py

# Evaluate on test set
python scripts/eval.py --method corvi --test_dir test

# Analyze results
python scripts/analyze_results.py --methods corvi rajan --test_dirs test test_processed
```

## Citation

This library aggregates multiple AI-generated image detection methods for research purposes. Please cite the original papers when using specific detectors.