Giter Site home page Giter Site logo

wallaceliu / ppasr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yeyupiaoling/ppasr

1.0 0.0 0.0 17.82 MB

基于PaddlePaddle实现端到端中文语音识别,从入门到实战,超简单的入门案例,超实用的企业项目。支持当前最流行的DeepSpeech2、Conformer、Squeezeformer模型

License: Apache License 2.0

JavaScript 1.37% Python 97.52% CSS 0.26% HTML 0.85%

ppasr's Introduction

python version GitHub forks GitHub Repo stars GitHub 支持系统

PPASR流式与非流式语音识别项目

本项目将分三个阶段分支,分别是入门级进阶级最终级 分支,当前为最终级的V2版本,如果想使用最终级的V1版本,请在这个分支r1.x。PPASR中文名称PaddlePaddle中文语音识别(PaddlePaddle Automatic Speech Recognition),是一款基于PaddlePaddle实现的语音识别框架,PPASR致力于简单,实用的语音识别项目。可部署在服务器,Nvidia Jetson设备,未来还计划支持Android等移动设备。别忘了star

欢迎大家扫码入QQ群讨论,或者直接搜索QQ群号1169600237,问题答案为博主Github的IDyeyupiaoling

在线使用

1. 在AI Studio平台训练预测

2. 在线使用Dome


本项目使用的环境:

  • Anaconda 3
  • Python 3.8
  • PaddlePaddle 2.4.1
  • Windows 10 or Ubuntu 18.04

项目快速了解

  1. 本项目支持流式识别模型deepspeech2conformersqueezeformer,每个模型又分online(在线)和offline(离线),对应的是流式识别和非流式识别。
  2. 本项目支持两种解码器,分别是集束搜索解码器ctc_beam_search和贪心解码器ctc_greedy,集束搜索解码器ctc_beam_search准确率更高,但不支持Windows。
  3. 下面提供了一系列预训练模型的下载,下载预训练模型之后,需要把全部文件复制到项目根目录,并执行导出模型才可以使用语音识别。

更新记录

  • 2022.12.05: 支持自动混合精度训练和导出量化模型。
  • 2022.11.26: 支持Squeezeformer模型。
  • 2022.11.01: 修改Conformer模型的解码器为BiTransformerDecoder,增加SpecSubAugmentor数据增强器。
  • 2022.10.29: 正式发布最终级的V2版本。

视频讲解

快速使用

这里介绍如何使用PPASR快速进行语音识别,前提是要安装PPASR,文档请看快速安装。执行过程不需要手动下载模型,全部自动完成。

  1. 短语音识别
from ppasr.predict import PPASRPredictor

predictor = PPASRPredictor(model_tag='conformer_online_fbank_wenetspeech')

wav_path = 'dataset/test.wav'
result = predictor.predict(audio_data=wav_path, use_pun=False)
score, text = result['score'], result['text']
print(f"识别结果: {text}, 得分: {int(score)}")
  1. 长语音识别
from ppasr.predict import PPASRPredictor

predictor = PPASRPredictor(model_tag='conformer_online_fbank_wenetspeech')

wav_path = 'dataset/test_long.wav'
result = predictor.predict_long(audio_data=wav_path, use_pun=False)
score, text = result['score'], result['text']
print(f"识别结果: {text}, 得分: {score}")
  1. 模拟流式识别
import time
import wave

from ppasr.predict import PPASRPredictor

predictor = PPASRPredictor(model_tag='conformer_online_fbank_wenetspeech')

# 识别间隔时间
interval_time = 0.5
CHUNK = int(16000 * interval_time)
# 读取数据
wav_path = 'dataset/test.wav'
wf = wave.open(wav_path, 'rb')
data = wf.readframes(CHUNK)
# 播放
while data != b'':
    start = time.time()
    d = wf.readframes(CHUNK)
    result = predictor.predict_stream(audio_data=data, use_pun=False, is_end=d == b'')
    data = d
    if result is None: continue
    score, text = result['score'], result['text']
    print(f"【实时结果】:消耗时间:{int((time.time() - start) * 1000)}ms, 识别结果: {text}, 得分: {int(score)}")
# 重置流式识别
predictor.reset_stream()

模型下载

  1. conformer预训练模型列表:
使用模型 数据集 预处理方式 语言 测试集字错率(词错率) 下载地址
conformer_online WenetSpeech (10000小时) fbank 中文 0.03579(aishell_test)
0.11081(test_net)
0.16031(test_meeting)
点击下载
conformer_online WenetSpeech (10000小时)+中文语音数据集 (3000+小时) fbank 中文 0.02923(aishell_test)
0.11876(test_net)
0.18346(test_meeting)
点击下载
conformer_online aishell (179小时) fbank 中文 0.04936 点击下载
conformer_offline aishell (179小时) fbank 中文 0.04343 点击下载
conformer_online Librispeech (960小时) fbank 英文 0.08109 点击下载
conformer_offline Librispeech (960小时) fbank 英文 0.08036 点击下载
  1. squeezeformer预训练模型列表:
使用模型 数据集 预处理方式 语言 测试集字错率(词错率) 下载地址
squeezeformer_online aishell (179小时) fbank 中文 0.04758 点击下载
squeezeformer_offline aishell (179小时) fbank 中文 0.04889 点击下载
squeezeformer_online Librispeech (960小时) fbank 英文 点击下载
squeezeformer_offline Librispeech (960小时) fbank 英文 点击下载
  1. deepspeech2预训练模型列表:
使用模型 数据集 预处理方式 语言 测试集字错率(词错率) 下载地址
deepspeech2_online WenetSpeech (10000小时) fbank 中文 0.05379(aishell_test) 点击下载
deepspeech2_online aishell (179小时) fbank 中文 0.11367 点击下载
deepspeech2_offline aishell (179小时) fbank 中文 0.09385 点击下载
deepspeech2_online Librispeech (960小时) fbank 英文 0.15294 点击下载
deepspeech2_offline Librispeech (960小时) fbank 英文 0.11035 点击下载

说明:

  1. 这里字错率或者词错率是使用eval.py程序并使用集束搜索解码ctc_beam_search方法计算得到的,min_duration为1.0,max_duration为20.0。
  2. 没有提供预测模型,需要把全部文件复制到项目的根目录下,执行export_model.py导出预测模型。

有问题欢迎提 issue 交流

文档教程

相关项目

特别感谢

参考资料

ppasr's People

Contributors

liuxiaocs7 avatar qiaoruntao avatar yeyupiaoling avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.