快手推出了 LivePortrait,具有拼接和重定向控制的高效肖像动画。

快速开始

下载代码,准备环境
git clone https://github.com/KwaiVGI/LivePortrait
cd LivePortrait

# create env using conda
conda create -n LivePortrait python==3.9.18
conda activate LivePortrait
# install dependencies with pip
pip install -r requirements.txt
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
下载预训练权重
pretrained_weights
├── insightface
│   └── models
│       └── buffalo_l
│           ├── 2d106det.onnx
│           └── det_10g.onnx
└── liveportrait
    ├── base_models
    │   ├── appearance_feature_extractor.pth
    │   ├── motion_extractor.pth
    │   ├── spade_generator.pth
    │   └── warping_module.pth
    ├── landmark.onnx
    └── retargeting_models
        └── stitching_retargeting_module.pth
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
推理
python inference.py

# 指定图片和驱动视频
python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4
  • 1.
  • 2.
  • 3.
  • 4.
Gradio 接口
python app.py
  • 1.
推理速度评估
python speed.py
  • 1.

例子

试用了下,使用图片

[AI 快手 LivePortrait] 引领高效肖像动画新时代_python

生成视频如下

请查看博客或公众号中视频。。。

感觉效果很不错!而且权重很小,600M左右。快手厉害了。

FAQ

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

apt-get update && apt-get install ffmpeg libsm6 libxext6 -y