最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于Python PaddleSpeech實(shí)現(xiàn)語音文字處理

 更新時(shí)間:2022年01月06日 08:36:59   作者:劍客阿良_ALiang  
PaddleSpeech基于飛槳PaddlePaddle的語音方向的開源模型庫,用于語音和音頻中的各種關(guān)鍵任務(wù)的開發(fā),包含大量基于深度學(xué)習(xí)前沿和有影響力的模型。本文將介紹如何通過PaddleSpeech實(shí)現(xiàn)語音文字處理,感興趣的可以學(xué)習(xí)一下

前言

這段時(shí)間一直在研究飛漿平臺(tái),最近試了試PaddleSpeech項(xiàng)目,試著對(duì)文本語音做處理。整體的效果個(gè)人覺著不算特別優(yōu)越,只能作為簡單的學(xué)習(xí)使用。

項(xiàng)目github地址:github倉庫

環(huán)境安裝

首先我們看一下項(xiàng)目結(jié)構(gòu)以及安裝文檔。

需要Python3.7以上、C++環(huán)境、requirements安裝等等,下面按照我的順序說一下。

1、conda安裝Python3.9虛擬環(huán)境

使用conda安裝python3.9環(huán)境,命令如下。

conda create -n py39 python=3.9

2、安裝Visual Studio 2019

安裝地址: Microsoft C++ 生成工具 - Visual Studio

注意安裝的時(shí)候需要勾選C++桌面開發(fā)。

3、安裝requirements.txt

使用命令安裝requiremets.txt,命令如下:

pip install -r requirements.txt -i https://pypi.douban.com/simple

這里要注意一下,paddlespeech_ctcdecoders安裝失敗的話無所謂,可以略掉。

4、安裝paddlepaddle和paddlespeech

命令如下:

pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip install paddlespeech -i https://pypi.tuna.tsinghua.edu.cn/simple

5、nltk_data下載

按照項(xiàng)目安裝文檔內(nèi)的說明。

我的本地目錄地址如下

項(xiàng)目驗(yàn)證

我下面分別驗(yàn)證一下tts、asr以及標(biāo)點(diǎn)恢復(fù)功能。

tts語音合成

使用命令如下:

paddlespeech tts --input "南京現(xiàn)在很冷,下次再去夫子廟吧。" --output C:\Users\xxx\Desktop\115.wav

執(zhí)行過程

(dh_partner) D:\spyder\PaddleSpeech>paddlespeech tts --input "南京現(xiàn)在很冷,下次再去夫子廟吧。" --output C:\Users\xxx\Desktop\115.wav
phones_dict: None
[2022-01-05 17:23:43,642] [    INFO] [log.py] [L57] - File C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4.zip md5 checking...
[2022-01-05 17:23:44,742] [    INFO] [log.py] [L57] - Use pretrained model stored in: C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4
self.phones_dict: C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\phone_id_map.txt
[2022-01-05 17:23:44,743] [    INFO] [log.py] [L57] - C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4
[2022-01-05 17:23:44,744] [    INFO] [log.py] [L57] - C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\default.yaml
[2022-01-05 17:23:44,744] [    INFO] [log.py] [L57] - C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\snapshot_iter_76000.pdz
self.phones_dict: C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\phone_id_map.txt
[2022-01-05 17:23:44,745] [    INFO] [log.py] [L57] - File C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4.zip md5 checking...
[2022-01-05 17:23:44,782] [    INFO] [log.py] [L57] - Use pretrained model stored in: C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4
[2022-01-05 17:23:44,783] [    INFO] [log.py] [L57] - C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4
[2022-01-05 17:23:44,783] [    INFO] [log.py] [L57] - C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4\pwg_default.yaml
[2022-01-05 17:23:44,785] [    INFO] [log.py] [L57] - C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4\pwg_snapshot_iter_400000.pdz
vocab_size: 268
frontend done!
encoder_type is transformer
decoder_type is transformer
C:\Users\huyi\.conda\envs\dh_partner\lib\site-packages\paddle\framework\io.py:415: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' i
s deprecated since Python 3.3, and in 3.10 it will stop working
  if isinstance(obj, collections.Iterable) and not isinstance(obj, (
acoustic model done!
voc done!
Building prefix dict from the default dictionary ...
[2022-01-05 17:23:51] [DEBUG] [__init__.py:113] Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\huyi\AppData\Local\Temp\jieba.cache
[2022-01-05 17:23:51] [DEBUG] [__init__.py:132] Loading model from cache C:\Users\huyi\AppData\Local\Temp\jieba.cache
Loading model cost 0.659 seconds.
[2022-01-05 17:23:52] [DEBUG] [__init__.py:164] Loading model cost 0.659 seconds.
Prefix dict has been built successfully.
[2022-01-05 17:23:52] [DEBUG] [__init__.py:166] Prefix dict has been built successfully.
C:\Users\huyi\.conda\envs\dh_partner\lib\site-packages\paddle\fluid\dygraph\math_op_patch.py:251: UserWarning: The dtype of left and right variables are not the same, left dtype is padd
le.int64, but right dtype is paddle.int32, the right dtype will convert to paddle.int64
  warnings.warn(
[2022-01-05 17:23:58,811] [    INFO] [log.py] [L57] - Wave file has been generated: C:\Users\xxx\Desktop\115.wav

生成的音頻如下

asr語音識(shí)別

我就使用了tts生成的音頻進(jìn)行asr識(shí)別,看看效果,命令如下:

paddlespeech asr --lang zh --input C:\Users\xxx\Desktop\115.wav

執(zhí)行結(jié)果如下

可以看到最后打印的內(nèi)容是沒有標(biāo)點(diǎn)的文字輸出,還是比較準(zhǔn)的。

標(biāo)點(diǎn)恢復(fù)

就用這句話試試標(biāo)點(diǎn)恢復(fù)的情況,命令如下:

paddlespeech text --task punc --input 南京現(xiàn)在很冷下次再去夫子廟吧

執(zhí)行結(jié)果

看起來語義上沒什么問題。

總結(jié)

我在前言中說效果不是很好的主要原因是因?yàn)樗俾时容^慢,相比于類似阿里云提供的tts、asr接口來說,效率比較低。也可能和需要校驗(yàn)?zāi)P褪欠翊嬖谶@些無關(guān)緊要的功能有關(guān)??梢钥紤]研究代碼,自己重新封裝一些服務(wù),效果應(yīng)該好的多。

到此這篇關(guān)于基于Python PaddleSpeech實(shí)現(xiàn)語音文字處理的文章就介紹到這了,更多相關(guān)Python PaddleSpeech語音文字處理內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • python使用Plotly繪圖工具繪制柱狀圖

    python使用Plotly繪圖工具繪制柱狀圖

    這篇文章主要為大家詳細(xì)介紹了python使用Plotly繪圖工具繪制柱狀圖,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-04-04
  • Python判斷素?cái)?shù)的3種方法及for-else語句的用法介紹

    Python判斷素?cái)?shù)的3種方法及for-else語句的用法介紹

    素?cái)?shù)又叫質(zhì)數(shù),指的是>1的整數(shù)中,只能被1和這個(gè)數(shù)本身整除的數(shù),這篇文章主要給大家介紹了關(guān)于Python判斷素?cái)?shù)的3種方法及for-else語句的用法介紹的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-05-05
  • Python實(shí)現(xiàn)迷宮生成器的詳細(xì)代碼

    Python實(shí)現(xiàn)迷宮生成器的詳細(xì)代碼

    這篇文章主要介紹了Python實(shí)現(xiàn)迷宮生成器的詳細(xì)代碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-07-07
  • Python中常見內(nèi)置函數(shù)的用法合集

    Python中常見內(nèi)置函數(shù)的用法合集

    本文將從基礎(chǔ)到高級(jí),詳細(xì)介紹Python中常見的內(nèi)置函數(shù),通過代碼示例和中文注釋,幫助您深入理解如何在不同情景下靈活應(yīng)用這些函數(shù),需要的可以學(xué)習(xí)一下
    2023-09-09
  • django 發(fā)送郵件和緩存的實(shí)現(xiàn)代碼

    django 發(fā)送郵件和緩存的實(shí)現(xiàn)代碼

    這篇文章主要介紹了django 發(fā)送郵件和緩存的實(shí)現(xiàn)代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-07-07
  • matplotlib之pyplot模塊實(shí)現(xiàn)添加子圖subplot的使用

    matplotlib之pyplot模塊實(shí)現(xiàn)添加子圖subplot的使用

    這篇文章主要介紹了matplotlib之pyplot模塊實(shí)現(xiàn)添加子圖subplot的使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-04-04
  • 對(duì)python:循環(huán)定義多個(gè)變量的實(shí)例詳解

    對(duì)python:循環(huán)定義多個(gè)變量的實(shí)例詳解

    今天小編就為大家分享一篇對(duì)python:循環(huán)定義多個(gè)變量的實(shí)例詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-01-01
  • Python?Pandas條件篩選功能

    Python?Pandas條件篩選功能

    這篇文章主要介紹了Python?Pandas條件篩選功能,篩選是在平時(shí)的工作中使用非常頻繁的功能了,下文詳細(xì)的相關(guān)資料介紹,需要的小伙伴可以參考一下
    2022-03-03
  • python之當(dāng)你發(fā)現(xiàn)QTimer不能用時(shí)的解決方法

    python之當(dāng)你發(fā)現(xiàn)QTimer不能用時(shí)的解決方法

    今天小編就為大家分享一篇python之當(dāng)你發(fā)現(xiàn)QTimer不能用時(shí)的解決方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-06-06
  • 遷移現(xiàn)有的python項(xiàng)目到pyproject.toml

    遷移現(xiàn)有的python項(xiàng)目到pyproject.toml

    本文將詳細(xì)介紹將現(xiàn)有的?Python?項(xiàng)目遷移到?pyproject.toml,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-04-04

最新評(píng)論

会理县| 突泉县| 福贡县| 兰考县| 宁南县| 托克逊县| 麻江县| 时尚| 棋牌| 永济市| 望奎县| 同德县| 金平| 永登县| 开鲁县| 和田市| 延川县| 台中县| 壤塘县| 开封县| 柏乡县| 昌图县| 云林县| 株洲县| 建平县| 女性| 宁远县| 阜新市| 甘孜县| 龙南县| 双辽市| 当雄县| 辽源市| 镇康县| 铁岭县| 天全县| 肥乡县| 德州市| 平昌县| 探索| 松阳县|