环境

  • windows 10 64bit

  • wav2lip-hq

  • pytorch 1.12.1+cu113

前言

前面的博文 嘴型同步模型Wav2Lip,介绍了嘴型同步模型,本篇介绍的是 wav2lip 的高清版,在原有基础上,使用了超分辨率图像和人脸分割技术,来提升整体效果。

嘴型融合 wav2lip 升级版

实践

首先,拉取源码

git clone https://github.com/Markfryazino/wav2lip-hq.git
cd wav2lip-hq
# 创建个新的虚拟环境
conda create -n wav2liphq python=3.8
conda activate wav2liphq
# 安装torch
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
# 安装其它依赖库,将其中的torch、torchvision注释掉,前面已经安装了gpu版本
pip install -r requirements.txt

然后去下载模型,这里需要3个模型,第一个下载地址:https://drive.google.com/file/d/1aB-jqBikcZPJnFrJXWUEpvF2RFCuerSe/view?usp=sharing ,下载后拷贝到目录 checkpoints 下面;第二个模型是人脸的模型,下载地址:https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth,下载后拷贝到 face_detection/detection/sfd 目录下,并重命名为 s3fd.pth;第三个是脸部的 segmentation 模型,下载地址:https://drive.google.com/open?id=154JgKpzCPW82qINcVieuPH3fZ2e0P812,拷贝到 checkpoints 目录下,并重命名为 face_segmentation.pth

最后,我们准备一个音频文件和一个视频文件来进行测试,执行命令

python.exe inference.py --checkpoint_path checkpoints\wav2lip_gan.pth --segmentation_path checkpoints\face_segmentation.pth --sr_path checkpoints\esrgan_yunying.pth --face test.mp4 --audio test.mp3 --outfile output.mp4

参考资料

  • https://github.com/Markfryazino/wav2lip-hq

  • https://github.com/zllrunning/face-parsing.PyTorch.git

  • https://github.com/xinntao/BasicSR.git

  • https://github.com/1adrianb/face-alignment

  • https://xugaoxiang.com/2021/03/05/wav2lip/

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。