kd_backup / README.md
leekwoon's picture
Upload README.md with huggingface_hub
0ddc865 verified
# 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.