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

1.在ppstructure管道中添加latex_ocr公式识别功能;2.添加pdf转markdown文件功能 #13868

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ztyf-lq
Copy link

@ztyf-lq ztyf-lq commented Sep 13, 2024

前言

尊敬的 ppocr 官方人员您好,我是一名 ppocr 项目的使用者,在日常工作学习中我都会用到ppocr,我深感 ppocr 的强大之处!同时能为 ppocr 做贡献也是我非常想要做的事情。非常期待您在百忙之中看看我写的代码是否是 ppocr 所需要的。

改动如下:

  1. ppstructure 管道中添加 latex_ocr 公式识别功能;
    a. 修改 ppstructure/predict_system.py 文件中 StructureSystem 类,添加 latex_ocr 模型和布局为公式的区域处理;
    b. 由于 docx 中不支持插入 latex 公式,在 ppstructure/recovery/recovery_to_doc.py 文件中 convert_info_docx 函数中跳过latex公式;
    c. 在 ppstructure/utility.pydraw_structure_result 函数中可视化 ocr 结果中跳过 latex 公式;
  2. 添加 pdf 转 markdown 文件功能
    a. 在目录 ppstructure/recovery 下添加文件 recovery_to_markdown.py,其中程序功能为转换ppstructure识别结果为markdown文件。其中对于文本区域处理目前给出了两种处理方法,第一种为每一个自然段分割标志位开头两个空格,第二种为每个自然段开头没有空格,这种情况下以每个自然段最后一行一般不会是“满行”,而是会留有空余空间;
    b. ppstructure/predict_system.py 文件中调用转换 ppstructure 识别结果到 markdown 文件的函数;
  3. 添加必要的命令行参数选项;
    a. 添加 latex_ocr 公式识别模型必要的参数;
    b. 添加 recovery_to_markdown 选项达到开启/关闭转换 ppstructure 识别结果到 markdown 文件;
    c. 添加 formula 选项达到开启/关闭latex公式识别;

如果我的代码恰巧是 ppocr 所需要的,后续我会跟进官方人员的建议并且在版面恢复文档中添加 pdf 转 markdown 文件的教程。

@CLAassistant
Copy link

CLAassistant commented Sep 13, 2024

CLA assistant check
All committers have signed the CLA.

@GreatV
Copy link
Collaborator

GreatV commented Sep 13, 2024

感谢大佬的贡献

@GreatV
Copy link
Collaborator

GreatV commented Sep 13, 2024

@liuhongen1234567 大佬,麻烦review一下这个PR。

@ztyf-lq
Copy link
Author

ztyf-lq commented Sep 20, 2024

您好,我后续有更新文档的打算,最近可能使用ppocr复现其他的项目,更新文档的时间最晚会在十月。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants