未验证 提交 9af6ab8f 编写于 作者: S shaohua.zhang 提交者: GitHub

Merge pull request #6 from PaddlePaddle/develop

update-2020-7-27
...@@ -3,7 +3,7 @@ ...@@ -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. 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, It provides efficient inference capabilities for mobile phones and IOTs,
and extensively integrates cross-platform hardware to provide lightweight and extensively integrates cross-platform hardware to provide lightweight
deployment solutions for end-side deployment issues. deployment solutions for end-side deployment issues.
......
...@@ -9,9 +9,21 @@ ...@@ -9,9 +9,21 @@
我们推荐用户使用GPU来做Paddle Serving的OCR服务部署 我们推荐用户使用GPU来做Paddle Serving的OCR服务部署
**CUDA版本:9.0** **CUDA版本:9.0**
**CUDNN版本:7.0** **CUDNN版本:7.0**
**操作系统版本:CentOS 6以上** **操作系统版本: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月底正式上线 #以下提供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 wget --no-check-certificate https://paddle-serving.bj.bcebos.com/others/paddle_serving_server_gpu-0.3.2-py2-none-any.whl
......
...@@ -28,21 +28,38 @@ deploy/hubserving/ocr_system/ ...@@ -28,21 +28,38 @@ 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/``` ```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. 启动服务 ### 3. 启动服务
#### 方式1. 命令行命令启动(仅支持CPU) #### 方式1. 命令行命令启动(仅支持CPU)
...@@ -157,4 +174,3 @@ hub serving start -c deploy/hubserving/ocr_system/config.json ...@@ -157,4 +174,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,24 +29,37 @@ The following steps take the 2-stage series service as an example. If only the d ...@@ -29,24 +29,37 @@ 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.
Install the detection service module: * On Linux platform, the examples are as follows.
```shell ```shell
# Install the detection service module:
hub install deploy/hubserving/ocr_det/ 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/ hub install deploy/hubserving/ocr_rec/
# Or, install the 2-stage series service module:
hub install deploy/hubserving/ocr_system/
``` ```
Or, install the 2-stage series service module:
* On Windows platform, the examples are as follows.
```shell ```shell
hub install deploy/hubserving/ocr_system/ # 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 ### 3. Start service
......
...@@ -135,6 +135,9 @@ if __name__ == "__main__": ...@@ -135,6 +135,9 @@ if __name__ == "__main__":
text_detector = TextDetector(args) text_detector = TextDetector(args)
count = 0 count = 0
total_time = 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: for image_file in image_file_list:
img = cv2.imread(image_file) img = cv2.imread(image_file)
if img is None: if img is None:
...@@ -147,6 +150,7 @@ if __name__ == "__main__": ...@@ -147,6 +150,7 @@ if __name__ == "__main__":
print("Predict time of %s:" % image_file, elapse) print("Predict time of %s:" % image_file, elapse)
src_im = utility.draw_text_det_res(dt_boxes, image_file) src_im = utility.draw_text_det_res(dt_boxes, image_file)
img_name_pure = image_file.split("/")[-1] 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: if count > 1:
print("Avg Time:", total_time / (count - 1)) print("Avg Time:", total_time / (count - 1))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册