PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Apache License 2.0
39.34k stars 7.35k forks source link

照着文档 python 调用 paddleocr package 报错 FatalError: `Process abort signal` is detected by the operating system,求助各位 #2069

Closed suparek closed 3 years ago

suparek commented 3 years ago

https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.0/doc/doc_en/whl_en.md

centos系统 python3.6 paddleocr 2.0.2 paddlepaddle 2.0.0rc1

from paddleocr import PaddleOCR,draw_ocr

# Paddleocr supports Chinese, English, French, German, Korean and Japanese.
# You can set the parameter `lang` as `ch`, `en`, `french`, `german`, `korean`, `japan`
# to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True,use_gpu=False, lang='ch') # need to run only once to download and load model into memory
img_path = './tmp.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

错误信息:

--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0   paddle::AnalysisPredictor::Run(std::vector<paddle::PaddleTensor, std::allocator<paddle::PaddleTensor> > const&, std::vector<paddle::PaddleTensor, std::allocator<paddle::PaddleTensor> >*, int)
1   paddle::framework::NaiveExecutor::Run()
2   paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&)
3   paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const
4   paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const
5   std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, double> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&)
6   paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const
7   cblas_sgemm
8   sgemm
9   mkl_blas_sgemm
10  mkl_serv_get_num_stripes
11  omp_get_num_procs
12  paddle::framework::SignalHandle(char const*, int)
13  paddle::platform::GetCurrentTraceBackString()

----------------------
Error Message Summary:
----------------------
FatalError: `Process abort signal` is detected by the operating system.
  [TimeInfo: *** Aborted at 1613980216 (unix time) try "date -d @1613980216" if you are using GNU date ***]
  [SignalInfo: *** SIGABRT (@0x3f1000139a6) received by PID 80294 (TID 0x7f5e47933740) from PID 80294 ***]

paddlepaddle 用 2.0.0 还是会报这样的错。

LDOUBLEV commented 3 years ago

你用的是哪个分支的PaddleOCR,如果是dygraph分支或者release/2.0分支,安装 paddle2.0.0 版本吧

LDOUBLEV commented 3 years ago

安装完成后您可以使用 python 或 python3 进入python解释器,输入import paddle ,再输入 paddle.utils.run_check()

如果出现PaddlePaddle is installed successfully!,说明您已成功安装

suparek commented 3 years ago

你用的是哪个分支的PaddleOCR,如果是dygraph分支或者release/2.0分支,安装 paddle2.0.0 版本吧

直接 pip install "paddleocr>=2.0.1" 安装的,import paddle; paddle.utils.run_check() 是没问题的,PaddlePaddle is installed successfully!

需要降级到 paddle2.0.0?

suparek commented 3 years ago

你用的是哪个分支的PaddleOCR,如果是dygraph分支或者release/2.0分支,安装 paddle2.0.0 版本吧

文档这么写的 image

LDOUBLEV commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧

paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl
suparek commented 3 years ago

你用的是哪个分支的PaddleOCR,如果是dygraph分支或者release/2.0分支,安装 paddle2.0.0 版本吧

paddleocr 2.0.2 paddlepaddle 用 2.0.0 还是会报这样的错。

LDOUBLEV commented 3 years ago

你用的是哪个分支的PaddleOCR,如果是dygraph分支或者release/2.0分支,安装 paddle2.0.0 版本吧

paddleocr 2.0.2 paddlepaddle 用 2.0.0 还是会报这样的错。

import paddle paddle.utils.run_check()

运行上面代码有问题吗

suparek commented 3 years ago

你用的是哪个分支的PaddleOCR,如果是dygraph分支或者release/2.0分支,安装 paddle2.0.0 版本吧

paddleocr 2.0.2 paddlepaddle 用 2.0.0 还是会报这样的错。

import paddle paddle.utils.run_check()

运行上面代码有问题吗

没有问题,是成功的。

LDOUBLEV commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧

paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

suparek commented 3 years ago

https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.0/doc/doc_en/whl_en.md

centos系统 python3.6 paddleocr 2.0.2 paddlepaddle 2.0.0rc1

from paddleocr import PaddleOCR,draw_ocr

# Paddleocr supports Chinese, English, French, German, Korean and Japanese.
# You can set the parameter `lang` as `ch`, `en`, `french`, `german`, `korean`, `japan`
# to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True,use_gpu=False, lang='ch') # need to run only once to download and load model into memory
img_path = './tmp.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

错误信息:

--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0   paddle::AnalysisPredictor::Run(std::vector<paddle::PaddleTensor, std::allocator<paddle::PaddleTensor> > const&, std::vector<paddle::PaddleTensor, std::allocator<paddle::PaddleTensor> >*, int)
1   paddle::framework::NaiveExecutor::Run()
2   paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&)
3   paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const
4   paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const
5   std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, double> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&)
6   paddle::operators::GemmConvKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const
7   cblas_sgemm
8   sgemm
9   mkl_blas_sgemm
10  mkl_serv_get_num_stripes
11  omp_get_num_procs
12  paddle::framework::SignalHandle(char const*, int)
13  paddle::platform::GetCurrentTraceBackString()

----------------------
Error Message Summary:
----------------------
FatalError: `Process abort signal` is detected by the operating system.
  [TimeInfo: *** Aborted at 1613980216 (unix time) try "date -d @1613980216" if you are using GNU date ***]
  [SignalInfo: *** SIGABRT (@0x3f1000139a6) received by PID 80294 (TID 0x7f5e47933740) from PID 80294 ***]

paddlepaddle 用 2.0.0 还是会报这样的错。

@LDOUBLEV 不知道错误信息是不是能看出来什么?

suparek commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧 paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

这看来需要点时间,我编译安装一下试试。

suparek commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧 paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

编译安装完了,试了,还是报一样的错误。

suparek commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧 paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

版本都没问题

image

LDOUBLEV commented 3 years ago

明天给你反馈

sellinaxmj commented 3 years ago

Successfully installed paddleocr-2.0.2 Successfully installed paddlepaddle-2.0.0 也按上面说的来的。运行“ python3 ./tools/infer/predict_det.py --image_dir="./doc/imgs/12.jpg" --det_model_dir="./inference/det_db/" ”还是会报 ...8 cblas_sgemm 9 sgemm 10 mkl_blas_sgemm 11 mkl_serv_get_num_stripes 12 omp_get_num_procs 13 paddle::framework::SignalHandle(char const*, int) 14 paddle::platform::GetCurrentTraceBackString[abi:cxx11]()


Error Message Summary:

FatalError: Process abort signal is detected by the operating system. [TimeInfo: Aborted at 1614129659 (unix time) try "date -d @1614129659" if you are using GNU date ] [SignalInfo: SIGABRT (@0x3e800003b13) received by PID 15123 (TID 0x7f6c56769740) from PID 15123 ]

已放弃(吐核) 这样的错

LDOUBLEV commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧 paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

版本都没问题

image

感觉和你的环境有关系,我这边测试没问题,你换个测试图像还会出现报错吗, image

suparek commented 3 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧 paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

版本都没问题 image

感觉和你的环境有关系,我这边测试没问题,你换个测试图像还会出现报错吗, image

我安装的是 paddlepaddle,不是 paddlepaddle-gpu,因为我用的是cpu,不是 gpu

LDOUBLEV commented 3 years ago

我代码里use_gpu=False, 也没用GPU

import paddle
import paddleocr

from paddleocr import PaddleOCR,draw_ocr
ocr = PaddleOCR(use_angle_cls=True,use_gpu=False, lang='ch')
img_path = '/paddle/PaddleOCR/doc/imgs/1.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)
suparek commented 3 years ago

我代码里use_gpu=False, 也没用GPU

换了图片还是一样啊,难道 paddlepaddle 不能用 得用 paddlepaddle-gpu ?不会吧?

suparek commented 3 years ago

我代码里use_gpu=False, 也没用GPU

import paddle
import paddleocr

from paddleocr import PaddleOCR,draw_ocr
ocr = PaddleOCR(use_angle_cls=True,use_gpu=False, lang='ch')
img_path = '/paddle/PaddleOCR/doc/imgs/1.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

还是说你安装的 paddleslim、paddle-serving-app 这些库 也得装?

suparek commented 3 years ago

我代码里use_gpu=False, 也没用GPU

import paddle
import paddleocr

from paddleocr import PaddleOCR,draw_ocr
ocr = PaddleOCR(use_angle_cls=True,use_gpu=False, lang='ch')
img_path = '/paddle/PaddleOCR/doc/imgs/1.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

我只装了 paddleocr 和 paddlepaddle

LDOUBLEV commented 3 years ago

还是说你安装的 paddleslim、paddle-serving-app 这些库 也得装?

不用

我只装了 paddleocr 和 paddlepaddle

够了

suparek commented 3 years ago

还是说你安装的 paddleslim、paddle-serving-app 这些库 也得装?

不用

我只装了 paddleocr 和 paddlepaddle

够了

AttributeError: 'PaddleOCR' object has no attribute 'text_classifier' 请问是什么问题?

LDOUBLEV commented 3 years ago

还是说你安装的 paddleslim、paddle-serving-app 这些库 也得装?

不用

我只装了 paddleocr 和 paddlepaddle

够了

AttributeError: 'PaddleOCR' object has no attribute 'text_classifier' 请问是什么问题?

发来你的代码看下

suparek commented 3 years ago

还是说你安装的 paddleslim、paddle-serving-app 这些库 也得装?

不用

我只装了 paddleocr 和 paddlepaddle

够了

AttributeError: 'PaddleOCR' object has no attribute 'text_classifier' 请问是什么问题?

发来你的代码看下

我的参数 use_angle_cls=False 时,就会报 AttributeError: 'PaddleOCR' object has no attribute 'text_classifier',为 True 时就可以正常运行

suparek commented 3 years ago

终于找到解决办法了!那就是 python版本换成 3.7+,就能正常运行不报这个错误了。 @LDOUBLEV

@sellinaxmj 兄台也可以试试看有没有效。

suparek commented 3 years ago

终于找到解决办法了!那就是 python版本换成 3.7+,就能正常运行不报这个错误了。 @LDOUBLEV

@sellinaxmj 兄台也可以试试看有没有效。

不知道 python3.6下面为什么不好使

LDOUBLEV commented 3 years ago

好的

suparek commented 3 years ago

@LDOUBLEV 多谢阁下的指点与付出。

suparek commented 3 years ago

还是说你安装的 paddleslim、paddle-serving-app 这些库 也得装?

不用

我只装了 paddleocr 和 paddlepaddle

够了

AttributeError: 'PaddleOCR' object has no attribute 'text_classifier' 请问是什么问题?

发来你的代码看下

我的参数 use_angle_cls=False 时,就会报 AttributeError: 'PaddleOCR' object has no attribute 'text_classifier',为 True 时就可以正常运行

这个貌似有bug存在 @LDOUBLEV

LDOUBLEV commented 3 years ago

好的,我晚会看下,感谢反馈

sellinaxmj commented 3 years ago

终于找到解决办法了!那就是 python版本换成 3.7+,就能正常运行不报这个错误了。 @LDOUBLEV @sellinaxmj 兄台也可以试试看有没有效。

不知道 python3.6下面为什么不好使

我的是3.8阿,难道版本太高了?老兄你是是换成3.7就好使么?

suparek commented 3 years ago

终于找到解决办法了!那就是 python版本换成 3.7+,就能正常运行不报这个错误了。 @LDOUBLEV @sellinaxmj 兄台也可以试试看有没有效。

不知道 python3.6下面为什么不好使

我的是3.8阿,难道版本太高了?老兄你是是换成3.7就好使么?

我是 3.6 不好使,换成 3.7好使了。

suparek commented 3 years ago

终于找到解决办法了!那就是 python版本换成 3.7+,就能正常运行不报这个错误了。

解决办法

sellinaxmj commented 3 years ago

终于找到解决办法了!那就是 python版本换成 3.7+,就能正常运行不报这个错误了。 @LDOUBLEV @sellinaxmj 兄台也可以试试看有没有效。

不知道 python3.6下面为什么不好使

我的是3.8阿,难道版本太高了?老兄你是是换成3.7就好使么?

我是 3.6 不好使,换成 3.7好使了。

多谢大兄弟!3.8改成3.7就可以了

lexiaoyuan commented 3 years ago

有一个和上面类似的错误。 按照paddleocr package的教程,前面的步骤都没问题,到自定义模型那里时,先是出现前面提到的AttributeError: 'PaddleOCR' object has no attribute 'text_classifier'错误,设置use_angle_cls=True后解决,但接着出现了如下错误:

[2021/02/25 17:20:19] root INFO: dt_boxes num : 9, elapse : 0.5479669570922852
[2021/02/25 17:20:19] root INFO: cls num  : 9, elapse : 0.14893507957458496
Traceback (most recent call last):
  File "e:\TicketAnalysis\PaddleOCR\custom_model.py", line 6, in <module>
    result = ocr.ocr(img_path, cls=True)
  File "e:\TicketAnalysis\PaddleOCR\paddleocr.py", line 306, in ocr
    dt_boxes, rec_res = self.__call__(img)
  File "e:\TicketAnalysis\PaddleOCR\tools\infer\predict_system.py", line 109, in __call__
    rec_res, elapse = self.text_recognizer(img_crop_list)
  File "e:\TicketAnalysis\PaddleOCR\tools\infer\predict_rec.py", line 234, in __call__
    rec_result = self.postprocess_op(preds)
  File "e:\TicketAnalysis\PaddleOCR\ppocr\postprocess\rec_postprocess.py", line 117, in __call__
    text = self.decode(preds_idx, preds_prob, is_remove_duplicate=True)
  File "e:\TicketAnalysis\PaddleOCR\ppocr\postprocess\rec_postprocess.py", line 87, in decode
    char_list.append(self.character[int(text_index[batch_idx][
IndexError: list index out of range

请问怎么解决?

LDOUBLEV commented 3 years ago

有一个和上面类似的错误。 按照paddleocr package的教程,前面的步骤都没问题,到自定义模型那里时,先是出现前面提到的AttributeError: 'PaddleOCR' object has no attribute 'text_classifier'错误,设置use_angle_cls=True后解决,但接着出现了如下错误:

[2021/02/25 17:20:19] root INFO: dt_boxes num : 9, elapse : 0.5479669570922852
[2021/02/25 17:20:19] root INFO: cls num  : 9, elapse : 0.14893507957458496
Traceback (most recent call last):
  File "e:\TicketAnalysis\PaddleOCR\custom_model.py", line 6, in <module>
    result = ocr.ocr(img_path, cls=True)
  File "e:\TicketAnalysis\PaddleOCR\paddleocr.py", line 306, in ocr
    dt_boxes, rec_res = self.__call__(img)
  File "e:\TicketAnalysis\PaddleOCR\tools\infer\predict_system.py", line 109, in __call__
    rec_res, elapse = self.text_recognizer(img_crop_list)
  File "e:\TicketAnalysis\PaddleOCR\tools\infer\predict_rec.py", line 234, in __call__
    rec_result = self.postprocess_op(preds)
  File "e:\TicketAnalysis\PaddleOCR\ppocr\postprocess\rec_postprocess.py", line 117, in __call__
    text = self.decode(preds_idx, preds_prob, is_remove_duplicate=True)
  File "e:\TicketAnalysis\PaddleOCR\ppocr\postprocess\rec_postprocess.py", line 87, in decode
    char_list.append(self.character[int(text_index[batch_idx][
IndexError: list index out of range

请问怎么解决?

use_angle_cls=False的时候你把 use_cls也设置为False把,这个问题刚修了,还没merge

suparek commented 3 years ago

有一个和上面类似的错误。 按照paddleocr package的教程,前面的步骤都没问题,到自定义模型那里时,先是出现前面提到的AttributeError: 'PaddleOCR' object has no attribute 'text_classifier'错误,设置use_angle_cls=True后解决,但接着出现了如下错误:

[2021/02/25 17:20:19] root INFO: dt_boxes num : 9, elapse : 0.5479669570922852
[2021/02/25 17:20:19] root INFO: cls num  : 9, elapse : 0.14893507957458496
Traceback (most recent call last):
  File "e:\TicketAnalysis\PaddleOCR\custom_model.py", line 6, in <module>
    result = ocr.ocr(img_path, cls=True)
  File "e:\TicketAnalysis\PaddleOCR\paddleocr.py", line 306, in ocr
    dt_boxes, rec_res = self.__call__(img)
  File "e:\TicketAnalysis\PaddleOCR\tools\infer\predict_system.py", line 109, in __call__
    rec_res, elapse = self.text_recognizer(img_crop_list)
  File "e:\TicketAnalysis\PaddleOCR\tools\infer\predict_rec.py", line 234, in __call__
    rec_result = self.postprocess_op(preds)
  File "e:\TicketAnalysis\PaddleOCR\ppocr\postprocess\rec_postprocess.py", line 117, in __call__
    text = self.decode(preds_idx, preds_prob, is_remove_duplicate=True)
  File "e:\TicketAnalysis\PaddleOCR\ppocr\postprocess\rec_postprocess.py", line 87, in decode
    char_list.append(self.character[int(text_index[batch_idx][
IndexError: list index out of range

请问怎么解决?

use_angle_cls=False的时候你把 use_cls也设置为False把,这个问题刚修了,还没merge

收到

zcunyi commented 2 years ago

paddleocr 依赖paddle,先安装paddle2.0.0版本吧 paddleocr 可以尝试按照这个步骤编译安装下,可能whl包还未更新

python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl

按照这个步骤编译安装的whl包可以用吗

版本都没问题 image

感觉和你的环境有关系,我这边测试没问题,你换个测试图像还会出现报错吗, image

我的版本是: image 我也尝试了你截图里说的paddleocr ==2.0.2 我的python也是3.7,但还是有这个报错 image