πΊ πΊ πΊ Follow Your Pose π π π
Pose-Guided Text-to-Video Generation using Pose-Free Videos
Yue Ma*, Yingqing He*, Xiaodong Cun, Xintao Wang, Ying Shan, Xiu Li, and Qifeng Chen
"A astronaut, brown background" | "A Hulk, on the sea" |
"A man in the park, Van Gogh style" | "The Stormtroopers, on the beach" |
π π π Abstract
TL;DR: We tune the text-to-image model (e.g., stable diffusion) to generate the character videos from pose and text description.
CLICK for full abstract
Generating text-editable and pose-controllable character videos have an imperious demand in creating various digital human. Nevertheless, this task has been restricted by the absence of a comprehensive dataset featuring paired video-pose captions and the generative prior models for videos. In this work, we design a novel two-stage training scheme that can utilize easily obtained datasets (i.e., image pose pair and pose-free video) and the pre-trained text-to-image (T2I) model to obtain the pose-controllable character videos. Specifically, in the first stage, only the keypoint-image pairs are used only for a controllable textto-image generation. We learn a zero-initialized convolutional encoder to encode the pose information. In the second stage, we finetune the motion of the above network via a pose-free video dataset by adding the learnable temporal self-attention and reformed cross-frame self-attention blocks. Powered by our new designs, our method successfully generates continuously pose-controllable character videos while keeps the editing and concept composition ability of the pre-trained T2I model. The code and models will be made publicly available.
πΊ πΊ πΊ Changelog
- [2023.04.12]
π₯ Release local gradio demo and you could run it locally, only need a A100/3090. - [2023.04.11]
π₯ Release some cases inhuggingface demo
. - [2023.04.10]
π₯ Release A new version ofhuggingface demo
, which support bothraw video
andskeleton video
as input. Enjoy it! - [2023.04.07] Release the first version of
huggingface demo
. Enjoy the fun of following your pose! You need to download the skeleton video or make your own skeleton video by mmpose. Additionaly, the second version which regard thevideo format
as input is comming. - [2023.04.07] Release a
colab notebook
and updata therequirements
for installation! - [2023.04.06] Release
code
,config
andcheckpoints
! - [2023.04.03] Release Paper and Project page!
π π π HuggingFace Demo
π€ π€ π€ Todo
- Release the code, config and checkpoints for teaser
- Colab
- Hugging face gradio demo
- Release more applications
π» π» π» Setup Environment
Our method is trained using cuda11, accelerator and xformers on 8 A100.
conda create -n fupose python=3.8
conda activate fupose
pip install -r requirements.txt
xformers
is recommended for A100 GPU to save memory and running time.
Click for xformers installation
We find its installation not stable. You may try the following wheel:
wget https://github.com/ShivamShrirao/xformers-wheels/releases/download/4c06c79/xformers-0.0.15.dev0+4c06c79.d20221201-cp38-cp38-linux_x86_64.whl
pip install xformers-0.0.15.dev0+4c06c79.d20221201-cp38-cp38-linux_x86_64.whl
Our environment is similar to Tune-A-video (official, unofficial). You may check them for more details.
π π π Training
We fix the bug in Tune-a-video and finetune stable diffusion-1.4 on 8 A100. To fine-tune the text-to-image diffusion models for text-to-video generation, run this command:
TORCH_DISTRIBUTED_DEBUG=DETAIL accelerate launch \
--multi_gpu --num_processes=8 --gpu_ids '0,1,2,3,4,5,6,7' \
train_followyourpose.py \
--config="configs/pose_train.yaml"
πΊ πΊ πΊ Inference
Once the training is done, run inference:
TORCH_DISTRIBUTED_DEBUG=DETAIL accelerate launch \
--gpu_ids '0' \
txt2video.py \
--config="configs/pose_sample.yaml" \
--skeleton_path="./pose_example/vis_ikun_pose2.mov"
You could make the pose video by mmpose , we detect the skeleton by HRNet. You just need to run the video demo to obtain the pose video. Remember to replace the background with black.
π π π Local Gradio Demo
You could run the gradio demo locally, only need a A100/3090
.
python app.py
then the demo is running on local URL: http://0.0.0.0:Port
πΊ πΊ πΊ Weight
[Stable Diffusion] Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input. The pre-trained Stable Diffusion models can be downloaded from Hugging Face (e.g., Stable Diffusion v1-4)
[FollowYourPose] We also provide our pretrained checkpoints in Huggingface. you could download them and put them into checkpoints
folder to inference our models.
FollowYourPose
βββ checkpoints
β βββ followyourpose_checkpoint-1000
β β βββ...
β βββ stable-diffusion-v1-4
β β βββ...
β βββ pose_encoder.pth
π π π Results
We show our results regarding various pose sequences and text prompts.
Note mp4 and gif files in this github page are compressed. Please check our Project Page for mp4 files of original video results.
"A Robot, in Sahara desert" | "A Iron man, on the beach" | "A panda, son the sea" |
"A man in the park, Van Gogh style" | "The fireman in the beach" | "Batman, brown background" |
"A Hulk, on the sea" | "A superman, in the forest" | "A Iron man, in the snow" |
"A man in the forest, Minecraft." | "A man in the sea, at sunset" | "James Bond, grey simple background" |
"A Panda on the sea." | "A Stormtrooper on the sea" | "A astronaut on the moon" |
"A astronaut on the moon." | "A Robot in Antarctica." | "A Iron man on the beach." |
"The Obama in the desert" | "Astronaut on the beach." | "Iron man on the snow" |
"A Stormtrooper on the sea" | "A Iron man on the beach." | "A astronaut on the moon." |
"Astronaut on the beach" | "Superman on the forest" | "Iron man on the beach" |
"Astronaut on the beach" | "Robot in Antarctica" | "The Stormtroopers, on the beach" |
πΌ πΌ πΌ Citation
If you think this project is helpful, please feel free to leave a star
@article{ma2023follow,
title={Follow Your Pose: Pose-Guided Text-to-Video Generation using Pose-Free Videos},
author={Ma, Yue and He, Yingqing and Cun, Xiaodong and Wang, Xintao and Shan, Ying and Li, Xiu and Chen, Qifeng},
journal={arXiv preprint arXiv:2304.01186},
year={2023}
}
π― π― π― Acknowledgements
This repository borrows heavily from Tune-A-Video and FateZero. thanks the authors for sharing their code and models.
πΊ πΊ πΊ Maintenance
This is the codebase for our research work. We are still working hard to update this repo and more details are coming in days. If you have any questions or ideas to discuss, feel free to contact Yue Ma or Yingqing He or Xiaodong Cun.