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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CleanFD Backup
|
| 2 |
+
|
| 3 |
+
**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.
|
| 4 |
+
|
| 5 |
+
## Download & Extract
|
| 6 |
+
|
| 7 |
+
```bash
|
| 8 |
+
# huggingface_hub 설치 (필요시)
|
| 9 |
+
pip install huggingface_hub
|
| 10 |
+
|
| 11 |
+
# 다운로드
|
| 12 |
+
huggingface-cli download leekwoon/cleanfd_backup --repo-type dataset --local-dir ./cleanfd_backup
|
| 13 |
+
|
| 14 |
+
# 무결성 확인 (선택사항)
|
| 15 |
+
cd cleanfd_backup
|
| 16 |
+
md5sum -c checksums.md5
|
| 17 |
+
|
| 18 |
+
# 파일 합치기 및 압축 해제
|
| 19 |
+
cat data.tar.gz.part_* | tar -xzvf -
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
## Directory Structure
|
| 23 |
+
|
| 24 |
+
```
|
| 25 |
+
cleanfd/
|
| 26 |
+
├── cleanfd/ # Core library modules
|
| 27 |
+
│ ├── detector/ # Detector implementations
|
| 28 |
+
│ │ ├── aeroblade_detector.py
|
| 29 |
+
│ │ ├── aide_detector.py
|
| 30 |
+
│ │ ├── bfree_detector.py
|
| 31 |
+
│ │ ├── c2pclip_detector.py
|
| 32 |
+
│ │ ├── clipdet_detector.py
|
| 33 |
+
│ │ ├── corvi_detector.py
|
| 34 |
+
│ │ ├── corvi_plus_detector.py
|
| 35 |
+
│ │ ├── corvi_mask_gated_detector.py
|
| 36 |
+
│ │ ├── dda_detector.py
|
| 37 |
+
│ │ ├── drct_detector.py
|
| 38 |
+
│ │ ├── npr_detector.py
|
| 39 |
+
│ │ ├── rajan_detector.py
|
| 40 |
+
│ │ ├── rajan_plus_detector.py
|
| 41 |
+
│ │ ├── rajan_mask_gated_detector.py
|
| 42 |
+
│ │ ├── rine_detector.py
|
| 43 |
+
│ │ ├── safe_detector.py
|
| 44 |
+
│ │ ├── ufd_detector.py
|
| 45 |
+
│ │ └── warpad_detector.py
|
| 46 |
+
│ ├── dataset/ # Dataset utilities
|
| 47 |
+
│ │ ├── corvi_dataset.py
|
| 48 |
+
│ │ ├── rajan_dataset.py
|
| 49 |
+
│ │ ├── inpaint_dataset.py
|
| 50 |
+
│ │ ├── folder_dataset.py
|
| 51 |
+
│ │ └── transforms.py
|
| 52 |
+
│ ├── nn_classifier/ # Neural network modules
|
| 53 |
+
│ │ ├── resnet.py
|
| 54 |
+
│ │ └── sae.py
|
| 55 |
+
│ └── utils/ # Utilities
|
| 56 |
+
│ └── early_stopping.py
|
| 57 |
+
├── configs/ # Hydra configuration files
|
| 58 |
+
│ ├── aeroblade.yaml
|
| 59 |
+
│ ├── aide.yaml
|
| 60 |
+
│ ├── bfree.yaml
|
| 61 |
+
│ ├── c2pclip.yaml
|
| 62 |
+
│ ├── clipdet.yaml
|
| 63 |
+
│ ├── corvi.yaml
|
| 64 |
+
│ ├── corvi_plus.yaml
|
| 65 |
+
│ ├── corvi_mask_gated.yaml
|
| 66 |
+
│ ├── dda.yaml
|
| 67 |
+
│ ├── drct.yaml
|
| 68 |
+
│ ├── npr.yaml
|
| 69 |
+
│ ├── rajan.yaml
|
| 70 |
+
│ ├── rajan_plus.yaml
|
| 71 |
+
│ ├── rajan_mask_gated.yaml
|
| 72 |
+
│ ├── rine.yaml
|
| 73 |
+
│ ├── safe.yaml
|
| 74 |
+
│ ├── ufd.yaml
|
| 75 |
+
│ └── warpad.yaml
|
| 76 |
+
├── data/ # Dataset directory
|
| 77 |
+
│ ├── train/ # Training data
|
| 78 |
+
│ │ ├── real/ # Real images
|
| 79 |
+
│ │ │ ├── coco/ # COCO dataset
|
| 80 |
+
│ │ │ └── lsun/ # LSUN dataset
|
| 81 |
+
│ │ └── fake/ # AI-generated images
|
| 82 |
+
│ │ ├── aligned/ # Aligned inversions
|
| 83 |
+
│ │ ├── ldm/ # Latent Diffusion Model
|
| 84 |
+
│ │ ├── sd21_inpainted_*/
|
| 85 |
+
│ │ └── lsun_inpaint_*/
|
| 86 |
+
│ ├── val/ # Validation data
|
| 87 |
+
│ │ ├── real/
|
| 88 |
+
│ │ └── fake/
|
| 89 |
+
│ ├── test/ # Test data
|
| 90 |
+
│ │ ├── real/
|
| 91 |
+
│ │ │ └── redcaps/ # RedCaps dataset
|
| 92 |
+
│ │ └── fake/ # Various generators
|
| 93 |
+
│ └── test_processed/ # Processed test data
|
| 94 |
+
│ ├── real/
|
| 95 |
+
│ └── fake/
|
| 96 |
+
├── pretrained/ # Pretrained model weights
|
| 97 |
+
│ ├── DRCT-2M/
|
| 98 |
+
│ ├── GenImage/
|
| 99 |
+
│ ├── aide/
|
| 100 |
+
│ ├── bfree/
|
| 101 |
+
│ ├── c2pclip/
|
| 102 |
+
│ ├── clipdet/
|
| 103 |
+
│ ├── dda/
|
| 104 |
+
│ ├── npr/
|
| 105 |
+
│ ├── rine/
|
| 106 |
+
│ ├── safe/
|
| 107 |
+
│ └── ufd/
|
| 108 |
+
├── pipelines/ # Training/evaluation pipelines
|
| 109 |
+
│ ├── aeroblade.py
|
| 110 |
+
│ ├── aide.py
|
| 111 |
+
│ ├── bfree.py
|
| 112 |
+
│ ├── c2pclip.py
|
| 113 |
+
│ ├── clipdet.py
|
| 114 |
+
│ ├── corvi.py
|
| 115 |
+
│ ├── corvi_plus.py
|
| 116 |
+
│ ├── corvi_mask_gated.py
|
| 117 |
+
│ ├── dda.py
|
| 118 |
+
│ ├── drct.py
|
| 119 |
+
│ ├── npr.py
|
| 120 |
+
│ ├── rajan.py
|
| 121 |
+
│ ├── rajan_plus.py
|
| 122 |
+
│ ├── rajan_mask_gated.py
|
| 123 |
+
│ ├── rine.py
|
| 124 |
+
│ ├── safe.py
|
| 125 |
+
│ ├── ufd.py
|
| 126 |
+
│ └── warpad.py
|
| 127 |
+
├── results/ # Experiment results
|
| 128 |
+
│ ├── corvi/
|
| 129 |
+
│ ├── corvi_plus/
|
| 130 |
+
│ ├── corvi_mask_gated_*/
|
| 131 |
+
│ ├── rajan/
|
| 132 |
+
│ ├── rajan_plus/
|
| 133 |
+
│ ├── rajan_mask_gated_*/
|
| 134 |
+
│ └── ...
|
| 135 |
+
├── scripts/ # Utility scripts
|
| 136 |
+
│ ├── eval.py
|
| 137 |
+
│ ├── analyze_results.py
|
| 138 |
+
│ ├── analyze_results_v2.py
|
| 139 |
+
│ └── analyze_results.sh
|
| 140 |
+
├── notebooks/ # Jupyter notebooks
|
| 141 |
+
│ ├── figures/ # Figure generation
|
| 142 |
+
│ ├── captum/ # Interpretability
|
| 143 |
+
│ └── ...
|
| 144 |
+
├── requirements.txt # Python dependencies
|
| 145 |
+
└── setup.py # Package setup
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
## Supported Detectors
|
| 149 |
+
|
| 150 |
+
### Frequency-based Methods
|
| 151 |
+
- **DRCT**: Dual-Residual ConvNeXt Transformer
|
| 152 |
+
- **RINE**: Reconstruction-based detection
|
| 153 |
+
- **SAFE**: Spectral Analysis for Fake Evidence
|
| 154 |
+
|
| 155 |
+
### Gradient-based Methods
|
| 156 |
+
- **Corvi**: Core visual features detector
|
| 157 |
+
- **Corvi+**: Enhanced Corvi with additional processing
|
| 158 |
+
- **Rajan**: Gradient-based detector
|
| 159 |
+
- **Rajan+**: Enhanced Rajan detector
|
| 160 |
+
|
| 161 |
+
### Masked/Gated Methods
|
| 162 |
+
- **Corvi Mask Gated**: Corvi with attention gating
|
| 163 |
+
- **Rajan Mask Gated**: Rajan with attention gating
|
| 164 |
+
|
| 165 |
+
### CLIP-based Methods
|
| 166 |
+
- **AIDE**: CLIP-based detector
|
| 167 |
+
- **C2P-CLIP**: Contrastive-to-Positive CLIP
|
| 168 |
+
- **CLIPDet**: CLIP-based detection
|
| 169 |
+
- **UFD**: Universal Fake Detector
|
| 170 |
+
|
| 171 |
+
### Other Methods
|
| 172 |
+
- **Aeroblade**: Aerospace-inspired detector
|
| 173 |
+
- **BFree**: Boundary-free detector
|
| 174 |
+
- **DDA**: Domain Discriminative Attention
|
| 175 |
+
- **NPR**: Neural Pattern Recognition
|
| 176 |
+
- **WarpAD**: Warping-based Anomaly Detection
|
| 177 |
+
|
| 178 |
+
## Dataset Information
|
| 179 |
+
|
| 180 |
+
### Training Data
|
| 181 |
+
- **Real Images**: COCO, LSUN
|
| 182 |
+
- **Fake Images**:
|
| 183 |
+
- Aligned inversions (Rajan method)
|
| 184 |
+
- Latent Diffusion Model (LDM) generations
|
| 185 |
+
- Stable Diffusion v2.1 inpainted images
|
| 186 |
+
- LSUN inpainted images
|
| 187 |
+
|
| 188 |
+
### Test Data
|
| 189 |
+
- **Real Images**: RedCaps dataset
|
| 190 |
+
- **Fake Images** (12 generators):
|
| 191 |
+
- Stable Diffusion (SD)
|
| 192 |
+
- Midjourney
|
| 193 |
+
- Kandinsky
|
| 194 |
+
- Playground
|
| 195 |
+
- PixelArt
|
| 196 |
+
- LCM
|
| 197 |
+
- Flux
|
| 198 |
+
- Wuerstchen
|
| 199 |
+
- Amused
|
| 200 |
+
- Chameleon
|
| 201 |
+
- Loki
|
| 202 |
+
- WildRF
|
| 203 |
+
|
| 204 |
+
### Data Processing
|
| 205 |
+
- **test**: Original test images
|
| 206 |
+
- **test_processed**: Images with perturbations (JPEG, WebP, resize)
|
| 207 |
+
|
| 208 |
+
## Key Features
|
| 209 |
+
|
| 210 |
+
- **Unified Interface**: Consistent API for all detectors
|
| 211 |
+
- **Hydra Configuration**: Flexible experiment management
|
| 212 |
+
- **Comprehensive Evaluation**: Multiple metrics (AP, ACC)
|
| 213 |
+
- **Perturbation Testing**: Robustness evaluation with various image processing
|
| 214 |
+
- **Modular Design**: Easy to add new detectors and datasets
|
| 215 |
+
- **Reproducible**: Configuration-based experiments
|
| 216 |
+
|
| 217 |
+
## Usage Example
|
| 218 |
+
|
| 219 |
+
```bash
|
| 220 |
+
# Train a detector
|
| 221 |
+
python pipelines/corvi.py
|
| 222 |
+
|
| 223 |
+
# Evaluate on test set
|
| 224 |
+
python scripts/eval.py --method corvi --test_dir test
|
| 225 |
+
|
| 226 |
+
# Analyze results
|
| 227 |
+
python scripts/analyze_results.py --methods corvi rajan --test_dirs test test_processed
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
## Citation
|
| 231 |
+
|
| 232 |
+
This library aggregates multiple AI-generated image detection methods for research purposes. Please cite the original papers when using specific detectors.
|