From 3c2187e973b50f10c371134eb86d53e2aec2a535 Mon Sep 17 00:00:00 2001 From: Jiawei Wang Date: Fri, 24 Jul 2020 16:32:53 +0800 Subject: [PATCH 1/8] Update readme.md --- deploy/pdserving/readme.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/deploy/pdserving/readme.md b/deploy/pdserving/readme.md index 4ec42d79be..d6069cd35d 100644 --- a/deploy/pdserving/readme.md +++ b/deploy/pdserving/readme.md @@ -9,9 +9,21 @@ 我们推荐用户使用GPU来做Paddle Serving的OCR服务部署 **CUDA版本:9.0** + **CUDNN版本:7.0** + **操作系统版本:CentOS 6以上** +**Python3操作指南:** +``` +#以下提供beta版本的paddle serving whl包,欢迎试用,正式版会在7月底正式上线 +wget --no-check-certificate https://paddle-serving.bj.bcebos.com/others/paddle_serving_server_gpu-0.3.2-py3-none-any.whl +wget --no-check-certificate https://paddle-serving.bj.bcebos.com/others/paddle_serving_client-0.3.2-cp36-none-any.whl +wget --no-check-certificate https://paddle-serving.bj.bcebos.com/others/paddle_serving_app-0.1.2-py3-none-any.whl +python -m pip install paddle_serving_app-0.1.2-py3-none-any.whl paddle_serving_server_gpu-0.3.2-py3-none-any.whl paddle_serving_client-0.3.2-cp36-none-any.whl +``` + +**Python2操作指南:** ``` #以下提供beta版本的paddle serving whl包,欢迎试用,正式版会在7月底正式上线 wget --no-check-certificate https://paddle-serving.bj.bcebos.com/others/paddle_serving_server_gpu-0.3.2-py2-none-any.whl From 791f6239474fe2109b60e109c7a1a5be0a3e0608 Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Sat, 25 Jul 2020 07:38:50 +0000 Subject: [PATCH 2/8] fix hub serving doc --- doc/doc_ch/serving.md | 37 ++++++++++++++++++++++++++----------- doc/doc_en/serving_en.md | 35 +++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/doc/doc_ch/serving.md b/doc/doc_ch/serving.md index 1cc57d5324..d4c5d8c1f1 100644 --- a/doc/doc_ch/serving.md +++ b/doc/doc_ch/serving.md @@ -28,21 +28,37 @@ deploy/hubserving/ocr_system/ # 安装paddlehub pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple -# 设置环境变量 +# 在Linux下设置环境变量 export PYTHONPATH=. -``` +# 在Windows下设置环境变量 +SET PYTHONPATH=. +``` ### 2. 安装服务模块 -PaddleOCR提供3种服务模块,根据需要安装所需模块。如: +PaddleOCR提供3种服务模块,根据需要安装所需模块。 + +* 在Linux环境下,安装示例如下: 安装检测服务模块: ```hub install deploy/hubserving/ocr_det/``` -或,安装识别服务模块: +或,安装识别服务模块: ```hub install deploy/hubserving/ocr_rec/``` 或,安装检测+识别串联服务模块: -```hub install deploy/hubserving/ocr_system/``` +```hub install deploy/hubserving/ocr_system/``` + +* 在Windows环境下(文件夹的分隔符为`\`),安装示例如下: + +安装检测服务模块: +```hub install deploy\hubserving\ocr_det\``` + +或,安装识别服务模块: +```hub install deploy\hubserving\ocr_rec\``` + +或,安装检测+识别串联服务模块: +```hub install deploy\hubserving\ocr_system\``` + ### 3. 启动服务 #### 方式1. 命令行命令启动(仅支持CPU) @@ -71,7 +87,7 @@ $ hub serving start --modules [Module1==Version1, Module2==Version2, ...] \ **启动命令:** ```hub serving start -c config.json``` -其中,`config.json`格式如下: +其中,`config.json`格式如下: ```python { "modules_info": { @@ -124,7 +140,7 @@ hub serving start -c deploy/hubserving/ocr_system/config.json ## 返回结果格式说明 返回结果为列表(list),列表中的每一项为词典(dict),词典一共可能包含3种字段,信息如下: -|字段名称|数据类型|意义| +|字段名称|数据类型|意义| |-|-|-| |text|str|文本内容| |confidence|float| 文本识别置信度| @@ -134,9 +150,9 @@ hub serving start -c deploy/hubserving/ocr_system/config.json |字段名/模块名|ocr_det|ocr_rec|ocr_system| |-|-|-|-| -|text||✔|✔| -|confidence||✔|✔| -|text_region|✔||✔| +|text||✔|✔| +|confidence||✔|✔| +|text_region|✔||✔| **说明:** 如果需要增加、删除、修改返回字段,可在相应模块的`module.py`文件中进行修改,完整流程参考下一节自定义修改服务模块。 @@ -157,4 +173,3 @@ hub serving start -c deploy/hubserving/ocr_system/config.json - 5、重新启动服务 ```hub serving start -m ocr_system``` - diff --git a/doc/doc_en/serving_en.md b/doc/doc_en/serving_en.md index 84b57ecd7b..d4c235d234 100644 --- a/doc/doc_en/serving_en.md +++ b/doc/doc_en/serving_en.md @@ -29,12 +29,16 @@ The following steps take the 2-stage series service as an example. If only the d # Install paddlehub pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple -# Set environment variables +# Set environment variables on Linux export PYTHONPATH=. -``` +# Set environment variables on Windows +SET PYTHONPATH=. +``` ### 2. Install Service Module -PaddleOCR provides 3 kinds of service modules, install the required modules according to your needs. Such as: +PaddleOCR provides 3 kinds of service modules, install the required modules according to your needs. + +* On Linux platform, the examples are as follows. Install the detection service module: ```shell @@ -47,7 +51,22 @@ hub install deploy/hubserving/ocr_rec/ Or, install the 2-stage series service module: ```shell hub install deploy/hubserving/ocr_system/ +``` + +* On Windows platform, the examples are as follows. + +Install the detection service module: +```shell +hub install deploy\hubserving\ocr_det\ ``` +Or, install the recognition service module: +```shell +hub install deploy\hubserving\ocr_rec\ +``` +Or, install the 2-stage series service module: +```shell +hub install deploy\hubserving\ocr_system\ + ### 3. Start service #### Way 1. Start with command line parameters (CPU only) @@ -119,7 +138,7 @@ python tools/test_hubserving.py server_url image_path ``` Two parameters need to be passed to the script: -- **server_url**:service address,format of which is +- **server_url**:service address,format of which is `http://[ip_address]:[port]/predict/[module_name]` For example, if the detection, recognition and 2-stage serial services are started with provided configuration files, the respective `server_url` would be: `http://127.0.0.1:8866/predict/ocr_det` @@ -135,7 +154,7 @@ python tools/test_hubserving.py http://127.0.0.1:8868/predict/ocr_system ./doc/i ## Returned result format The returned result is a list. Each item in the list is a dict. The dict may contain three fields. The information is as follows: -|field name|data type|description| +|field name|data type|description| |-|-|-| |text|str|text content| |confidence|float|text recognition confidence| @@ -145,9 +164,9 @@ The fields returned by different modules are different. For example, the results |field name/module name|ocr_det|ocr_rec|ocr_system| |-|-|-|-| -|text||✔|✔| -|confidence||✔|✔| -|text_region|✔||✔| +|text||✔|✔| +|confidence||✔|✔| +|text_region|✔||✔| **Note:** If you need to add, delete or modify the returned fields, you can modify the file `module.py` of the corresponding module. For the complete process, refer to the user-defined modification service module in the next section. From f7224e46ac8c329a684120da0ad8f89866e8134a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E8=88=92=E8=B5=B7?= <867907127@qq.com> Date: Sat, 25 Jul 2020 20:31:50 +0800 Subject: [PATCH 3/8] fix a typo --- deploy/lite/readme_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/lite/readme_en.md b/deploy/lite/readme_en.md index 1efbba368c..00bb5e587d 100644 --- a/deploy/lite/readme_en.md +++ b/deploy/lite/readme_en.md @@ -3,7 +3,7 @@ This tutorial will introduce how to use paddle-lite to deploy paddleOCR ultra-lightweight Chinese and English detection models on mobile phones. -addle Lite is a lightweight inference engine for PaddlePaddle. +paddle-lite is a lightweight inference engine for PaddlePaddle. It provides efficient inference capabilities for mobile phones and IOTs, and extensively integrates cross-platform hardware to provide lightweight deployment solutions for end-side deployment issues. From 0aebfbc26f933643c9140e5b357998fe4f62b68b Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Sun, 26 Jul 2020 11:23:47 +0000 Subject: [PATCH 4/8] fix save img for pred_det --- tools/infer/predict_det.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/infer/predict_det.py b/tools/infer/predict_det.py index 93a21c512d..28515b7851 100755 --- a/tools/infer/predict_det.py +++ b/tools/infer/predict_det.py @@ -135,6 +135,9 @@ def __call__(self, img): text_detector = TextDetector(args) count = 0 total_time = 0 + draw_img_save = "./inference_results" + if not os.path.exists(draw_img_save): + os.makedirs(draw_img_save) for image_file in image_file_list: img = cv2.imread(image_file) if img is None: @@ -147,6 +150,7 @@ def __call__(self, img): print("Predict time of %s:" % image_file, elapse) src_im = utility.draw_text_det_res(dt_boxes, image_file) img_name_pure = image_file.split("/")[-1] - cv2.imwrite("./inference_results/det_res_%s" % img_name_pure, src_im) + cv2.imwrite( + os.path.join(draw_img_save, "det_res_%s" % img_name_pure), src_im) if count > 1: print("Avg Time:", total_time / (count - 1)) From b736ab897c2b6d11ccceb6e6b9d170ea0dcb18b3 Mon Sep 17 00:00:00 2001 From: MissPenguin Date: Mon, 27 Jul 2020 10:56:56 +0800 Subject: [PATCH 5/8] Update serving_en.md --- doc/doc_en/serving_en.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/doc_en/serving_en.md b/doc/doc_en/serving_en.md index d4c235d234..ce863f5bec 100644 --- a/doc/doc_en/serving_en.md +++ b/doc/doc_en/serving_en.md @@ -40,33 +40,32 @@ PaddleOCR provides 3 kinds of service modules, install the required modules acco * On Linux platform, the examples are as follows. -Install the detection service module: +Install the detection service module: ```shell hub install deploy/hubserving/ocr_det/ -``` -Or, install the recognition service module: +``` +Or, install the recognition service module: ```shell hub install deploy/hubserving/ocr_rec/ -``` -Or, install the 2-stage series service module: +``` +Or, install the 2-stage series service module: ```shell hub install deploy/hubserving/ocr_system/ ``` - * On Windows platform, the examples are as follows. -Install the detection service module: +Install the detection service module: ```shell hub install deploy\hubserving\ocr_det\ ``` -Or, install the recognition service module: +Or, install the recognition service module: ```shell hub install deploy\hubserving\ocr_rec\ ``` -Or, install the 2-stage series service module: +Or, install the 2-stage series service module: ```shell hub install deploy\hubserving\ocr_system\ - +``` ### 3. Start service #### Way 1. Start with command line parameters (CPU only) From ab662a16d96995221dc628c08ddc956f44e6aad5 Mon Sep 17 00:00:00 2001 From: MissPenguin Date: Mon, 27 Jul 2020 10:59:18 +0800 Subject: [PATCH 6/8] Update serving_en.md --- doc/doc_en/serving_en.md | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/doc/doc_en/serving_en.md b/doc/doc_en/serving_en.md index ce863f5bec..471269a27e 100644 --- a/doc/doc_en/serving_en.md +++ b/doc/doc_en/serving_en.md @@ -39,31 +39,26 @@ SET PYTHONPATH=. PaddleOCR provides 3 kinds of service modules, install the required modules according to your needs. * On Linux platform, the examples are as follows. - -Install the detection service module: ```shell +# Install the detection service module: hub install deploy/hubserving/ocr_det/ -``` -Or, install the recognition service module: -```shell + +# Or, install the recognition service module: hub install deploy/hubserving/ocr_rec/ -``` -Or, install the 2-stage series service module: -```shell + +#Or, install the 2-stage series service module: hub install deploy/hubserving/ocr_system/ ``` -* On Windows platform, the examples are as follows. -Install the detection service module: +* On Windows platform, the examples are as follows. ```shell +# Install the detection service module: hub install deploy\hubserving\ocr_det\ -``` -Or, install the recognition service module: -```shell + +# Or, install the recognition service module: hub install deploy\hubserving\ocr_rec\ -``` -Or, install the 2-stage series service module: -```shell + +# Or, install the 2-stage series service module: hub install deploy\hubserving\ocr_system\ ``` From cdeef19e765062b78251c52cb26c887940021c96 Mon Sep 17 00:00:00 2001 From: MissPenguin Date: Mon, 27 Jul 2020 10:59:57 +0800 Subject: [PATCH 7/8] Update serving_en.md --- doc/doc_en/serving_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc_en/serving_en.md b/doc/doc_en/serving_en.md index 471269a27e..7439cc84ab 100644 --- a/doc/doc_en/serving_en.md +++ b/doc/doc_en/serving_en.md @@ -46,7 +46,7 @@ hub install deploy/hubserving/ocr_det/ # Or, install the recognition service module: hub install deploy/hubserving/ocr_rec/ -#Or, install the 2-stage series service module: +# Or, install the 2-stage series service module: hub install deploy/hubserving/ocr_system/ ``` From c1ba964326cfbc6404d43b8d43fed61ca5f00c1e Mon Sep 17 00:00:00 2001 From: MissPenguin Date: Mon, 27 Jul 2020 11:03:08 +0800 Subject: [PATCH 8/8] Update serving.md --- doc/doc_ch/serving.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/doc/doc_ch/serving.md b/doc/doc_ch/serving.md index d4c5d8c1f1..892745671e 100644 --- a/doc/doc_ch/serving.md +++ b/doc/doc_ch/serving.md @@ -38,27 +38,28 @@ SET PYTHONPATH=. PaddleOCR提供3种服务模块,根据需要安装所需模块。 * 在Linux环境下,安装示例如下: +```shell +# 安装检测服务模块: +hub install deploy/hubserving/ocr_det/ -安装检测服务模块: -```hub install deploy/hubserving/ocr_det/``` - -或,安装识别服务模块: -```hub install deploy/hubserving/ocr_rec/``` +# 或,安装识别服务模块: +hub install deploy/hubserving/ocr_rec/ -或,安装检测+识别串联服务模块: -```hub install deploy/hubserving/ocr_system/``` +# 或,安装检测+识别串联服务模块: +hub install deploy/hubserving/ocr_system/ +``` * 在Windows环境下(文件夹的分隔符为`\`),安装示例如下: +```shell +# 安装检测服务模块: +hub install deploy\hubserving\ocr_det\ -安装检测服务模块: -```hub install deploy\hubserving\ocr_det\``` - -或,安装识别服务模块: -```hub install deploy\hubserving\ocr_rec\``` - -或,安装检测+识别串联服务模块: -```hub install deploy\hubserving\ocr_system\``` +# 或,安装识别服务模块: +hub install deploy\hubserving\ocr_rec\ +# 或,安装检测+识别串联服务模块: +hub install deploy\hubserving\ocr_system\ +``` ### 3. 启动服务 #### 方式1. 命令行命令启动(仅支持CPU)