Skip to content

开启印章识别,识别多页pdf报错list index out of range,单页pdf正常 #16644

@yinkaisheng

Description

@yinkaisheng

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

使用下面代码识别多页pdf会报错退出(如下图),识别单页pdf运行正常

pp_structure_v3 = PPStructureV3(
            device='cpu',
            use_doc_orientation_classify=False, # 是否加载并使用文档方向分类模块,支持0、90、180、270度的图片
            use_doc_unwarping=False, # 是否加载并使用文本图像矫正模块,使用后可以矫正扭曲图片,例如褶皱、倾斜等情况
            use_textline_orientation=False, # 是否加载并使用文本行方向分类模块,支持0度和180度的文本行的区分和矫正
            use_seal_recognition = True, # 是否加载并使用印章识别子产线
            use_table_recognition = False, # 是否加载并使用表格识别子产线
            use_formula_recognition = False, # 是否加载并使用公式识别子产线
            use_chart_recognition = False, # 是否加载并使用图表识别子产线
            use_region_detection = True, # 是否加载并使用文档区域检测模块
            layout_threshold = 0.4,
            layout_nms = True,
            layout_unclip_ratio = 1.0,
            layout_merge_bboxes_mode = 'large', # 'large', 'small', 'union'

        )
pp_structure_v3.predict('0001-158-2.pdf')

pdf文件:0001-158-2.pdf

Windows
Image
Linux
Image

  File "D:\Python312x64\Lib\site-packages\paddlex\inference\pipelines\_parallel.py", line 129, in predict
    yield from self._pipeline.predict(
  File "D:\Python312x64\Lib\site-packages\paddlex\inference\pipelines\seal_recognition\pipeline.py", line 262, in predict
    layout_det_res = list(external_layout_det_results)[0]
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

希望参数不填用默认值不应该异常退出,请帮忙看看。

🏃‍♂️ Environment (运行环境)

OS: Windows10
Python: 3.12.10
PaddleOcr: 3.2.0
Paddlex: 3.2.1
使用cpu
OS: Ubuntu 22.04
Python: 3.12.11
PaddleOcr: 3.2.0
Paddlex: 3.2.1
CUDA: 12.9

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

pp_structure_v3 = PPStructureV3(
            device='cpu',
            use_doc_orientation_classify=False, # 是否加载并使用文档方向分类模块,支持0、90、180、270度的图片
            use_doc_unwarping=False, # 是否加载并使用文本图像矫正模块,使用后可以矫正扭曲图片,例如褶皱、倾斜等情况
            use_textline_orientation=False, # 是否加载并使用文本行方向分类模块,支持0度和180度的文本行的区分和矫正
            use_seal_recognition = True, # 是否加载并使用印章识别子产线
            use_table_recognition = False, # 是否加载并使用表格识别子产线
            use_formula_recognition = False, # 是否加载并使用公式识别子产线
            use_chart_recognition = False, # 是否加载并使用图表识别子产线
            use_region_detection = True, # 是否加载并使用文档区域检测模块
            layout_threshold = 0.4,
            layout_nms = True,
            layout_unclip_ratio = 1.0,
            layout_merge_bboxes_mode = 'large', # 'large', 'small', 'union'

        )
pp_structure_v3.predict('0001-158-2.pdf')

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions