PaddleHub icon indicating copy to clipboard operation
PaddleHub copied to clipboard

paddlepaddle 2.6.1,paddlehub 2.4.0,启动报 Illegal instruction (core dumped) 错误

Open dp9212 opened this issue 8 months ago • 0 comments

CPU推理,paddlepaddle 2.6.1,paddlehub 2.4.0,启动报 Illegal instruction (core dumped) 错误

以下是部署过程:

$ docker pull registry.baidubce.com/paddlepaddle/paddle:2.5.1

$ docker run -p 8866:8866 --name paddleOCR-v4-demo -itd registry.baidubce.com/paddlepaddle/paddle:2.5.1 /bin/bash

$ docker exec -it <容器ID> /bin/bash

#======================================================================

同步下来的PaddleOCR版本为2.8.0 $ git clone https://github.com/PaddlePaddle/PaddleOCR.git

$ cd PaddleOCR/ $ pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ $ pip install paddlehub==2.4.0 --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple/

#======================================================================

$ cd /opt/ $ mkdir -p /opt/PaddleOCR/inference/

文本检测模型 $ wget https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar && tar -xf ch_PP-OCRv4_det_infer.tar -C /opt/PaddleOCR/inference/

文本方向分类模型 $ wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar && tar -xf ch_ppocr_mobile_v2.0_cls_infer.tar -C /opt/PaddleOCR/inference/

文本识别模型 $ wget https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_rec_infer.tar && tar -xf ch_PP-OCRv4_rec_infer.tar -C /opt/PaddleOCR/inference/

基于SLANet的中文表格识别模型 $ wget https://paddleocr.bj.bcebos.com/ppstructure/models/slanet/ch_ppstructure_mobile_v2.0_SLANet_infer.tar && tar -xf ch_ppstructure_mobile_v2.0_SLANet_infer.tar -C /opt/PaddleOCR/inference/

#======================================================================

修改本地模型路径配置 $ vim PaddleOCR/deploy/hubserving/ocr_system/params.py

3阶段串联修改位置 `def read_params(): cfg = Config()

# params for text detector
cfg.det_algorithm = "DB"
# 模型路径
# cfg.det_model_dir = "./inference/ch_PP-OCRv3_det_infer/"
cfg.det_model_dir = "/opt/PaddleOCR/inference/ch_PP-OCRv4_det_infer/"

# params for text recognizer
cfg.rec_algorithm = "CRNN"
# 模型路径
# cfg.rec_model_dir = "./inference/ch_PP-OCRv3_rec_infer/"
cfg.rec_model_dir = "/opt/PaddleOCR/inference/ch_PP-OCRv4_rec_infer/"

# params for text classifier
cfg.use_angle_cls = True
# 模型路径
# cfg.cls_model_dir = "./inference/ch_ppocr_mobile_v2.0_cls_infer/"
cfg.cls_model_dir = "/opt/PaddleOCR/inference/ch_ppocr_mobile_v2.0_cls_infer/"`

表格识别 $ vim PaddleOCR/deploy/hubserving/structure_table/params.py

修改位置 `def read_params(): cfg = pp_ocr_read_params()

# params for table structure model
cfg.table_max_len = 488
# 模型路径
cfg.table_model_dir = "/opt/PaddleOCR/inference/ch_ppstructure_mobile_v2.0_SLANet_infer/"
# 语言字典,根据模型选择
# 字典文件在 PaddleOCR/ppocr/utils/dict/ 目录
cfg.table_char_dict_path = "./ppocr/utils/dict/table_structure_dict_ch.txt"
cfg.show_log = False
return cfg`

#======================================================================

$ pip uninstall protobuf -y $ pip install protobuf==3.20.2 -i https://pypi.tuna.tsinghua.edu.cn/simple/

#====================================================================== $ cd /opt/PaddleOCR/

文本检测+文本方向分类+文本识别3阶段串联服务 $ hub install deploy/hubserving/ocr_system/

表格识别服务 $ hub install deploy/hubserving/structure_table

#======================================================================

报错:Illegal instruction (core dumped) $ hub serving start -m ocr_system structure_table -p 8866

dp9212 avatar Jun 28 '24 06:06 dp9212