/FollowYourEmoji

[Siggraph Asia 2024] Follow-Your-Emoji: This repo is the official implementation of "Follow-Your-Emoji: Fine-Controllable and Expressive Freestyle Portrait Animation"

Primary LanguagePython

Follow-Your-Emoji
Fine-Controllable and Expressive Freestyle Portrait Animation

Yue Ma*, Hongyu Liu*, Hongfa Wang*, Heng Pan*, Yingqing He, Junkun Yuan, Ailing Zeng, Chengfei Cai, Heung-Yeung Shum, Wei Liu and Qifeng Chen

visitors Open in OpenXLab GitHub

๐Ÿ“ฃ Updates

  • [2024.07.31] ๐Ÿ”ฅ Release OpenXLab, thanks for keyhsw development!
  • [2024.07.21] ๐Ÿ”ฅ Release Colab, thanks for daswer123!
  • [2024.07.18] ๐Ÿ”ฅ Release inference code, config and checkpoints!
  • [2024.06.07] ๐Ÿ”ฅ Release Paper and Project page!

๐Ÿคช Gallery

Image 1

We present Follow-Your-Emoji, a diffusion-based framework for portrait animation, which animates a reference portrait with target landmark sequences.

๐Ÿคช Getting Started

1. Clone the code and prepare the environment

pip install -r requirements.txt

2. Download pretrained weights

[FollowYourEmoji] We also provide our pretrained checkpoints in Huggingface. you could download them and put them into checkpoints folder to inference our model.

Finally, these pretrained models should be organized as follows:

pretrained_models
โ”œโ”€โ”€ AnimateDiff
โ”‚   โ””โ”€โ”€ mm_sd_v15_v2.ckpt
โ”œโ”€โ”€ follow-your-emoji
โ”‚   โ”œโ”€โ”€ lmk_guider.pth
โ”‚   โ”œโ”€โ”€ referencenet.pth
โ”‚   โ””โ”€โ”€ unet.pth
โ”œโ”€โ”€ sd-image-variations-diffusers
โ”‚   โ”œโ”€โ”€ alias-montage.jpg
โ”‚   โ”œโ”€โ”€ default-montage.jpg
โ”‚   โ”œโ”€โ”€ earring.jpg
โ”‚   โ”œโ”€โ”€ feature_extractor
โ”‚   โ”‚   โ””โ”€โ”€ preprocessor_config.json
โ”‚   โ”œโ”€โ”€ image_encoder
โ”‚   โ”‚   โ”œโ”€โ”€ config.json
โ”‚   โ”‚   โ””โ”€โ”€ pytorch_model.bin
โ”‚   โ”œโ”€โ”€ inputs.jpg
โ”‚   โ”œโ”€โ”€ model_index.json
โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ safety_checker
โ”‚   โ”‚   โ”œโ”€โ”€ config.json
โ”‚   โ”‚   โ””โ”€โ”€ pytorch_model.bin
โ”‚   โ”œโ”€โ”€ scheduler
โ”‚   โ”‚   โ””โ”€โ”€ scheduler_config.json
โ”‚   โ”œโ”€โ”€ unet
โ”‚   โ”‚   โ”œโ”€โ”€ config.json
โ”‚   โ”‚   โ””โ”€โ”€ diffusion_pytorch_model.bin
โ”‚   โ”œโ”€โ”€ v1-montage.jpg
โ”‚   โ”œโ”€โ”€ v2-montage.jpg
โ”‚   โ””โ”€โ”€ vae
โ”‚       โ”œโ”€โ”€ config.json
โ”‚       โ””โ”€โ”€ diffusion_pytorch_model.bin
โ””โ”€โ”€ sd-vae-ft-mse
    โ”œโ”€โ”€ config.json
    โ”œโ”€โ”€ diffusion_pytorch_model.bin
    โ”œโ”€โ”€ diffusion_pytorch_model.safetensors
    โ””โ”€โ”€ README.md

3. Inference ๐Ÿš€

bash infer.sh
CUDA_VISIBLE_DEVICES=0 python3 -m torch.distributed.run \
    --nnodes 1 \
    --master_addr $LOCAL_IP \
    --master_port 12345 \
    --node_rank 0 \
    --nproc_per_node 1 \
    infer.py \
    --config ./configs/infer.yaml \
    --model_path /path/to/model \
    --input_path your_own_images_path \
    --lmk_path ./inference_temple/test_temple.npy  \
    --output_path your_own_output_path

๐Ÿคช Make Your Emoji

You can make your own emoji using our model. First, you need to make your emoji temple using MediaPipe. We provide the script in make_temple.ipynb. You can replace the video path with your own emoji video and generate the .npy file.

CUDA_VISIBLE_DEVICES=0 python3 -m torch.distributed.run \
    --nnodes 1 \
    --master_addr $LOCAL_IP \
    --master_port 12345 \
    --node_rank 0 \
    --nproc_per_node 1 \
    infer.py \
    --config ./configs/infer.yaml \
    --model_path /path/to/model \
    --input_path your_own_images_path \
    --lmk_path  your_own_temple_path \
    --output_path your_own_output_path

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Follow Family

Follow-Your-Pose: Pose-Guided text-to-Video Generation.

Follow-Your-Click: Open-domain Regional image animation via Short Prompts.

Follow-Your-Handle: Controllable Video Editing via Control Handle Transformations.

Follow-Your-Emoji: Fine-Controllable and Expressive Freestyle Portrait Animation.

Citation ๐Ÿ’–

If you find Follow-Your-Emoji useful for your research, welcome to ๐ŸŒŸ this repo and cite our work using the following BibTeX:

@article{ma2024follow,
  title={Follow-Your-Emoji: Fine-Controllable and Expressive Freestyle Portrait Animation},
  author={Ma, Yue and Liu, Hongyu and Wang, Hongfa and Pan, Heng and He, Yingqing and Yuan, Junkun and Zeng, Ailing and Cai, Chengfei and Shum, Heung-Yeung and Liu, Wei and others},
  journal={arXiv preprint arXiv:2406.01900},
  year={2024}
}