Home

Awesome

Identifying and Solving Conditional Image Leakage in Image-to-Video Diffusion Model

<!-- ![](./assets/logo_long.png#gh-light-mode-only){: width="50%"} --> <!-- ![](./assets/logo_long_dark.png#gh-dark-mode-only=100x20) --> <div align="center">

<a href='https://arxiv.org/abs/2406.15735'><img src='https://img.shields.io/badge/arXiv-2406.15735-b31b1b.svg'></a>   <a href='https://cond-image-leak.github.io/'><img src='https://img.shields.io/badge/Project-Page-Green'></a>   <a href='https://zhuanlan.zhihu.com/p/705300028?utm_campaign=shareopn&utm_medium=social&utm_psn=1788953432507416577&utm_source=wechat_session'><img src='https://img.shields.io/badge/Zhihu-Page-Blue'></a>   <a href='https://huggingface.co/spaces/Xiang-cd/DynamiCrafter-CIL'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20DynamiCrafter%20CIL%20Hugging%20Face%20I2V-Demo-blue'></a> 

Min Zhao, Hongzhou Zhu, Chendong Xiang, Kaiwen Zheng, Chongxuan Li, Jun Zhu

</div>

🔆 Overview

Diffusion models have obtained substantial progress in image-to-video (I2V) generation. However, such models are not fully understood. In this paper, we report a significant but previously overlooked issue in I2V diffusion models (I2V-DMs), namely, conditional image leakage. I2V-DMs tend to over-rely on the conditional image at large time steps, neglecting the crucial task of predicting the clean video from noisy inputs, which results in videos lacking dynamic and vivid motion. We further address this challenge from both inference and training aspects by presenting plug-and-play strategies accordingly. These strategies are validated on various I2V-DMs including DynamiCrafter, SVD and VideoCrafter1.

overview

✅ To do list:

⚙️ Setup Environment

Our plug-and-play strategies can be applied to various I2V-DMs, allowing the direct use of their original environments. For example, to set up DynamiCrafter:

cd examples/DynamiCrafter
conda create -n dynamicrafter python=3.8.5
conda activate dynamicrafter
pip install -r requirements.txt

To set up VideoCrafter1:

cd examples/VideoCrafter
conda create -n videocrafter python=3.8.5
conda activate videocrafter
pip install -r requirements.txt

To set up SVD:

cd examples/SVD
conda create -n svd python=3.9.18
conda activate svd
pip install -r requirements.txt

To set up Animate-Anything:

cd examples/animate-anything
conda create -n animation python=3.10
conda activate animation
pip install -r requirements.txt

To set up PIA:

cd examples/PIA
conda env create -f pia.yml
conda activate pia

☀️ Dataset

Download the WebVid dataset from here, where we use Webvid-2M subset. Put .csv file in examples/dataset/results_2M_train.csv and video data in examples/dataset/. We use the raw data without any filters.

🧊 Inference Strategy

We clone the repo of DynamiCrafter and VideoCrafter1 and implement SVD by ourselves. We apply our plug and plug-and-play strategies on them.

🎒 Initial Noise Distribution

ModelResolutionInitial Noise
DynamiCrafter256x256Initial Noise
DynamiCrafter320x512Initial Noise
DynamiCrafter576x1024Initial Noise
VideoCrafter256x256Initial Noise
VideoCrafter320x512Initial Noise
VideoCrafter576x1024Initial Noise
SVD320 x 512Initial Noise
SVD576 x 1024Initial Noise

😄 Example Results

<table class="center"> <tr style="font-weight: bolder;text-align:center;"> <td>Model</td> <td>Conditional image</td> <td>Standard inference</td> <td>+ Our inference strategy</td> </tr> <tr> <td> DynamiCrafter320x512 </td> <td> <img src=assets/conditionalImg/15.gif width="250"> </td> <td> <img src=assets/DC/15base.gif width="250"> </td> <td> <img src=assets/DC/15_sample0.gif width="250"> </td> </tr> <tr> <td> VideoCrafter320x512 </td> <td> <img src=assets/conditionalImg/5.gif width="250"> </td> <td> <img src=assets/VC/5base.gif width="250"> </td> <td> <img src=assets/VC/5_sample0.gif width="250"> </td> </tr> <tr> <td> SVD 576x1024 </td> <td> <img src=assets/conditionalImg/39.gif width="250"> </td> <td> <img src=assets/SVD/39base.gif width="250"> </td> <td> <img src=assets/SVD/39_sample0.gif width="250"> </td> </tr> <tr> <td> Animate-Anything </td> <td> <img src='assets/animate/52img.gif' width="250"> </td> <td> <img src='assets/animate/52_1000.gif' width="250"> </td> <td> <img src='assets/animate/52.gif' width="250"> </td> <tr> <td> PIA </td> <td> <img src='assets/PIA/concert.gif' width="250"> </td> <td> <img src='assets/PIA/1000.gif' width="250"> </td> <td> <img src='assets/PIA/900.gif' width="250"> </td> </table >

DynamiCrafter

  1. Download the original DynamiCrafter checkpoints from the repository and put it in examples/DynamiCrafter/ckpt/original ,or download our DynamiCrafter-CIL from here and put it in examples/DynamiCrafter/ckpt/finetuned. Download the initial noise in the above table and put it in examples/DynamiCrafter/ckpt/.
  2. Run the following commands:
cd examples/DynamiCrafter

# for original DynamiCrafter with 320x512 resolution
sh inference_512.sh

# for our DynamiCrafter-CIL with 320x512 resolution
sh inference_CIL_512.sh

# for our DynamiCrafter-CIL with 576x1024 resolution
sh inference_CIL_1024.sh

The relevant parameters in inference.sh for our strategy are explained as follows:

Note that M=1000, whether_analytic_init=0 is the baseline.

The effect of start time M is as follows:

<table class="center"> <tr style="font-weight: bolder;text-align:center;"> <td>Conditional image</td> <td>M=1.00T</td> <td>M=0.94T</td> <td>M=0.90T</td> <td>M=0.86T</td> <td>M=0.82T</td> </tr> <tr> <td> <img src=assets/conditionalImg/sunflower.gif width="150"> </td> <td> <img src=assets/effect_of_M/1000.gif width="150"> </td> <td> <img src=assets/effect_of_M/960.gif width="150"> </td> <td> <img src=assets/effect_of_M/920.gif width="150"> </td> <td> <img src=assets/effect_of_M/880.gif width="150"> </td> <td> <img src=assets/effect_of_M/840.gif width="150"> </td> </tr> </table > An appropriate M can enhance performance by increasing motion without compromising other performance. A too-small M delivers poor visual quality due to the training-inference gap.

SVD

  1. Download the pretrained SVD model and put it in examples/SVD/ckpt/pretrained/stable-video-diffusion-img2vid . Download our SVD-CIL from here and put it in examples/SVD/ckpt/finetuned. Download the initial noise in the above table and put them in examples/SVD/ckpt/.
  2. Run the following commands:
cd examples/SVD

# for original SVD
sh inference.sh

# for SVD-CIL with 320x512 resolution
sh inference_CIL_512.sh
 

The relevant parameters for inference are set in examples/SVD/config/inference.yaml,which are explained as follows:

VideoCrafter1

  1. Download the original VideoCrafter checkpoints from the repository and put it in examples/VideoCrafter/ckpt/original,or download our VideoCrafter-CIL from here and put it in examples/VideoCrafter/ckpt/finetuned.Download the initial noise in the above table and put them in examples/VideoCrafter/ckpt.
  2. Run the following commands:
cd examples/VideoCrafter

# for original VideoCrafter with 320x512 resolution
sh inference_512.sh

# for VideoCrafter-CIL with 320x512 resolution
sh inference_CIL_512.sh

The relevant parameters in inference.sh for our strategy are explained as follows:

Animate-Anything

  1. Download the original Animate-Anything checkpoints from the repository and put it in cond-image-leakage/examples/animate-anything/output/latent/animate_anything_512_v1.02
  2. Run the following commands:
cd cond-image-leakage/examples/animate-anything
python inference.py --config example/config/concert.yaml

The relevant parameters in cond-image-leakage/examples/PIA/example/config/base.yaml for our strategy are explained as follows:

PIA

  1. Download the original Animate-Anything checkpoints from the repository and put them following cond-image-leakage/examples/PIA/README.md.
  2. Run the following commands:
cd cond-image-leakage/examples/PIA

The relevant parameters in inference.sh for our strategy are explained as follows:

🔥 Training Strategy

Similar to the inference strategy, we finetune the baselines based on the repository DynamiCrafter, VideoCrafter1 and SVD.

😄 Example Results

<table class="center"> <tr style="font-weight: bolder;text-align:center;"> <td>Model</td> <td>Conditional image</td> <td>Finetuned-Baseline</td> <td>+ Our training strategy</td> </tr> <tr> <td> DynamiCrafter </td> <td> <img src=assets/conditionalImg/6.gif width="250"> </td> <td> <img src=assets/DC/6base.gif width="250"> </td> <td> <img src=assets/DC/6_sample0.gif width="250"> </td> </tr> <tr> <td> VideoCrafter </td> <td> <img src=assets/conditionalImg/30.gif width="250"> </td> <td> <img src=assets/VC/30base.gif width="250"> </td> <td> <img src=assets/VC/30_sample0.gif width="250"> </td> </tr> <tr> <td> SVD </td> <td> <img src=assets/conditionalImg/41.gif width="250"> </td> <td> <img src=assets/SVD/41base.gif width="250"> </td> <td> <img src=assets/SVD/41_sample0.gif width="250"> </td> </tr> </table >

DynamiCrafter

  1. Download the DynamiCrafter checkpoints from the repository and put them in examples/DynamiCrafter/ckpt/original.
  2. Run the following commands:
cd examples/DynamiCrafter
sh train.sh

The relevant parameters in train.sh for our strategy are explained as follows:

The effect of beta_mis as follows:

<table class="center"> <tr style="font-weight: bolder;text-align:center;"> <td>Conditional Image</td> <td>beta_m=25</td> <td>beta_m=100</td> <td>beta_m=700</td> </tr> <tr> <td> <img src=assets/conditionalImg/doggy.jpg width="150"> </td> <td> <img src=assets/effect_of_betam/25.gif width="150"> </td> <td> <img src=assets/effect_of_betam/100.gif width="150"> </td> <td> <img src=assets/effect_of_betam/700.gif width="150"> </td> </tr> </table > Higher beta_m correspond to more dynamic motion and lower temporal consistency and image alignment.

The effect of a is as follows:

<table class="center"> <tr style="font-weight: bolder;text-align:center;"> <td>Conditional Image</td> <td>a = 5.0</td> <td>a = 1.0</td> <td>a = 0.1</td> </tr> <tr> <td> <img src=assets/conditionalImg/doggy.jpg width="150"> </td> <td> <img src=assets/effect_of_betam/100.gif width="150"> </td> <td> <img src=assets/effect_of_a/1.gif width="150"> </td> <td> <img src=assets/effect_of_a/01.gif width="150"> </td> </tr> </table >

Lower a correspond to more dynamic motion and lower temporal consistency and image alignment.

SVD

  1. Download the SVD checkpoints from the repository and put them in examples/SVD/ckpt/pretrained/stable-video-diffusion-img2vid;
  2. Run the following commands:
cd examples/SVD
sh train.sh

The relevant parameters in examples/SVD/config/train.yamlfor our strategy are explained as follows:

Note that original SVD first add noise on conditional image and then feed it into VAE. Here we first feed the conditional image into VAE and then add noise on the conditional latents.

VideoCrafter1

  1. Download the VideoCrafter checkpoints from the repository and put them in examples/VideoCrafter/original/ckpt/.
  2. Run the following commands:
cd examples/VideoCrafter
sh train.sh

The relevant parameters in train.sh for our strategy are explained as follows:

🎒 Checkpoints

Naive fine-tuning and ours were trained under the same settings for fair comparison. In the future, we will release the model without watermark.

ModelNaive Fine-TuningOurs on WebvidWatermark-free
DynamiCrafter320x512320x512320x512 576x1024
SVD320x512320x512
VideoCrafter1320x512320x512

😄 Citation

If you find this repository helpful, please cite as:

@article{zhao2024identifying,
  title={Identifying and Solving Conditional Image Leakage in Image-to-Video Diffusion Model},
  author={Zhao, Min and Zhu, Hongzhou and Xiang, Chendong and Zheng, Kaiwen and Li, Chongxuan and Zhu, Jun},
  journal={arXiv preprint arXiv:2406.15735},
  year={2024}
}

❤️ Acknowledgements

This implementation is based on the following work: