【虚拟主播】刚刚,我用三行代码创建了一个虚拟主播

您所在的位置:网站首页 英雄联盟手游如何换头像图片大全 【虚拟主播】刚刚,我用三行代码创建了一个虚拟主播

【虚拟主播】刚刚,我用三行代码创建了一个虚拟主播

2023-03-23 15:36| 来源: 网络整理| 查看: 265

刚刚,我用三行代码创建了一个虚拟主播

刚刚,我花了10分钟,写了三行代码创建一个具有明星脸的虚拟主播

先看看效果:

语音播报虚拟主播2

实现简易的虚拟数字人非常简单,需要调用三个模型:

(1)First Order Motion(表情迁移)

(2)Text to Speech(文本转语音)

(2)Wav2Lip(唇形合成)。 具体技术步骤如下: 1,把图像放入First Order Motion模型进行面部表情迁移,让虚拟主播的表情更加逼近真人,既然定位是一个主播,那表情都参考当然是要用“国家级标准”的,所以参考的对象选择了梓萌老师~ 2,通过Text to Speech模型,将输入的文字转换成音频输出。 3,得到面部表情迁移的视频和音频之后,通过Wav2Lip模型,将音频和视频合并,并根据音频内容调整唇形,使得虚拟人更加接近真人效果。

1、运行依赖安装

In [ ]

# 升级PaddleHub !pip install --upgrade paddlehub

In [ ]

# 下载nltk_data !wget https://paddlespeech.bj.bcebos.com/Parakeet/tools/nltk_data.tar.gz !tar zxvf nltk_data.tar.gz

In [ ]

# 安装ParaKeet %cd Parakeet/ !pip install -e. %cd ..

In [ ]

# 安装依赖 !hub install first_order_motion==1.0.0 !hub install wav2lip !hub install fastspeech2_baker==1.0.0 Download https://bj.bcebos.com/paddlehub/paddlehub_dev/first_order_motion.tar.gz [##################################################] 100.00% Decompress /home/aistudio/.paddlehub/tmp/tmphcuxe0xl/first_order_motion.tar.gz [##################################################] 100.00% [2022-01-07 15:32:45,388] [ INFO] - Installing dependent packages from /home/aistudio/.paddlehub/tmp/tmpvtfv5cjp/first_order_motion/requirements.txt: / 2、 开始创建虚拟人 2.1 表情驱动

通过FOM模型,输入图像和驱动视频,让人像动起来!

In [6]

import cv2 import os files = os.listdir('input_data/img/') for f in files: img = cv2.imread('input_data/img/'+f) imgshape = img.shape resimg = cv2.resize(img,(int(img.shape[1]/2),int(img.shape[0]/2))) cv2.imwrite('input_data/'+f,resimg)

In [1]

import paddlehub as hub FOM_Module = hub.Module(name="first_order_motion") FOM_Module.generate(source_image="input_data/t5.jpeg", # 输入图像 driving_video="input_data/zimeng.mp4", # 输入驱动视频 ratio=0.4, image_size=256, output_dir='./output/', # 输出文件夹 filename='FOM.mp4', # 输出文件名 use_gpu=True) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import MutableMapping /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Iterable, Mapping /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Sized W0108 00:26:51.097970 19449 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.0, Runtime API Version: 10.1 W0108 00:26:51.104054 19449 device_context.cc:465] device: 0, cuDNN Version: 7.6. [01/08 00:26:56] ppgan INFO: Found /home/aistudio/.cache/ppgan/GPEN-512.pdparams 1 persons have been detected 100%|██████████| 300/300 [00:36


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3