diff --git a/deploy/lite/readme_en.md b/deploy/lite/readme_en.md index 1efbba368cedcfe276b56560082662211e2c333a..00bb5e587de59e7d7001a365a52606323c61541e 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. diff --git a/deploy/pdserving/readme.md b/deploy/pdserving/readme.md index 4ec42d79bec15bb254e6436a1f0e65c3bec630e5..d6069cd35d201ee7418324c5d9b0b8b28c6569bd 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 diff --git a/doc/doc_ch/serving.md b/doc/doc_ch/serving.md index 1cc57d5324f1415adba8863671fc19fddb648aa3..892745671e639ccd19bec2bc4c789d48d43dfad9 100644 --- a/doc/doc_ch/serving.md +++ b/doc/doc_ch/serving.md @@ -28,21 +28,38 @@ 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种服务模块,根据需要安装所需模块。 -安装检测服务模块: -```hub install deploy/hubserving/ocr_det/``` +* 在Linux环境下,安装示例如下: +```shell +# 安装检测服务模块: +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_rec\ + +# 或,安装检测+识别串联服务模块: +hub install deploy\hubserving\ocr_system\ +``` ### 3. 启动服务 #### 方式1. 命令行命令启动(仅支持CPU) @@ -71,7 +88,7 @@ $ hub serving start --modules [Module1==Version1, Module2==Version2, ...] \ **启动命令:** ```hub serving start -c config.json``` -其中,`config.json`格式如下: +其中,`config.json`格式如下: ```python { "modules_info": { @@ -124,7 +141,7 @@ hub serving start -c deploy/hubserving/ocr_system/config.json ## 返回结果格式说明 返回结果为列表(list),列表中的每一项为词典(dict),词典一共可能包含3种字段,信息如下: -|字段名称|数据类型|意义| +|字段名称|数据类型|意义| |-|-|-| |text|str|文本内容| |confidence|float| 文本识别置信度| @@ -134,9 +151,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 +174,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 84b57ecd7b09faab3b7b82589eb66bf445706ddd..7439cc84abb58f091febc3acda169816d34a836b 100644 --- a/doc/doc_en/serving_en.md +++ b/doc/doc_en/serving_en.md @@ -29,25 +29,38 @@ 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. -Install the detection service module: +* On Linux 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/ -``` +``` + +* 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: +hub install deploy\hubserving\ocr_rec\ + +# Or, install the 2-stage series service module: +hub install deploy\hubserving\ocr_system\ +``` ### 3. Start service #### Way 1. Start with command line parameters (CPU only) @@ -119,7 +132,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 +148,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 +158,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. diff --git a/tools/infer/predict_det.py b/tools/infer/predict_det.py index 93a21c512d77d495842b5750a034df4d5255acfb..28515b785155be833b7d6cce6d31bf371e33ad2c 100755 --- a/tools/infer/predict_det.py +++ b/tools/infer/predict_det.py @@ -135,6 +135,9 @@ if __name__ == "__main__": 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 @@ if __name__ == "__main__": 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))