The code requires Python 3.10.13 and the packages listed in requirements.txt. Install them with:
pip install -r requirements.txtNote: To run T2SMark on Stable Diffusion v3.5 Medium, upgrade
diffusersfrom0.21.4to0.32.0. Otherwise,StableDiffusion3Pipelinewill not be supported.
python run.py --name testpython run_sd35.py --name test_sd35The --name argument is required. For additional options, see option.py.
Our code includes built-in evaluation of TPR, bit accuracy, and CLIP score. For LPIPS and FID metrics, we recommend using the following repositories:
- LPIPS score: https://github.com/richzhang/PerceptualSimilarity.git
- FID: https://github.com/mseitzer/pytorch-fid.git
Note: The COCO prompts and ground-truth images used in our experiments are available here, sourced from the Tree-Ring Watermark repository.
The code for all baseline methods is provided below:
- DwtDct, DwtDctSvd, RivaGan: https://github.com/ShieldMnt/invisible-watermark.git
- Stable Signature: https://github.com/facebookresearch/stable_signature.git
- Tree-Ring Watermark: https://github.com/YuxinWenRick/tree-ring-watermark.git
- Gaussian Shading: https://github.com/bsmhmmlf/Gaussian-Shading.git
- PRC-Watermark: https://github.com/XuandongZhao/PRC-Watermark.git
T2SMark focuses on watermark design, while FARI focuses on fast and robust watermark recovery. If you are interested in inversion-based verification for diffusion watermarking, check out FARI: Robust One-Step Inversion for Watermarking in Diffusion Models.
We borrow the code from Tree-Ring Watermark and Gaussian Shading. We appreciate the authors for sharing their code.
If our work assists your research, feel free to give us a star ⭐ or cite us using:
@inproceedings{yang2025t2smark,
author = {Yang, Jindong and Fang, Han and Zhang, Weiming and Yu, Nenghai and Chen, Kejiang},
booktitle = {Advances in Neural Information Processing Systems},
title = {T2SMark: Balancing Robustness and Diversity in Noise-as-Watermark for Diffusion Models},
pages = {118642--118668},
volume = {38},
year = {2025}
}