Skip to content

Yingjian-Chen/ForgeLens

Repository files navigation

ForgeLens: Data-Efficient Forgery Focus for Generalizable Forgery Image Detection [ICCV 2025]

Static Badge

ForgeLens is a data-efficient, feature-guided CLIP-ViT framework for detecting AI-generated images with strong generalization to unseen forgery techniques. It guides the frozen CLIP-ViT to focus on forgery-relevant information within the general-purpose features it extracts, addressing a key limitation of prior frozen-network-based methods, which often retain excessive forgery-irrelevant content. ForgeLens introduces two simple and lightweight modules—WSGM and FAFormer—to guide the model’s attention toward forgery-specific cues. With only 1% of the training data, ForgeLens outperforms existing forgery detection methods.

⚙️ Environment Setup

To ensure reproducibility and avoid compatibility issues, we recommend setting up the required environment by installing the necessary packages using the following command:

pip install -r requirements.txt

📦 Get the Required Dataset

Training dataset we utilize ProGAN training set to train our network following CNNDetection.

Evaluation dataset In order to fully evaluate ForgeLens, we conducted tests on the UniversalFakeDetect dataset.

🔽 Preprocessed Version (Recommended) You can also directly download our pre-split dataset, which includes three training settings:

  • 1️⃣Setting-1 (1,600 samples)
  • 2️⃣Setting-2 (50% of the full training set)
  • 3️⃣Setting-3 (100% of the full training set)

👉 📁 Download Link.

📂 Dataset Split

We adopt a binary classification setting for all datasets, where:

  • 0: real image
  • 1: fake/generated image

Training Set

We use a subset of ProGAN data for training:

Training/
├── car/
│   ├── 0_real/        # Real images
│   └── 1_fake/        # ProGAN-generated fake images
├── cat/
│   ├── 0_real/        
│   └── 1_fake/        
├── chair/
│   ├── 0_real/        
│   └── 1_fake/        
└── horse/
    ├── 0_real/        
    └── 1_fake/        

Evaluation Set

Our method is evaluated on UniversalFakeDetect, using the same folder structure as the training set.

🛠️ Configuration

You can manage the hyperparameters in ./options/options.py.

🧠 Training

You can perform training using the following command:

bash train_setting_1.sh   # reproduce the results of training setting 1
bash train_setting_2.sh   
bash train_setting_3.sh   

🚀 Quick Reproducing

We provide pretrained weights corresponding to the results reported in our paper.

📦 Pretrained Weights

Training Setting Description Google Drive Link Baidu Netdisk Link
training_setting_1 1,600 samples (Recommended) Download Download
training_setting_2 50% of full training data Download Download
training_setting_3 100% of full training data Download Download

To reproduce the results of Table 1 and Table 2 in our paper, first download the pretrained weights, then run the evaluation script as follows:

bash evaluate.sh

🔄 Update (2025-09-15): Evaluation on GenImage

1. Dataset Download

Download the GenImage dataset from the official source or download our pre-split dataset.

2. Quick Evaluation with Our Provided Checkpoint

First download the pretrained weights from Google Drive of Baidu Netdisk, then run the evaluation script as follows:

bash evaluate_GenImage.sh

3. Training

You can perform training using the following command:

bash train_GenImage.sh

📌 Citation

If you find our project helpful, please feel free to leave a ⭐ and cite our paper:

@InProceedings{Chen_2025_ICCV,
    author    = {Chen, Yingjian and Zhang, Lei and Niu, Yakun},
    title     = {ForgeLens: Data-Efficient Forgery Focus for Generalizable Forgery Image Detection},
    booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
    month     = {October},
    year      = {2025},
    pages     = {16270-16280}
}

About

Official Implementation of ICCV 2025 paper "ForgeLens: Data-Efficient Forgery Focus for Generalizable Forgery Image Detection"

Resources

Stars

Watchers

Forks

Contributors