commit
9af6ab8f89
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
@ -157,4 +174,3 @@ hub serving start -c deploy/hubserving/ocr_system/config.json
|
|||
|
||||
- 5、重新启动服务
|
||||
```hub serving start -m ocr_system```
|
||||
|
||||
|
|
|
@ -29,26 +29,39 @@ 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)
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue