Skip to content

YingqingHe/LVDM

Repository files navigation

LVDM: Latent Video Diffusion Models for High-Fidelity Long Video Generation

     


1 The Hong Kong University of Science and Technology   2 Tencent AI Lab  


TL;DR: An efficient video diffusion model that can:
1️⃣ conditionally generate videos based on input text;
2️⃣ unconditionally generate videos with thousands of frames.


🍻 Results

☝️ Text-to-Video Generation

"A corgi is swimming fastly" "astronaut riding a horse" "A glass bead falling into water with a huge splash. Sunset in the background" "A beautiful sunrise on mars. High definition, timelapse, dramaticcolors." "A bear dancing and jumping to upbeat music, moving his whole body." "An iron man surfing in the sea. cartoon style"

✌️ Unconditional Long Video Generation (40 seconds)

⏳ TODO

  • Release pretrained text-to-video generation models and inference code
  • Release unconditional video generation models
  • Release training code
  • Update training and sampling for long video generation


⚙️ Setup

Install Environment via Anaconda

conda create -n lvdm python=3.8.5
conda activate lvdm
pip install -r requirements.txt

Pretrained Models and Used Datasets

Download via linux commands:

mkdir -p models/ae
mkdir -p models/lvdm_short
mkdir -p models/t2v

# sky timelapse
wget -O models/ae/ae_sky.ckpt https://huggingface.co/Yingqing/LVDM/resolve/main/ae/ae_sky.ckpt
wget -O models/lvdm_short/short_sky.ckpt https://huggingface.co/Yingqing/LVDM/resolve/main/lvdm_short/short_sky.ckpt  

# taichi
wget -O models/ae/ae_taichi.ckpt https://huggingface.co/Yingqing/LVDM/resolve/main/ae/ae_taichi.ckpt
wget -O models/lvdm_short/short_taichi.ckpt https://huggingface.co/Yingqing/LVDM/resolve/main/lvdm_short/short_taichi.ckpt

# text2video
wget -O models/t2v/model.ckpt https://huggingface.co/Yingqing/LVDM/resolve/main/lvdm_short/t2v.ckpt

Download manually:


💫 Inference

Sample Short Videos

  • unconditional generation
bash shellscripts/sample_lvdm_short.sh
  • text to video generation
bash shellscripts/sample_lvdm_text2video.sh

Sample Long Videos

bash shellscripts/sample_lvdm_long.sh

💫 Training

Train video autoencoder

bash shellscripts/train_lvdm_videoae.sh 
  • remember to set PROJ_ROOT, EXPNAME, DATADIR, and CONFIG.

Train unconditional lvdm for short video generation

bash shellscripts/train_lvdm_short.sh
  • remember to set PROJ_ROOT, EXPNAME, DATADIR, AEPATH and CONFIG.

Train unconditional lvdm for long video generation

# TBD

💫 Evaluation

bash shellscripts/eval_lvdm_short.sh
  • remember to set DATACONFIG, FAKEPATH, REALPATH, and RESDIR.

📃 Abstract

AI-generated content has attracted lots of attention recently, but photo-realistic video synthesis is still challenging. Although many attempts using GANs and autoregressive models have been made in this area, the visual quality and length of generated videos are far from satisfactory. Diffusion models have shown remarkable results recently but require significant computational resources. To address this, we introduce lightweight video diffusion models by leveraging a low-dimensional 3D latent space, significantly outperforming previous pixel-space video diffusion models under a limited computational budget. In addition, we propose hierarchical diffusion in the latent space such that longer videos with more than one thousand frames can be produced. To further overcome the performance degradation issue for long video generation, we propose conditional latent perturbation and unconditional guidance that effectively mitigate the accumulated errors during the extension of video length. Extensive experiments on small domain datasets of different categories suggest that our framework generates more realistic and longer videos than previous strong baselines. We additionally provide an extension to large-scale text-to-video generation to demonstrate the superiority of our work. Our code and models will be made publicly available.

🔮 Pipeline


😉 Citation

@article{he2022lvdm,
      title={Latent Video Diffusion Models for High-Fidelity Long Video Generation}, 
      author={Yingqing He and Tianyu Yang and Yong Zhang and Ying Shan and Qifeng Chen},
      year={2022},
      eprint={2211.13221},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

🤗 Acknowledgements

We built our code partially based on latent diffusion models and TATS. Thanks the authors for sharing their awesome codebases! We aslo adopt Xintao Wang's Real-ESRGAN for upscaling our text-to-video generation results. Thanks for their wonderful work!

About

LVDM: Latent Video Diffusion Models for High-Fidelity Long Video Generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published