Closed kiufta closed 1 year ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Hello! I had similar issue after applying custom model for paddleocr. The error raised from custom_ocr=custom_ocr = PaddleOCR( ... )
The following was entire error message and the code after that.
--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0 paddle_infer::Predictor::Predictor(paddle::AnalysisConfig const&)
1 std::unique_ptr<paddle::PaddlePredictor, std::default_delete<paddle::PaddlePredictor> > paddle::CreatePaddlePredictor<paddle::AnalysisConfig, (paddle::PaddleEngineKind)2>(paddle::AnalysisConfig const&)
2 paddle::AnalysisPredictor::Init(std::shared_ptr<paddle::framework::Scope> const&, std::shared_ptr<paddle::framework::ProgramDesc> const&)
3 paddle::AnalysisPredictor::PrepareProgram(std::shared_ptr<paddle::framework::ProgramDesc> const&)
4 paddle::AnalysisPredictor::OptimizeInferenceProgram()
5 paddle::inference::analysis::Analyzer::RunAnalysis(paddle::inference::analysis::Argument*)
6 paddle::inference::analysis::IrAnalysisPass::RunImpl(paddle::inference::analysis::Argument*)
7 paddle::inference::analysis::IRPassManager::Apply(std::unique_ptr<paddle::framework::ir::Graph, std::default_delete<paddle::framework::ir::Graph> >)
8 paddle::framework::ir::Pass::Apply(paddle::framework::ir::Graph*) const
9 paddle::framework::ir::SelfAttentionFusePass::ApplyImpl(paddle::framework::ir::Graph*) const
10 paddle::framework::ir::GraphPatternDetector::operator()(paddle::framework::ir::Graph*, std::function<void (std::map<paddle::framework::ir::PDNode*, paddle::framework::ir::Node*, paddle::framework::ir::GraphPatternDetector::PDNodeCompare, std::allocator<std::pair<paddle::framework::ir::PDNode* const, paddle::framework::ir::Node*> > > const&, paddle::framework::ir::Graph*)>)
----------------------
Error Message Summary:
----------------------
FatalError: `Illegal instruction` is detected by the operating system.
[TimeInfo: *** Aborted at 1708043256 (unix time) try "date -d @1708043256" if you are using GNU date ***]
[SignalInfo: *** SIGILL (@0x7f56e0a1e86a) received by PID 468056 (TID 0x7f56e8434200) from PID 18446744073183291498 ***]
Illegal instruction (core dumped)
The code to run
from paddleocr import PaddleOCR,draw_ocr
from PIL import Image
import cv2
import matplotlib.pyplot as plt
#Loading the detector and ocr with the previously trained weights
#### the error raised from PaddleOCR function. #####
custom_ocr = PaddleOCR(use_angle_cls=True,
lang="en",
rec_model_dir='.output/en_PP-OCRv3_rec_inference',
det_model_dir='./output/det_db_inference',
rec_char_dict_path='./ppocr/utils/en_dict.txt',
use_gpu=False,
show_log=False)
# ocr = PaddleOCR(use_angle_cls=True, lang="en")
img_path = "./img1006.jpg"
img = cv2.imread(img_path)
plt.imshow(img)
# plt.show()
result = custom_ocr.ocr(img)
# result = ocr.ocr(img)
result = result[0]
# draw result
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='./doc/fonts/simfang.ttf')
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
im_show
(django-env) [root@localhost temp]# paddleocr --image_dir fapiao.png --use_angle_cls true [2024/02/28 14:28:42] ppocr DEBUG: Namespace(alpha=1.0, alphacolor=(255, 255, 255), benchmark=False, beta=1.0, binarize=False, cls_batch_num=6, cls_image_shape='3, 48, 192', cls_model_dir='/root/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_thresh=0.9, cpu_threads=10, crop_res_save_dir='./output', det=True, det_algorithm='DB', det_box_type='quad', det_db_box_thresh=0.6, det_db_score_mode='fast', det_db_thresh=0.3, det_db_unclip_ratio=1.5, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_east_score_thresh=0.8, det_limit_side_len=960, det_limit_type='max', det_model_dir='/root/.paddleocr/whl/det/ch/ch_PP-OCRv4_det_infer', det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, det_pse_thresh=0, det_sast_nms_thresh=0.2, det_sast_score_thresh=0.5, draw_img_save_dir='./inference_results', drop_score=0.5, e2e_algorithm='PGNet', e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_limit_side_len=768, e2e_limit_type='max', e2e_model_dir=None, e2e_pgnet_mode='fast', e2e_pgnet_score_thresh=0.5, e2e_pgnet_valid_set='totaltext', enable_mkldnn=False, fourier_degree=5, gpu_id=0, gpu_mem=500, help='==SUPPRESS==', image_dir='fapiao.png', image_orientation=False, invert=False, ir_optim=True, kie_algorithm='LayoutXLM', label_list=['0', '180'], lang='ch', layout=True, layout_dict_path=None, layout_model_dir=None, layout_nms_threshold=0.5, layout_score_threshold=0.5, max_batch_size=10, max_text_length=25, merge_no_span_structure=True, min_subgraph_size=15, mode='structure', ocr=True, ocr_order_method=None, ocr_version='PP-OCRv4', output='./output', page_num=0, precision='fp32', process_id=0, re_model_dir=None, rec=True, rec_algorithm='SVTR_LCNet', rec_batch_num=6, rec_char_dict_path='/root/miniconda3/lib/python3.8/site-packages/paddleocr/ppocr/utils/ppocr_keys_v1.txt', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_model_dir='/root/.paddleocr/whl/rec/ch/ch_PP-OCRv4_rec_infer', recovery=False, save_crop_res=False, save_log_path='./log_output/', scales=[8, 16, 32], ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ser_model_dir=None, show_log=True, sr_batch_num=1, sr_image_shape='3, 32, 128', sr_model_dir=None, structure_version='PP-StructureV2', table=True, table_algorithm='TableAttn', table_char_dict_path=None, table_max_len=488, table_model_dir=None, total_process_num=1, type='ocr', use_angle_cls=True, use_dilation=False, use_gpu=False, use_mp=False, use_npu=False, use_onnx=False, use_pdf2docx_api=False, use_pdserving=False, use_space_char=True, use_tensorrt=False, use_visual_backbone=True, use_xpu=False, vis_font_path='./doc/fonts/simfang.ttf', warmup=False)
0 paddle_infer::Predictor::Predictor(paddle::AnalysisConfig const&)
1 std::unique_ptr<paddle::PaddlePredictor, std::default_delete
FatalError: Illegal instruction
is detected by the operating system.
[TimeInfo: Aborted at 1709101723 (unix time) try "date -d @1709101723" if you are using GNU date ]
[SignalInfo: SIGILL (@0x7f3e12232e0a) received by PID 58931 (TID 0x7f3e1fe4c740) from PID 304295434 ]
非法指令(吐核) (django-env) [root@localhost temp]#
Hello! I had similar issue after applying custom model for paddleocr. The error raised from custom_ocr=custom_ocr = PaddleOCR( ... )
The following was entire error message and the code after that.
-------------------------------------- C++ Traceback (most recent call last): -------------------------------------- 0 paddle_infer::Predictor::Predictor(paddle::AnalysisConfig const&) 1 std::unique_ptr<paddle::PaddlePredictor, std::default_delete<paddle::PaddlePredictor> > paddle::CreatePaddlePredictor<paddle::AnalysisConfig, (paddle::PaddleEngineKind)2>(paddle::AnalysisConfig const&) 2 paddle::AnalysisPredictor::Init(std::shared_ptr<paddle::framework::Scope> const&, std::shared_ptr<paddle::framework::ProgramDesc> const&) 3 paddle::AnalysisPredictor::PrepareProgram(std::shared_ptr<paddle::framework::ProgramDesc> const&) 4 paddle::AnalysisPredictor::OptimizeInferenceProgram() 5 paddle::inference::analysis::Analyzer::RunAnalysis(paddle::inference::analysis::Argument*) 6 paddle::inference::analysis::IrAnalysisPass::RunImpl(paddle::inference::analysis::Argument*) 7 paddle::inference::analysis::IRPassManager::Apply(std::unique_ptr<paddle::framework::ir::Graph, std::default_delete<paddle::framework::ir::Graph> >) 8 paddle::framework::ir::Pass::Apply(paddle::framework::ir::Graph*) const 9 paddle::framework::ir::SelfAttentionFusePass::ApplyImpl(paddle::framework::ir::Graph*) const 10 paddle::framework::ir::GraphPatternDetector::operator()(paddle::framework::ir::Graph*, std::function<void (std::map<paddle::framework::ir::PDNode*, paddle::framework::ir::Node*, paddle::framework::ir::GraphPatternDetector::PDNodeCompare, std::allocator<std::pair<paddle::framework::ir::PDNode* const, paddle::framework::ir::Node*> > > const&, paddle::framework::ir::Graph*)>) ---------------------- Error Message Summary: ---------------------- FatalError: `Illegal instruction` is detected by the operating system. [TimeInfo: *** Aborted at 1708043256 (unix time) try "date -d @1708043256" if you are using GNU date ***] [SignalInfo: *** SIGILL (@0x7f56e0a1e86a) received by PID 468056 (TID 0x7f56e8434200) from PID 18446744073183291498 ***] Illegal instruction (core dumped)
The code to run
from paddleocr import PaddleOCR,draw_ocr from PIL import Image import cv2 import matplotlib.pyplot as plt #Loading the detector and ocr with the previously trained weights #### the error raised from PaddleOCR function. ##### custom_ocr = PaddleOCR(use_angle_cls=True, lang="en", rec_model_dir='.output/en_PP-OCRv3_rec_inference', det_model_dir='./output/det_db_inference', rec_char_dict_path='./ppocr/utils/en_dict.txt', use_gpu=False, show_log=False) # ocr = PaddleOCR(use_angle_cls=True, lang="en") img_path = "./img1006.jpg" img = cv2.imread(img_path) plt.imshow(img) # plt.show() result = custom_ocr.ocr(img) # result = ocr.ocr(img) result = result[0] # draw result image = Image.open(img_path).convert('RGB') boxes = [line[0] for line in result] txts = [line[1][0] for line in result] scores = [line[1][1] for line in result] im_show = draw_ocr(image, boxes, txts, scores, font_path='./doc/fonts/simfang.ttf') im_show = Image.fromarray(im_show) im_show.save('result.jpg') im_show
Is there any update for this problem?
I had similar issue while using paddleocr along with multiprocessing, but it tells Termination signal
No stack trace in paddle, may be caused by external reasons.
FatalError: Termination signal
is detected by the operating system.
[TimeInfo: Aborted at 1710392015 (unix time) try "date -d @1710392015" if you are using GNU date ]
[SignalInfo: SIGTERM (@0x3e90000cedc) received by PID 53174 (TID 0x7ea416a6db80) from PID 52956 ]
0 paddle::AnalysisPredictor::~AnalysisPredictor()
1 paddle::AnalysisPredictor::~AnalysisPredictor()
2 std::_Sp_counted_base<(gnu_cxx::_Lock_policy)2>::_M_release()
3 paddle::framework::OpDesc::~OpDesc()
4 std::_Hashtable<std::string, std::pair<std::string const, paddle::variant<paddle::blank, int, float, std::string, std::vector<int, std::allocator
FatalError: Termination signal
is detected by the operating system.
[TimeInfo: Aborted at 1710392015 (unix time) try "date -d @1710392015" if you are using GNU date ]
[SignalInfo: SIGTERM (@0x3e90000cedc) received by PID 53176 (TID 0x72ef72873b80) from PID 52956 ]
paddleocr 2.7.0.3 paddlepaddle 2.6.1
0 paddle_infer::Predictor::Predictor(paddle::AnalysisConfig const&)
1 std::unique_ptr<paddle::PaddlePredictor, std::default_delete
FatalError: Illegal instruction
is detected by the operating system.
[TimeInfo: Aborted at 1711072502 (unix time) try "date -d @1711072502" if you are using GNU date ]
[SignalInfo: SIGILL (@0x7fddeb44c13a) received by PID 1607 (TID 0x7fde2343f740) from PID 18446744073361735994 ]
/tmp/tmp7h6uav3o: 行 3: 1607 非法指令 (吐核)python /home/leavor/project/llm_ocr/ocr.py
ERROR conda.cli.main_run:execute(124): conda run python /home/leavor/project/llm_ocr/ocr.py
failed. (See above for error)
I downgraded the version of paddlepaddle to 2.5.2 and the issue was solved
Same issue here.
OS info (Ubuntu 22.04.4 on WSL2)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
Installed cpu version of paddlepaddle and paddleocr below.
$ pip freeze | grep paddle
paddleocr==2.7.2
paddlepaddle==2.6.0
$ python -V
Python 3.11.8
I downloaded the ppocr_img.zip and test run it paddleocr --image_dir ./imgs/11.jpg --use_angle_cls true --use_gpu false
, paddleocr has crashes info below
[2024/03/31 00:17:16] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir='./imgs/11.jpg', page_num=0, det_algorithm='DB', det_model_dir='/home/james/.paddleocr/whl/det/ch/ch_PP-OCRv4_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='/home/james/.paddleocr/whl/rec/ch/ch_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='/home/james/.pyenv/versions/3.11.8/envs/paddle_test/lib/python3.11/site-packages/paddleocr/ppocr/utils/ppocr_keys_v1.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=True, cls_model_dir='/home/james/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='ch', det=True, rec=True, type='ocr', ocr_version='PP-OCRv4', structure_version='PP-StructureV2')
--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0 paddle_infer::Predictor::Predictor(paddle::AnalysisConfig const&)
1 std::unique_ptr<paddle::PaddlePredictor, std::default_delete<paddle::PaddlePredictor> > paddle::CreatePaddlePredictor<paddle::AnalysisConfig, (paddle::PaddleEngineKind)2>(paddle::AnalysisConfig const&)
2 paddle::AnalysisPredictor::Init(std::shared_ptr<paddle::framework::Scope> const&, std::shared_ptr<paddle::framework::ProgramDesc> const&)
3 paddle::AnalysisPredictor::PrepareProgram(std::shared_ptr<paddle::framework::ProgramDesc> const&)
4 paddle::AnalysisPredictor::OptimizeInferenceProgram()
5 paddle::inference::analysis::Analyzer::RunAnalysis(paddle::inference::analysis::Argument*)
6 paddle::inference::analysis::IrAnalysisPass::RunImpl(paddle::inference::analysis::Argument*)
7 paddle::inference::analysis::IRPassManager::Apply(std::unique_ptr<paddle::framework::ir::Graph, std::default_delete<paddle::framework::ir::Graph> >)
8 paddle::framework::ir::Pass::Apply(paddle::framework::ir::Graph*) const
9 paddle::framework::ir::SelfAttentionFusePass::ApplyImpl(paddle::framework::ir::Graph*) const
10 paddle::framework::ir::GraphPatternDetector::operator()(paddle::framework::ir::Graph*, std::function<void (std::map<paddle::framework::ir::PDNode*, paddle::framework::ir::Node*, paddle::framework::ir::GraphPatternDetector::PDNodeCompare, std::allocator<std::pair<paddle::framework::ir::PDNode* const, paddle::framework::ir::Node*> > > const&, paddle::framework::ir::Graph*)>)
----------------------
Error Message Summary:
----------------------
FatalError: `Illegal instruction` is detected by the operating system.
[TimeInfo: *** Aborted at 1711815437 (unix time) try "date -d @1711815437" if you are using GNU date ***]
[SignalInfo: *** SIGILL (@0x7f1a8482040a) received by PID 227658 (TID 0x7f1a8b0f7b80) from PID 18446744071637697546 ***]
Illegal instruction
Same issue here. In docker(python:3.11-bookworm)
paddleocr==2.8.0
paddlepaddle==2.6.1
Upgrade paddlepaddle to latest version, work fine.
pip install paddlepaddle==3.0.0b1
请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
python setup.py build
import paddle works:<module 'paddle' from '/usr/lib/python3.10/site-packages/paddle/__init__.py'>
PaddlePaddle self-check is positive: