Skip to content

HorizonTEL/DGS-Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


DGS-Net: Distillation-Guided Gradient Surgery for CLIP Fine-Tuning in AI-Generated Image Detection

Jiazhen Yan1, Ziqiang Li1, Fan Wang2, Boyu Wang1, Ziwen He1, Zhangjie Fu1‑

‑Corresponding author

1School of Computer Science, Nanjing University of Information Science and Technology 2University of Macau

backbone

πŸ“° News

  • [2026-05-01]πŸŽ‰πŸŽ‰πŸŽ‰ DGS-Net is accepted by ICML 2026 Spotlight

πŸ”₯ Todo List

  • Inference code
  • Pretrained models
  • Training code

πŸš€ Quick Start

1. Installation

conda create -n DGS-Net -y python=3.10

conda activate DGS-Net
pip3 install torch torchvision
pip install -r requirements.txt 

2.Getting datasets

Datasets Paper Url
UniversalFakeDetect Towards Universal Fake Image Detectors that Generalize Across Generative Models (CVPR 2023) Google Drive
AIGCDetectBench PatchCraft: Exploring Texture Patch for Efficient AI-generated Image Detection ModelScope
AIGIBench Is Artificial Intelligence Generated Image Detection a Solved Problem? (NeurIPS 2025) Huggingface/Baidu Netdisk

3.Download Weights

Place them under checkpoints/: Google Drive

4.Inference

Of course, you need to change [DetectionTests] in test.py when testing.

We also present our inference results in log_test.log. [Note]: Following re-inference, we observed an approximately 0.1 discrepancy relative to the original result. The file log_test.log contains the results obtained after re-inference.

python test.py --model_path ./checkpoints/model_epoch_step2.pth

⏳ Training

The training set uses ProGAN & SDv1.4 from AIGIBench (Is Artificial Intelligence Generated Image Detection a Solved Problem?, NeurIPS 2025) Huggingface/Baidu Netdisk.

stage 1: python train.py --name  5class-car-cat-chair-horse-sdv1.4 --dataroot /home/HDD/yjz/dataset/AIGIBench/train  --classes  car,cat,chair,horse,sdv1.4 --train_stage 0 --niter 3
stage 2: python train.py --name  5class-car-cat-chair-horse-sdv1.4 --dataroot /home/HDD/yjz/dataset/AIGIBench/train  --classes  car,cat,chair,horse,sdv1.4 --train_stage 1 --niter 1

During the stage 2 of training, it is necessary to change the model_path of stage 1 in models/clip_models: self.clip_model_frozen.load_state_dict(torch.load("/path/checkpoints/model_epoch_stage1.pth"), strict=True)

πŸ“š Citation

@article{yan2025dgs,
  title={DGS-Net: Distillation-Guided Gradient Surgery for CLIP Fine-Tuning in AI-Generated Image Detection},
  author={Yan, Jiazhen and Li, Ziqiang and Wang, Fan and Wang, Boyu and He, Ziwen and Fu, Zhangjie},
  journal={arXiv preprint arXiv:2511.13108},
  year={2025}
}

πŸ“¬ Contact

If you have any question about this project, please feel free to contact 247918horizon@gmail.com

About

Official implementation of ICML 2026 Spotlight πŸ† paper "DGS-Net: Distillation-Guided Gradient Surgery for CLIP Fine-Tuning in AI-Generated Image Detection".

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages