Official implementation of VideoShield: Regulating Diffusion-based Video Generation Models via Watermarking.
Watermarked | Tampered | GT Mask | Pred Mask |
---|---|---|---|
Watermarked | Tampered | GT Mask | Pred Mask |
---|---|---|---|
pip install -r requirements.txt
Download the video model to your preferred directory.
- The text-to-video (T2V) model ModelScope can be downloaded from: https://huggingface.co/ali-vilab/text-to-video-ms-1.7b.
- The image-to-video (I2V) model Stable-Video-Diffusion can be download from: https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt.
- For ModelScope:
python3 watermark_embedding_and_extraction.py \
--device 'cuda:0' \
--model_name modelscope \
--model_path <your_model_path> \
--num_frames 16 \
--height 256 \
--width 256 \
--frames_copy 8 \
--hw_copy 4 \
--channel_copy 1 \
--num_inference_steps 25
- For Stable-Video-Diffusion:
python3 watermark_embedding_and_extraction.py \
--device 'cuda:0' \
--model_name stable-video-diffusion \
--model_path <your_model_path> \
--num_frames 16 \
--height 512 \
--width 512 \
--frames_copy 8 \
--hw_copy 8 \
--channel_copy 1 \
--num_inference_steps 25
Note:
- You can also skip specifying --model_path (skip Model Download). The script will automatically download the model to the default cache directory.
- The generated watermarked video and watermark information will be saved in the ./results directory by default.
- For ModelScope:
python3 temporal_tamper_localization.py \
--device 'cuda:0' \
--model_name modelscope \
--model_path <your_model_path> \
--num_inversion_steps 25 \
--video_frames_dir './results/modelscope/a_red_panda_eating_leaves/wm/frames'
- For Stable-Video-Diffusion:
python3 temporal_tamper_localization.py \
--device 'cuda:0' \
--model_name stable-video-diffusion \
--model_path <your_model_path> \
--num_inversion_steps 25 \
--video_frames_dir './results/modelscope/a_red_panda_eating_leaves/wm/frames'
Note:
- Default video frames directory: './results/stable-video-diffusion/a_red_panda_eating_leaves/wm/frames' (can be modified as needed)
- For ModelScope:
python3 spatial_tamper_localization.py \
--device 'cuda:0' \
--model_name modelscope \
--model_path <your_model_path> \
--num_inversion_steps 25 \
--video_frames_dir './results/modelscope/a_red_panda_eating_leaves/wm/frames'
- For Stable-Video-Diffusion:
python3 spatial_tamper_localization.py \
--device 'cuda:0' \
--model_name stable-video-diffusion \
--model_path <your_model_path> \
--num_inversion_steps 25 \
--video_frames_dir './results/modelscope/a_red_panda_eating_leaves/wm/frames'
Note:
- Default video frames directory: './results/stable-video-diffusion/a_red_panda_eating_leaves/wm/frames' (can be modified as needed)
- The tampered watermarked video, gt mask and pred mask will be saved in the ./results directory by default.
This code builds on the code from the GaussianShading.
If you find this repository useful, please consider giving a star ⭐ and please cite as:
@inproceedings{hu2025videoshield,
title={VideoShield: Regulating Diffusion-based Video Generation Models via Watermarking},
author={Runyi Hu and Jie Zhang and Yiming Li and Jiwei Li and Qing Guo and Han Qiu and Tianwei Zhang},
booktitle={International Conference on Learning Representations (ICLR)},
year={2025}
}