📌 Paper: Harnessing Frequency Spectrum Insights for Image Copyright Protection Against Diffusion Model
📖 Conference: CVPR 2025
CoprGuard
└── Source/
├── FFHQ/
├── CelebA-HQ/
├── BigGAN/
├── ...
└── Vggface/
└── HiNet/
├── FFHQ/
├── CelebA-HQ/
├── BigGAN/
├── ...
└── Vggface/
└── Generated/
├── FFHQ_DDIM/
├── BigGAN_DDIM/
├── ...
└── FFHQ_HiNet_DDIM/# Clone the repository
git https://github.com/sccsok/CoprGuard.git
cd your-repo
# Create a virtual environment (optional) & install dependencies
conda env create -f environment.yml-
Watermarking
Download the pretrained HiNet and put it in
~/CoprGuard/watermark/ckpt.Watermarking training images:
# For unconditional training images python wm.py --root_dir <> --watermark_path <> --save_dir <>
-
Generate Figure 6
Compute consine similarity scores:
python get_cos.py
Plot cosine similarity distribution:
python plt.py
-
Prepare Dataset
Please prepare the training dataset according to the Dataset Preparation format. -
DDPM Train
Run the training scripts under
ddim/scripts:cd ~/CoprGuard/ddim python scripts/xxx.py
-
Image Sampling
Use the DDPM or DDIM scheduler for image sampling:
python ddim/scripts/inference.py
-
Classifier-Free Training
The
ddimfolder can be easily modified to support Classifier-Free Guidance. You can also refer to the following repository: classifier-free-diffusion-guidance-Pytorch
-
Generate Figure 1 & Figure 2 & Figure 10
cd ~/CoprGuard/frequence python frequency_analysis.py ~/CoprGuard/Source $WORKDIR/output <fft_hp/dct/...> --img-dirs <FFHQ BIgGAN ProGAN ImageNet> --log --vmin 1e-5 --vmax 1e-1 python frequency_analysis.py ~/CoprGuard/Generated $WORKDIR/output <fft_hp/dct/...> --img-dirs <FFHQ BIgGAN ProGAN ImageNet> ImageNet_DDIM --log --vmin 1e-5 --vmax 1e-1
-
Generate Table 1
cd ~/CoprGuard/frequence python get_cos.py --type <fft/dct/...> --models1 <[FFHQ, xxx, ...]> --models2 <[FFHQ_DDIM, xxx, ...]>
-
Generate Figure 3
cd ~/CoprGuard/frequence get_rapsd.ipynb
-
Generate Table 3
cd ~/CoprGuard/watermark python similarity_compute.py --mode folder --folder <> --watermark <> --resize 128 128
If you find our work useful, please consider citing:
@inproceedings{liu2025harnessing,
title={Harnessing Frequency Spectrum Insights for Image Copyright Protection Against Diffusion Models},
author={Liu, Zhenguang and Shuai, Chao and Fan, Shaojing and Dong, Ziping and Hu, Jinwu and Ba, Zhongjie and Ren, Kui},
booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
pages={18653--18662},
year={2025}
}Our implementation benefits from the following open-source projects:
We sincerely thank the authors for their great work.
