1. 环境搭建
资料:https://gitee.com/quano/PaddleOCR
1.1 镜像构建
1.1.1 下载整个项目
1
| git clone https://gitee.com/quano/PaddleOCR.git
|
1.1.2 下载模型文件
模型列表
- 可以使用mobile轻量模型,也可尝试server模型.
1.1.3 打包
创建/PaddleOCR/inference/路径,将模型解压后的文件放入
然后获取Dockerfile
调整(dockerfile中解压文件去掉,在工作环境解压好)后,通过 docker build -t paddleocr:gpu0 . 命令打包成镜像
打包后的镜像名称为: paddleocr:gpu0, 通过 docker images 命令可以查看到.
1.1.4 镜像调整
1 2 3 4 5 6
| sudo docker run -p 8866:8866 --gpus all --name paddle_ocr -it paddleocr:gpu0 bash
sudo docker start $容器ID sudo docker exec -it $容器ID bash
|
解决遇到的问题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| hub install deploy/hubserving/ocr_system/ && hub serving start -m ocr_system
pip3.7 install --upgrade pip -i https://mirror.baidu.com/pypi/simple pip3.7 install paddlehub --upgrade -i https://mirror.baidu.com/pypi/simple pip3.7 install -r requirements.txt -i https://mirror.baidu.com/pypi/simple
pip3.7 install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip3.7 install protobuf==3.20
ValueError: not find model file path ./inference/ch_PP-OCRv2_det_infer//inference.pdmodel
docker cp <container_id_or_name>:/PaddleOCR/deploy/hubserving/ocr_system/params.py .
docker cp params.py <container_id_or_name>:/PaddleOCR/deploy/hubserving/ocr_system/params.py
|
1.1.5 测试
使用 https://gitee.com/quano/east-nlp/tree/master/east_paddelocr/.tcloud 中的文件测试
1 2
| sh test.txt sh test.txt2
|
1.2 镜像保存
使用 docker commit 保存成镜像。
1.3 模型解读
1.3.1 工程解读
- 怎么加载的。
- 怎么切换cpu、gpu; 还是说只能有单独的环境。
- 都有哪些模型,执行流程
1.3.1.1 模型流程
1.3.2 算法解读