Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复按照官方例子进行版面分析pdf的问题,完善了pdf文件的判断逻辑 #11984

Closed
wants to merge 15 commits into from

Conversation

guangyunms
Copy link
Contributor

按照官方例子使用,进行pdf版面分析直接报错

  1. 相关逻辑有缺陷,check_img函数应当返回它判断gif和pdf的结果,而不应该只返回img。
  2. 判断pdf用的是if isinstance(img, list),最好加上flag_pdf的判断。
  3. 直接使用就报错太打击信心了,相信有挺多人进行pdf的版面分析的,应该及时补上判断逻辑。
  4. 最后返回的多个res合并成一个list。

Copy link

paddle-bot bot commented Apr 22, 2024

Thanks for your contribution!

@guangyunms
Copy link
Contributor Author

报错代码:


import os
import cv2
from paddleocr import PPStructure,save_structure_res

table_engine = PPStructure(table=False, ocr=True, show_log=True, structure_version='PP-StructureV2')

save_folder = '~/output'
img_path = '/home/aistudio/work/3D Infomax improves GNNs for Molecular Property Prediction.pdf'
# img = cv2.imread(img_path)
result = table_engine(img_path)
print(result)
save_structure_res(result, save_folder, os.path.basename(img_path).split('.')[0])

for line in result:
    line.pop('img')
    print(line)

@CLAassistant
Copy link

CLAassistant commented Apr 22, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@GreatV GreatV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 麻烦解决一下冲突;
  2. 麻烦把commit message改成英文;
  3. 为什么要判断gif,其他类型不用判断吗?
  4. 麻烦把对应的issue链接也贴上(如果有的话)。

@guangyunms
Copy link
Contributor Author

  1. 解决了冲突,麻烦审查一下。
  2. commit message已换成英文。
  3. 判断的是pdf,其它的文件类型如图片或者gif都是单page类型,所以不会出现问题,只有pdf一般都会有多个page,且此应用场景也很常见。
  4. issue #11982

@guangyunms guangyunms requested a review from GreatV April 24, 2024 06:52
@GreatV
Copy link
Collaborator

GreatV commented Apr 24, 2024

最好把第一个commit也给改一下
image

@GreatV
Copy link
Collaborator

GreatV commented Apr 24, 2024

所有的pdf都有这个问题吗,还是特定的pdf存在这个问题,如果是特定的pdf存在这个问题,麻烦提供一下可复现的pdf文件,我测试一下,没问题的话就可以合入了。

@guangyunms
Copy link
Contributor Author

  1. @GreatV 我commit信息混乱,估计会对你们的工作造成干扰,且中间大量不必要的commit。不知是否方便我重新提交一个干净的PR。
  2. 应该是所有的pdf都有这个问题,您可以试一下。

@guangyunms
Copy link
Contributor Author

此外,我再将我的例子加到对应的README文件里,方便参考。

@GreatV
Copy link
Collaborator

GreatV commented Apr 24, 2024

  1. @GreatV 我commit信息混乱,估计会对你们的工作造成干扰,且中间大量不必要的commit。不知是否方便我重新提交一个干净的PR。
  2. 应该是所有的pdf都有这个问题,您可以试一下。

@guangyunms 可以的

@guangyunms
Copy link
Contributor Author

  1. @GreatV 我commit信息混乱,估计会对你们的工作造成干扰,且中间大量不必要的commit。不知是否方便我重新提交一个干净的PR。
  2. 应该是所有的pdf都有这个问题,您可以试一下。

@guangyunms 可以的

好的,我接下来会重新提交新的PR。

@guangyunms guangyunms closed this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants