IRF-Net: A Retinex-Guided Framework with Auxiliary Local Spectral Response Reconstruction for Generalizable AI-Generated Image Detection
Dengtai Tan*, Jing Wang*, Shujie Yang, Deyi Yang
Gansu University of Political Science and Law, Lanzhou, China
* Equal contribution
IRF-Net is a generated image detection framework that integrates:
- Retinex-based illumination–reflectance decomposition — reduces illumination interference and produces a DCT-domain multi-channel reflectance representation (48 channels from 4×4 local DCT blocks).
- Auxiliary Local Spectral Response (LSR) reconstruction — the decoder reconstructs LSR maps derived from block-wise DCT coefficients, guiding the shared encoder to preserve fine-grained spectral response information.
- Joint encoder–decoder architecture — classification and LSR reconstruction are jointly optimized with (L_{total} = L_{cls} + \lambda_{rec} L_{LSR}) ((\lambda_{rec}=0.01)).
The reconstructed LSR maps provide observable auxiliary evidence for comparing response distributions between real and generated images.
| Method | ProGAN | StyleGAN | StyleGAN2 | BigGAN | CycleGAN | StarGAN | GauGAN | Deepfake | Mean |
|---|---|---|---|---|---|---|---|---|---|
| CNNDetect | 91.4/99.4 | 63.8/91.4 | 76.4/97.5 | 52.9/73.3 | 72.7/88.6 | 63.8/90.8 | 63.9/92.2 | 51.7/62.3 | 67.1/86.9 |
| NPR | 99.8/100.0 | 96.3/99.8 | 97.3/100.0 | 87.5/94.5 | 95.0/99.5 | 99.7/100.0 | 86.6/88.8 | 77.4/86.2 | 92.5/96.1 |
| IRF-Net | 99.2/100.0 | 97.6/100.0 | 98.5/100.0 | 87.9/95.8 | 93.8/97.4 | 99.9/100.0 | 88.4/93.3 | 79.0/89.5 | 94.3/97.6 |
| Setting | Midjourney | SDv1.4 | SDv1.5 | ADM | Glide | Wukong | VQDM | BigGAN | Mean |
|---|---|---|---|---|---|---|---|---|---|
| IRF-Net (256×256 crop) | 84.5/94.9 | 82.1/92.3 | 81.4/91.9 | 85.0/93.9 | 82.9/94.8 | 77.7/88.7 | 79.7/86.0 | 83.4/91.2 | 82.1/91.7 |
| IRF-Net (full) | 97.3/99.7 | 91.9/98.5 | 91.9/98.3 | 93.8/99.2 | 90.9/98.2 | 89.9/97.9 | 87.6/97.4 | 89.7/97.5 | 91.6/98.3 |
| Method | Outdoor | People | Animals | Vehicles | Food | Complex | Avg |
|---|---|---|---|---|---|---|---|
| NPR | 71.64 | 73.54 | 66.68 | 71.09 | 70.89 | 74.15 | 71.33 |
| IRF-Net | 96.40 | 96.90 | 96.00 | 97.80 | 95.90 | 95.80 | 96.47 |
git clone https://github.com/wangjing222-hue/IRF-Net.git
cd IRF-Net
pip install -r requirements.txt| Dataset | Description | Link |
|---|---|---|
| ForenSynths | Training: ProGAN; Test: 8 unseen GANs | GitHub |
| GenImage | 8 diffusion-model generators | GitHub |
| CSAIID | Cross-semantic benchmark | Cai et al., ICCV Workshops 2025 |
Organize each dataset as follows:
dataset_root/
0_real/
image001.jpg
...
1_fake/
image001.jpg
...
python train.py \
--train_dir /path/to/ForenSynths/train \
--test_dir /path/to/ForenSynths/test \
--epochs 20 \
--batch_size 32 \
--lr 3e-4 \
--recon_weight 0.01 \
--output_dir ./checkpointsKey arguments:
| Argument | Default | Description |
|---|---|---|
--train_dir |
— | Path to training dataset |
--test_dir |
— | Path to test dataset |
--epochs |
20 | Number of training epochs |
--batch_size |
32 | Batch size |
--lr |
3e-4 | Learning rate (AdamW, weight decay 1e-4) |
--recon_weight |
0.01 | Weight λ_rec for LSR reconstruction loss |
--output_dir |
./checkpoints | Directory to save checkpoints |
python test.py \
--model_path checkpoints/best_model.pth \
--test_dir /path/to/test \
--batch_size 32Output includes:
- Accuracy and Average Precision (AP) for classification
- MSE, PSNR, SSIM for LSR map reconstruction quality
For GenImage full-resolution evaluation, process images at their original resolution without fixed-size cropping.
IRF-Net/
├── README.md
├── requirements.txt
├── train.py # Training entry point
├── test.py # Evaluation entry point
├── models/
│ └── densenet.py # DenseResNet encoder, LSR decoder, ECA, DenseBlock
├── utils/
│ ├── dct.py # FastDCT, ConvDct_torch
│ ├── retinex.py # DCT-domain RetinexProcessor
│ └── lsr_map.py # LSRMapLayer (target LSR map computation)
└── datasets/
└── dataset.py # ForenSynthsDataset
If you find this work useful, please cite:
@article{tan2025irfnet,
title = {IRF-Net: A Retinex-Guided Framework with Auxiliary Local Spectral
Response Reconstruction for Generalizable AI-Generated Image Detection},
author = {Tan, Dengtai and Wang, Jing and Yang, Shujie and Yang, Deyi},
journal = {Engineering Applications of Artificial Intelligence},
year = {2025}
}This project is released under the MIT License.