1. 安装
1.1 安装 conda以指定python版本运行环境
下载:Index of /https://repo.anaconda.com/archive/index.html
1.2 如按旧项目基于python3.6版本对话,会有很多包找不到的情况,经摸索后以python3.9构建成功,
# 设置代理
conda config --set proxy_servers.http http://127.0.0.1:1081
conda config --set proxy_servers.http https://127.0.0.1:1081
conda install --channel defaults conda python=3.9 --yes
conda update --channel defaults --all --yes
conda update -n base -c defaults conda
conda create -n py3.9 python=3.9
conda activate py3.9
conda deactivate
conda env list
#禁止默认base环境
conda config --set auto_activate_base false
conda config --set env_prompt '({name})'
#添加阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
pip config set install.trusted-host mirrors.aliyun.com
# 删除环境
conda env remove -n name
requirements.txt 内容
#librosa==0.7.0
librosa
#numpy==1.17.1
numpy==1.24
opencv-contrib-python>=4.2.0.34
#opencv-python==4.1.0.25
opencv-python
#torch==1.1.0
torch
#torchvision==0.3.0
torchvision
tqdm==4.45.0
#numba==0.48
numba
(py3.9) D:\Projects\Wav2Lip>pip install -r requirements.txt
2. CPU与GPU驱动模式
装好后,程序没检查到可用的cuda的话,会使用CPU模式跑,直接拉满100%使用率,一条20秒的片子合成约需20mins 。
手上有块NVDIA GeForce RTX 3060,需分别安装 CUDA, cuDNN 及对应python库的支持,参考CUDA安装教程_SU_ZCS的博客-CSDN博客,一条20秒的片子合成约需6mins,提升一倍多。
命令example:
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\0.mp3 --outfile D:\Projects\NetworkShow\result\0.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\1.mp3 --outfile D:\Projects\NetworkShow\result\1.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\2.mp3 --outfile D:\Projects\NetworkShow\result\2.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\3.mp3 --outfile D:\Projects\NetworkShow\result\3.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\4.mp3 --outfile D:\Projects\NetworkShow\result\4.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\5.mp3 --outfile D:\Projects\NetworkShow\result\5.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face D:\Projects\NetworkShow\src\video\digitalman.jpg --audio D:\Projects\NetworkShow\src\digitalman\6.mp3 --outfile D:\Projects\NetworkShow\result\6.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a1.mp4 --audio src/audio/a1.wav --outfile results/a1.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a2.mp4 --audio src/audio/a2.wav --outfile results/a2.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a3.mp4 --audio src/audio/a3.wav --outfile results/a3.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a4.mp4 --audio src/audio/a4.wav --outfile results/a4.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a5.mp4 --audio src/audio/a5.wav --outfile results/a5.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a6.mp4 --audio src/audio/a6.wav --outfile results/a6.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a8.mp4 --audio src/audio/a8.wav --outfile results/a8.mp4