RUN hub install deploy/hubserving/structure_table/
EXPOSE 8866
CMD [“/bin/bash”,“-c”,“hub serving start -m ocr_system structure_table”]
创建好Dockerfile文件后,执行如下命令即可自动构建镜像,要预留足够的存储空间,构建完成后大概6G多,整个构建过程根据网速定,我花了差不多1.5小时才构建完。
docker build -t paddle-ocr:cpu .
## 2. 运行
docker run -dp 8866:8866 --name ocr paddle-ocr:cpu
当然也可以用 docker-compose 管理
version: ‘3’
services:
ocr:
image: paddle-ocr:cpu
restart: always
container_name: ocr
ports:
- 8866:8866
## 3. 服务配置
>
> 镜像运行后,使用 docker exec -it ocr bash 进入容器内进行修改,修改后重新容器即可。
>
>
>
1. 文本检测+文本方向分类+文本识别3阶段串联服务(ocr\_system)配置文件是deploy/hubserving/ocr\_system/params.py,包含模型路径和相关参数,这里使用默认配置即可,如果更换模型需要对应修改配置文件。
2. 表格识别服务(structure\_table)配置.
#打开配置文件
vim deploy/hubserving/structure_table/params.py
#调整模型文件路径为./inference/ch_ppstructure_mobile_v2.0_SLANet_infer/
#调整字典文件路径为./ppocr/utils/dict/table_structure_dict_ch.txt
## 4. 测试调用
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>