嘴型融合模型SadTalker
source link: https://xugaoxiang.com/2023/04/01/sadtalker/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- windows 10 64bit
- SadTalker
- torch 1.12.1+cu113
视频看这里
Youtube
Bilibili
创建一个全新的 python
虚拟环境
conda create -n sadtalker python=3.8
conda activate sadtalker
然后,拉取源代码,并且安装对应的依赖
git clone https://github.com/Winfredy/SadTalker.git
cd SadTalker
# 安装gpu版的torch
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
# 安装dlib-bin,它比dlib更快
pip install dlib-bin
# 安装其它依赖
pip install -r requirements.txt
# 安装gfpgan,如果不使用gfpgan增强,可以不安装
git clone https://github.com/TencentARC/GFPGAN.git gfpgan_src
cd gfpgan_src
python setup.py install
找一段音频 test.mp3
和视频 test.mp4
,进行测试
python.exe .\inference.py --driven_audio test.mp3 --source_image test.mp4 --result_dir outputs --enhancer RestoreFormer
其中,--source_image
参数可以是视频,也可以是图片, --result_dir
参数指定最后合成后的视频存放位置,--enhancer
指定视频增强的方法,可以是 gpfgan
或是 RestoreFormer
。
如果你的显卡够好,可以调整 --batch_size
参数,默认值是2,值越大,处理的越快。
还有部分参数,可以根据自己的实际情况添加。
Traceback (most recent call last):
File ".\inference.py", line 110, in <module>
main(args)
File ".\inference.py", line 71, in main
batch = get_data(first_coeff_path, audio_path, device)
File "D:\BaiduNetdiskDownload\SadTalker\SadTalker\generate_batch.py", line 68, in get_data
orig_mel = audio.melspectrogram(wav).T
File "D:\BaiduNetdiskDownload\SadTalker\SadTalker\utils\audio.py", line 47, in melspectrogram
S = _amp_to_db(_linear_to_mel(np.abs(D))) - hp.ref_level_db
File "D:\BaiduNetdiskDownload\SadTalker\SadTalker\utils\audio.py", line 95, in _linear_to_mel
_mel_basis = _build_mel_basis()
File "D:\BaiduNetdiskDownload\SadTalker\SadTalker\utils\audio.py", line 100, in _build_mel_basis
return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels,
TypeError: mel() takes 0 positional arguments but 2 positional arguments (and 3 keyword-only arguments) were given
这是由于 librosa
的版本高了,按照 requirements.txt
,安装 0.6.0 版本即可
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK