Upload README.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232# 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_backupmd5sum -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 detectorpython pipelines/corvi.py
# Evaluate on test setpython scripts/eval.py --method corvi --test_dir test
# Analyze resultspython 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.README.mdAdded+232