From 821dbf34ba99be3f5f5b4505e0ca269c959731c1 Mon Sep 17 00:00:00 2001 From: ailemon <3210346136@qq.com> Date: Tue, 24 May 2022 20:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=92=8C=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 ++++---- README.md | 25 ++++++++++++++++++------- README_EN.md | 25 ++++++++++++++++++------- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 39e046a..dc6e933 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,16 +30,16 @@ RUN apt update && apt install -y python3 python3-pip RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -RUN pip3 install wave scipy matplotlib tensorflow-cpu==2.5.3 numpy==1.19.2 requests flask waitress grpcio grpcio-tools protobuf +RUN pip3 install wave scipy matplotlib tensorflow-cpu==2.5.3 numpy==1.19.2 requests flask waitress grpcio==1.34.0 grpcio-tools==1.34.0 protobuf -RUN echo $'cd /asrt_server \n python3 asrserver_http.py' > /asrt_server/start.sh && chmod +x /asrt_server/start.sh +RUN echo $'cd /asrt_server \n python3 asrserver_http.py & \n python3 asrserver_grpc.py' > /asrt_server/start.sh && chmod +x /asrt_server/start.sh # refer: https://docs.docker.com/engine/reference/builder/#expose -EXPOSE 20001/tcp +EXPOSE 20001/tcp 20002/tcp ENTRYPOINT ["/bin/bash", "/asrt_server/start.sh"] # https://docs.docker.com/engine/reference/commandline/build/#options # docker build --progress plain --rm --build-arg TAG=1.3.0 --tag asrt/api_server:1.3.0 . # https://docs.docker.com/engine/reference/commandline/run/#options -# docker run --rm -it -p 20001:20001 --name asrt -d asrt/api_server:1.3.0 +# docker run --rm -it -p 20001:20001 -p 20002:20002 --name asrt -d asrt/api_server:1.3.0 diff --git a/README.md b/README.md index 6cee01d..f79f2a7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![GPL-3.0 Licensed](https://img.shields.io/badge/License-GPL3.0-blue.svg?style=flat)](https://opensource.org/licenses/GPL-3.0) [![Stars](https://img.shields.io/github/stars/nl8590687/ASRT_SpeechRecognition)](https://github.com/nl8590687/ASRT_SpeechRecognition) [![TensorFlow Version](https://img.shields.io/badge/Tensorflow-1.15+-blue.svg)](https://www.tensorflow.org/) -[![Python Version](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://www.python.org/) +[![Python Version](https://img.shields.io/badge/Python-3.7+-blue.svg)](https://www.python.org/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5808434.svg)](https://doi.org/10.5281/zenodo.5808434) ASRT是一个基于深度学习的中文语音识别系统,如果您觉得喜欢,请点一个 **"Star"** 吧~ @@ -37,7 +37,7 @@ ASRT是一个基于深度学习的中文语音识别系统,如果您觉得喜 ### 软件 * Linux: Ubuntu 18.04 + / CentOS 7 + -* Python: 3.6 + +* Python: 3.7 + * TensorFlow: 1.15, 2.x + (不建议使用最新版和大版本的x.x.0版) ## 快速开始 @@ -87,24 +87,34 @@ $ python3 evaluate_speech_model.py $ python3 predict_speech_file.py ``` -ASRT API服务器启动请执行: +启动ASRT HTTP协议的API服务器启动请执行: ```shell $ python3 asrserver_http.py ``` -本地测试调用API服务是否成功: +本地测试调用HTTP协议API服务是否成功: ```shell $ python3 client_http.py ``` +启动ASRT GRPC协议的API服务器启动请执行: +```shell +$ python3 asrserver_grpc.py +``` + +本地测试调用GRPC协议API服务是否成功: +```shell +$ python3 client_grpc.py +``` + 请注意,开启API服务器之后,需要使用本ASRT项目对应的客户端软件来进行语音识别,详见Wiki文档[下载ASRT语音识别客户端SDK和Demo](https://wiki.ailemon.net/docs/asrt-doc/download)。 -如果要训练和使用非251bn版模型,请在代码中 `import speech_model_zoo` 的相应位置做修改。 +如果要训练和使用非251bn版模型,请在代码中 `from speech_model.xxx import xxx` 的相应位置做修改。 使用docker直接部署ASRT: ```shell -$ docker pull ailemondocker/asrt_service:1.2.0 -$ docker run --rm -it -p 20001:20001 --name asrt-server -d ailemondocker/asrt_service:1.2.0 +$ docker pull ailemondocker/asrt_service:1.3.0 +$ docker run --rm -it -p 20001:20001 -p 20002:20002 --name asrt-server -d ailemondocker/asrt_service:1.3.0 ``` 仅CPU运行推理识别,不作训练 @@ -143,6 +153,7 @@ Github本仓库下[Releases](https://github.com/nl8590687/ASRT_SpeechRecognition * requests * flask * waitress +* grpcio / grpcio-tools / protobuf 不会安装环境的同学请直接运行以下命令(前提是有GPU且已经安装好 CUDA 11.2 和 cudnn 8.1): diff --git a/README_EN.md b/README_EN.md index 7b40fcf..5d758cc 100644 --- a/README_EN.md +++ b/README_EN.md @@ -3,7 +3,7 @@ [![GPL-3.0 Licensed](https://img.shields.io/badge/License-GPL3.0-blue.svg?style=flat)](https://opensource.org/licenses/GPL-3.0) [![Stars](https://img.shields.io/github/stars/nl8590687/ASRT_SpeechRecognition)](https://github.com/nl8590687/ASRT_SpeechRecognition) [![TensorFlow Version](https://img.shields.io/badge/Tensorflow-1.15+-blue.svg)](https://www.tensorflow.org/) -[![Python Version](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://www.python.org/) +[![Python Version](https://img.shields.io/badge/Python-3.7+-blue.svg)](https://www.python.org/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5808434.svg)](https://doi.org/10.5281/zenodo.5808434) ASRT is A Deep-Learning-Based Chinese Speech Recognition System. If you like this project, please **star** it. @@ -35,7 +35,7 @@ This project uses tensorFlow.keras based on deep convolutional neural network an ### Software * Linux: Ubuntu 18.04 + / CentOS 7 + -* Python: 3.6 + +* Python: 3.7 + * TensorFlow: 1.15, 2.x + (The latest and x.x.0 are deprecated) ## Quick Start @@ -84,7 +84,7 @@ To predict one wave audio file for speech recognition: $ python3 predict_speech_file.py ``` -ASRT API Server startup please execute: +To startup ASRT API Server with HTTP protocol please execute: ```shell $ python3 asrserver_http.py ``` @@ -92,19 +92,29 @@ $ python3 asrserver_http.py Please note that after opening the API server, you need to use the client software corresponding to this ASRT project for voice recognition. For details, see the Wiki documentation to [download ASRT Client SDK & Demo](https://wiki.ailemon.net/docs/asrt-doc/download). -To test whether it is successful or not that calls api service interface: +To test whether it is successful or not that calls api service interface with HTTP protocol: ```shell $ python3 client_http.py ``` -If you want to train and use other model(not Model 251bn), make changes in the corresponding position of the `import speech_model_zoo` in the code files. +To startup ASRT API Server with GRPC protocol please execute: +```shell +$ python3 asrserver_grpc.py +``` + +To test whether it is successful or not that calls api service interface with GRPC protocol: +```shell +$ python3 client_grpc.py +``` + +If you want to train and use other model(not Model 251bn), make changes in the corresponding position of the `from speech_model.xxx import xxx` in the code files. If there is any problem during the execution of the program or during use, it can be promptly put forward in the issue, and I will reply as soon as possible. Deploy ASRT by docker: ```shell -$ docker pull ailemondocker/asrt_service:1.2.0 -$ docker run --rm -it -p 20001:20001 --name asrt-server -d ailemondocker/asrt_service:1.2.0 +$ docker pull ailemondocker/asrt_service:1.3.0 +$ docker run --rm -it -p 20001:20001 -p 20002:20002 --name asrt-server -d ailemondocker/asrt_service:1.3.0 ``` It will start a api server for recognition rather than training. @@ -143,6 +153,7 @@ At present, the best model can basically reach 85% of Pinyin correct rate on the * requests * flask * waitress +* grpcio / grpcio-tools / protobuf If you have trouble when install those packages, please run the following script to do it as long as you have a GPU and CUDA 11.2 and cudnn 8.1 have been installed: