Drexubery / ViewCrafter

Official implementation of "ViewCrafter: Taming Video Diffusion Models for High-fidelity Novel View Synthesis"
Apache License 2.0
736 stars 24 forks source link

ViewCrafter: Taming Video Diffusion Models for High-fidelity Novel View Synthesis

        _**[Wangbo Yu*](https://scholar.google.com/citations?user=UOE8-qsAAAAJ&hl=zh-CN), [Jinbo Xing*](https://doubiiu.github.io/), [Li Yuan*](), [Wenbo Hu†](https://wbhu.github.io/), [Xiaoyu Li](https://xiaoyu258.github.io/), [Zhipeng Huang](),
[Xiangjun Gao](https://scholar.google.com/citations?user=qgdesEcAAAAJ&hl=en/), [Tien-Tsin Wong](https://www.cse.cuhk.edu.hk/~ttwong/myself.html), [Ying Shan](https://scholar.google.com/citations?hl=en&user=4oXBp9UAAAAJ&view_op=list_works&sortby=pubdate), [Yonghong Tian†]()**_

πŸ”† Introduction

ViewCrafter can generate high-fidelity novel views from a single or sparse reference image, while also supporting highly precise pose control. Below shows an example:

Zero-shot novel view synthesis (single view)

Reference image Camera trajecotry Generated novel view video

Zero-shot novel view synthesis (two views)

Reference image 1 Reference image 2 Generated novel view video

πŸ—“οΈ TODO

🧰 Models

Model Resolution Frames GPU Mem. & Inference Time (A100, ddim 50steps) Checkpoint
ViewCrafter_25 576x1024 25 23.5GB & 120s (perframe_ae=True) Hugging Face
ViewCrafter_16 576x1024 16 18.3GB & 75s (perframe_ae=True) Hugging Face
ViewCrafter_25_512 320x512 25 13.8GB & 50s (perframe_ae=True) Hugging Face

Currently, we provide three versions of the model: a base model that generates 16 frames at a time, an enhanced model that generates 25 frames at a time (used by default), and a low-resolution model that produces 25 frames of 320x512 video. The inference time can be reduced by using fewer DDIM steps.

βš™οΈ Setup

1. Clone ViewCrafter

git clone https://github.com/Drexubery/ViewCrafter.git
cd ViewCrafter

2. Installation

# Create conda environment
conda create -n viewcrafter python=3.9.16
conda activate viewcrafter
pip install -r requirements.txt

# Install PyTorch3D
conda install https://anaconda.org/pytorch3d/pytorch3d/0.7.5/download/linux-64/pytorch3d-0.7.5-py39_cu117_pyt1131.tar.bz2

# Download DUSt3R
mkdir -p checkpoints/
wget https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth -P checkpoints/

πŸ’« Inference

1. Command line

(1) Download pretrained model (ViewCrafter_25 for example) and put the model.ckpt in checkpoints/model.ckpt. \ (2) Run inference.py using the following script. Please refer to the configuration document and render document to set up inference parameters and camera trajectory.

  sh run.sh

2. Local Gradio demo

Download the pretrained model and put it in the corresponding directory according to the previous guideline, then run:

  python gradio_app.py 

πŸ˜‰ Citation

Please consider citing our paper if our code is useful:

  @article{yu2024viewcrafter,
    title={ViewCrafter: Taming Video Diffusion Models for High-fidelity Novel View Synthesis},
    author={Yu, Wangbo and Xing, Jinbo and Yuan, Li and Hu, Wenbo and Li, Xiaoyu and Huang, Zhipeng and Gao, Xiangjun and Wong, Tien-Tsin and Shan, Ying and Tian, Yonghong},
    journal={arXiv preprint arXiv:2409.02048},
    year={2024}
  }

πŸ“’ Disclaimer

⚠️This is an open-source research exploration rather than a commercial product, so it may not meet all your expectations. Due to the variability of the video diffusion model, you may encounter failure cases. Try using different seeds and adjusting the render configs if the results are not desirable. Users are free to create videos using this tool, but they must comply with local laws and use it responsibly. The developers do not assume any responsibility for potential misuse by users.