Qafig's picture
Upload folder using huggingface_hub
8720f73 verified
Quick start for your REAL vs FAKE dataset
=========================================
Your dataset structure (what this patch expects):
<DATASET_ROOT>/
train/
real/
fake/
test/
real/
fake/
What was changed:
1) data/datasets.py
- Validation now reads from "test" (instead of "test/progan").
- The loader looks for folder names containing "real" and "fake" (instead of "0_real" and "1_fake").
2) models/__init__.py
- Pretrained model names now use Hugging Face IDs so they auto-download (no internal file paths needed).
Environment (example):
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install transformers loralib tensorboardX scikit-image opencv-python scikit-learn pillow tqdm
Train example (single GPU):
cd UniversalFakeDetect_Benchmark
python train.py \
--name clip_vitl14_svd \
--wang2020_data_path <DATASET_ROOT> \
--data_mode wang2020 \
--arch "CLIP:ViT-L/14_svd" \
--batch_size 32 \
--loadSize 256 \
--cropSize 224 \
--lr 2e-4 \
--use_svd
Notes:
- Checkpoints and logs will go under: checkpoints/<run name>/
- For CPU-only training (slow), add: --gpu_ids -1
- You can try other backbones by setting --arch to one of:
"CLIP:ViT-B/16_svd", "CLIP:ViT-B/32_svd", "CLIP:ViT-L/14_svd",
"SigLIP:ViT-L/16_256_svd", "BEiTv2:ViT-L/16_svd"
- To disable extra augmentations, do NOT pass --data_aug (or remove it if present).
Validation:
The training script automatically builds a validation loader with data_label='val'
and (with this patch) points it to <DATASET_ROOT>/test.
In case you prefer ZERO code changes:
- Keep the original repo, but rename your folders to:
train/0_real, train/1_fake, test/progan/0_real, test/progan/1_fake
Then you can run the unpatched code with --data_mode wang2020.