Official PyTorch implementation of LFM (BMVC 2025). This repository contains training and evaluation code for our paper "A Novel Local Focusing Mechanism for Deepfake Detection Generalization" accepted at BMVC 2025.
- NVIDIA GPU + CUDA cuDNN
- Python 3.10
- PyTorch 2.6+
# Clone repository
git clone https://github.com/lmlpy/LFM.git
cd LFM
# Create and activate conda environment
conda create -n LFM python=3.10.16
conda activate LFM
# Install dependencies
pip install -r requirements.txt| paper | Url | |
|---|---|---|
| Train set | CNNDetection CVPR2020 | Baidudrive |
| Val set | CNNDetection CVPR2020 | Baidudrive |
| Table1 Test | CNNDetection CVPR2020 | Baidudrive |
| Table2 Test | FreqNet AAAI2024 | googledrive |
| Table3 Test | DIRE ICCV2023 | googledrive |
| Table4 Test | UniversalFakeDetect CVPR2023 | googledrive |
| Table5 Test | NPR CVPR2024 | googledrive |
Click to expand the folder tree structure.
datasets
|-- ForenSynths_train_val
| |-- train
| | |-- car
| | |-- cat
| | |-- chair
| | `-- horse
| `-- val
| | |-- car
| | |-- cat
| | |-- chair
| | `-- horse
| |-- test
| |-- biggan
| |-- cyclegan
| |-- deepfake
| |-- gaugan
| |-- progan
| |-- stargan
| |-- stylegan
| `-- stylegan2
`-- Generalization_Test
|-- ForenSynths_test # Table1
| |-- biggan
| |-- cyclegan
| |-- deepfake
| |-- gaugan
| |-- progan
| |-- stargan
| |-- stylegan
| `-- stylegan2
|-- GANGen-Detection # Table2
| |-- AttGAN
| |-- BEGAN
| |-- CramerGAN
| |-- InfoMaxGAN
| |-- MMDGAN
| |-- RelGAN
| |-- S3GAN
| |-- SNGAN
| `-- STGAN
|-- DiffusionForensics # Table3
| |-- adm
| |-- ddpm
| |-- iddpm
| |-- ldm
| |-- pndm
| |-- sdv1_new
| |-- sdv2
| `-- vqdiffusion
`-- UniversalFakeDetect # Table4
| |-- dalle
| |-- glide_100_10
| |-- glide_100_27
| |-- glide_50_27
| |-- guided # Also known as ADM.
| |-- ldm_100
| |-- ldm_200
| `-- ldm_200_cfg
|-- Diffusion1kStep # Table5
|-- DALLE
|-- ddpm
|-- guided-diffusion # Also known as ADM.
|-- improved-diffusion # Also known as IDDPM.
`-- midjourney
python train.py --name lfm --dataroot ./datasets/ForenSynths_train_val --classes car,cat,chair,horse \
--batch_size 32 --delr_freq 10 --lr 0.0001 --niter 50python test.py --model_path ./weights/bs_model.pth --batch_size 32This repository borrows partially from the NPR.
If you find this repository useful for your research, please consider citing:
@misc{li2025novellocalfocusingmechanism,
title={A Novel Local Focusing Mechanism for Deepfake Detection Generalization},
author={Mingliang Li and Lin Yuanbo Wu and Changhong Liu and Hanxi Li},
year={2025},
eprint={2508.17029},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2508.17029},
}