提交 791f6239 编写于 作者: littletomatodonkey's avatar littletomatodonkey

fix hub serving doc

上级 41ecf41d
...@@ -28,21 +28,37 @@ deploy/hubserving/ocr_system/ ...@@ -28,21 +28,37 @@ deploy/hubserving/ocr_system/
# 安装paddlehub # 安装paddlehub
pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
# 设置环境变量 # 在Linux下设置环境变量
export PYTHONPATH=. export PYTHONPATH=.
``` # 在Windows下设置环境变量
SET PYTHONPATH=.
```
### 2. 安装服务模块 ### 2. 安装服务模块
PaddleOCR提供3种服务模块,根据需要安装所需模块。如: PaddleOCR提供3种服务模块,根据需要安装所需模块。
* 在Linux环境下,安装示例如下:
安装检测服务模块: 安装检测服务模块:
```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环境下(文件夹的分隔符为`\`),安装示例如下:
安装检测服务模块:
```hub install deploy\hubserving\ocr_det\```
或,安装识别服务模块:
```hub install deploy\hubserving\ocr_rec\```
或,安装检测+识别串联服务模块:
```hub install deploy\hubserving\ocr_system\```
### 3. 启动服务 ### 3. 启动服务
#### 方式1. 命令行命令启动(仅支持CPU) #### 方式1. 命令行命令启动(仅支持CPU)
...@@ -71,7 +87,7 @@ $ hub serving start --modules [Module1==Version1, Module2==Version2, ...] \ ...@@ -71,7 +87,7 @@ $ hub serving start --modules [Module1==Version1, Module2==Version2, ...] \
**启动命令:** **启动命令:**
```hub serving start -c config.json``` ```hub serving start -c config.json```
其中,`config.json`格式如下: 其中,`config.json`格式如下:
```python ```python
{ {
"modules_info": { "modules_info": {
...@@ -124,7 +140,7 @@ hub serving start -c deploy/hubserving/ocr_system/config.json ...@@ -124,7 +140,7 @@ hub serving start -c deploy/hubserving/ocr_system/config.json
## 返回结果格式说明 ## 返回结果格式说明
返回结果为列表(list),列表中的每一项为词典(dict),词典一共可能包含3种字段,信息如下: 返回结果为列表(list),列表中的每一项为词典(dict),词典一共可能包含3种字段,信息如下:
|字段名称|数据类型|意义| |字段名称|数据类型|意义|
|-|-|-| |-|-|-|
|text|str|文本内容| |text|str|文本内容|
|confidence|float| 文本识别置信度| |confidence|float| 文本识别置信度|
...@@ -134,9 +150,9 @@ hub serving start -c deploy/hubserving/ocr_system/config.json ...@@ -134,9 +150,9 @@ hub serving start -c deploy/hubserving/ocr_system/config.json
|字段名/模块名|ocr_det|ocr_rec|ocr_system| |字段名/模块名|ocr_det|ocr_rec|ocr_system|
|-|-|-|-| |-|-|-|-|
|text||✔|✔| |text||✔|✔|
|confidence||✔|✔| |confidence||✔|✔|
|text_region|✔||✔| |text_region|✔||✔|
**说明:** 如果需要增加、删除、修改返回字段,可在相应模块的`module.py`文件中进行修改,完整流程参考下一节自定义修改服务模块。 **说明:** 如果需要增加、删除、修改返回字段,可在相应模块的`module.py`文件中进行修改,完整流程参考下一节自定义修改服务模块。
...@@ -157,4 +173,3 @@ hub serving start -c deploy/hubserving/ocr_system/config.json ...@@ -157,4 +173,3 @@ hub serving start -c deploy/hubserving/ocr_system/config.json
- 5、重新启动服务 - 5、重新启动服务
```hub serving start -m ocr_system``` ```hub serving start -m ocr_system```
...@@ -29,12 +29,16 @@ The following steps take the 2-stage series service as an example. If only the d ...@@ -29,12 +29,16 @@ The following steps take the 2-stage series service as an example. If only the d
# Install paddlehub # Install paddlehub
pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
# Set environment variables # Set environment variables on Linux
export PYTHONPATH=. export PYTHONPATH=.
``` # Set environment variables on Windows
SET PYTHONPATH=.
```
### 2. Install Service Module ### 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: Install the detection service module:
```shell ```shell
...@@ -47,7 +51,22 @@ hub install deploy/hubserving/ocr_rec/ ...@@ -47,7 +51,22 @@ hub install deploy/hubserving/ocr_rec/
Or, install the 2-stage series service module: Or, install the 2-stage series service module:
```shell ```shell
hub install deploy/hubserving/ocr_system/ 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 ### 3. Start service
#### Way 1. Start with command line parameters (CPU only) #### Way 1. Start with command line parameters (CPU only)
...@@ -119,7 +138,7 @@ python tools/test_hubserving.py server_url image_path ...@@ -119,7 +138,7 @@ python tools/test_hubserving.py server_url image_path
``` ```
Two parameters need to be passed to the script: 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]` `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: 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` `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 ...@@ -135,7 +154,7 @@ python tools/test_hubserving.py http://127.0.0.1:8868/predict/ocr_system ./doc/i
## Returned result format ## 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: 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| |text|str|text content|
|confidence|float|text recognition confidence| |confidence|float|text recognition confidence|
...@@ -145,9 +164,9 @@ The fields returned by different modules are different. For example, the results ...@@ -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| |field name/module name|ocr_det|ocr_rec|ocr_system|
|-|-|-|-| |-|-|-|-|
|text||✔|✔| |text||✔|✔|
|confidence||✔|✔| |confidence||✔|✔|
|text_region|✔||✔| |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. **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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册