### Install PyTorch and torchvision Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Installs the required deep learning libraries using pip. Run after cloning the repository. ```bash pip install torch torchvision ``` -------------------------------- ### Clone and enter the UniversalFakeDetect repository Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Clones the GitHub repository and changes into the project directory. Run this first to set up the project locally. ```bash git clone https://github.com/Yuheng-Li/UniversalFakeDetect cd UniversalFakeDetect ``` -------------------------------- ### Dataset directory structure after unzipping Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Shows the expected directory layout under 'datasets/test' after downloading and unzipping the dataset. Each model directory (e.g., progan) contains '0_real' and '1_fake' subfolders. ```text datasets └── test ├── progan │── cyclegan │── biggan │ . │ . ``` -------------------------------- ### Evaluate on all datasets Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Runs validation on all test domains. Requires a checkpoint file and an output folder. The results are saved in the results folder. ```bash python validate.py --arch=CLIP:ViT-L/14 --ckpt=pretrained_weights/fc_weights.pth --result_folder=clip_vitl14 ``` -------------------------------- ### Dataset directory structure Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Shows the expected layout of the training dataset under the datasets/train directory. Each category folder contains real and fake images in 0_real and 1_fake subfolders. ```text datasets └── train └── progan ├── airplane │── bird │── boat │ . │ . ``` -------------------------------- ### Train the model Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Trains the model on the Wang2020 dataset. The --fix_backbone argument is required to train only the linear layer parameters. ```bash python train.py --name=clip_vitl14 --wang2020_data_path=datasets/ --data_mode=wang2020 --arch=CLIP:ViT-L/14 --fix_backbone ``` -------------------------------- ### Evaluate on a specific generative model Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Evaluates on a single generative model by specifying the real and fake dataset paths. The results are saved in the results folder. ```bash python validate.py --arch=CLIP:ViT-L/14 --ckpt=pretrained_weights/fc_weights.pth --result_folder=clip_vitl14 --real_path datasets/test/progan/0_real --fake_path datasets/test/progan/1_fake ``` -------------------------------- ### BibTeX citation for UniversalFakeDetect paper Source: https://github.com/yuheng-li/universalfakedetect/blob/main/README.md Use this BibTeX entry to cite the UniversalFakeDetect paper in academic publications. It includes the paper title, authors, and venue (CVPR 2023). ```bibtex @inproceedings{ojha2023fakedetect, title={Towards Universal Fake Image Detectors that Generalize Across Generative Models}, author={Ojha, Utkarsh and Li, Yuheng and Lee, Yong Jae}, booktitle={CVPR}, year={2023}, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.