OpenTalker / DPE

[CVPR 2023] DPE: Disentanglement of Pose and Expression for General Video Portrait Editing
https://carlyx.github.io/DPE/
MIT License
417 stars 45 forks source link

DPE: Disentanglement of Pose and Expression for General Video Portrait Editing

            [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)]()
Youxin Pang 1,2,3 Yong Zhang 3,*Weize Quan 1,2Yanbo Fan 3Xiaodong Cun 3Ying Shan 3 Dong-ming Yan 1,2,*

1 MAIS & NLPR, Institute of Automation, Chinese Academy of Sciences, Beijing, China   2 School of Artificial Intelligence, University of Chinese Academy of Sciences   3 Tencent AI Lab, ShenZhen, China  

CVPR 2023


🔥 Demo

Source video Result

dpe dpe

📋 Changelog

🚧 TODO

🔮 Inference

Dependence Installation

CLICK ME ``` git clone https://github.com/Carlyx/DPE cd DPE conda create -n dpe python=3.8 source activate dpe pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 pip install -r requirements.txt ### install gpfgan for enhancer pip install git+https://github.com/TencentARC/GFPGAN ```

Trained Models

CLICK ME Please download our [pre-trained model](https://drive.google.com/file/d/18Bi06ewhcx-1owlJF3F_J3INlXkQ3oX2/view?usp=share_link) and put it in ./checkpoints. | Model | Description | :--- | :---------- |checkpoints/dpe.pt | Pre-trained model (V1).

Expression driving

python run_demo.py --s_path ./data/s.mp4 \
        --d_path ./data/d.mp4 \
        --model_path ./checkpoints/dpe.pt \
        --face exp \
        --output_folder ./res

Pose driving

python run_demo.py --s_path ./data/s.mp4 \
        --d_path ./data/d.mp4 \
        --model_path ./checkpoints/dpe.pt \
        --face pose \
        --output_folder ./res

Expression and pose driving

Video driving:

python run_demo.py --s_path ./data/s.mp4 \
        --d_path ./data/d.mp4 \
        --model_path ./checkpoints/dpe.pt \
        --face both \
        --output_folder ./res

One-shot driving:

python run_demo_single.py --s_path ./data/s.jpg \
        --pose_path ./data/pose.mp4 \
        --exp_path ./data/exp.mp4 \
        --model_path ./checkpoints/dpe.pt \
        --face both \
        --output_folder ./res

Crop full video

python crop_video.py

Video editing

Before video editing, you should run python crop_video.py to process the input full video. For pre-trained segmentation model, you can download from here and put it in ./checkpoints.

(Optional) You can run git clone https://github.com/TencentARC/GFPGAN and download the pre-trained enhancement model from here and put it in ./checkpoints. Then you can use --EN to make the result better.

python run_demo_paste.py --s_path <cropped source video> \
  --d_path <driving video> \
  --box_path <txt after running crop_video.py> \
  --model_path ./checkpoints/dpe.pt \
  --face exp \
  --output_folder ./res \
  --EN 

Video editing for audio driving

  TODO

🔮 Training

To train DPE, please follow video-preprocessing to download and pre-process the VoxCelebA dataset. We use the lmdb to improve I/O efficiency. (Or you can rewrite the Class VoxDataset in dataset.py to load data with .mp4 directly.)

🛎 Citation

If you find our work useful in your research, please consider citing:

@InProceedings{Pang_2023_CVPR,
    author    = {Pang, Youxin and Zhang, Yong and Quan, Weize and Fan, Yanbo and Cun, Xiaodong and Shan, Ying and Yan, Dong-Ming},
    title     = {DPE: Disentanglement of Pose and Expression for General Video Portrait Editing},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2023},
    pages     = {427-436}
}

💗 Acknowledgements

Part of the code is adapted from LIA, PIRenderer, STIT. We thank authors for their contribution to the community.

🥂 Related Works

📢 Disclaimer

This is not an official product of Tencent. This repository can only be used for personal/research/non-commercial purposes.