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

support table structure model inference #764

Merged

Conversation

hongziqi
Copy link
Contributor

@hongziqi hongziqi commented Nov 7, 2024

Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:

Motivation

The current table module in Mindocr only supports training and evaluation but lacks an inference script, limiting the ability to visualize inference results. For effective table structure recognition, integration with OCR output is typically required to generate accurate table outputs.Therefore, adding an inference script for table recognition is essential to enable visual verification and practical application of the module.

The key scripts required for this enhancement include:

  1. predict_table_structure.py: for table structure recognition.
  2. predict_table_recognition.py: to perform table recognition by combining recognized table structures with OCR results, enabling restoration into a CSV format.

Test Plan

  1. test for table structure recognition
    python tools/infer/text/predict_table_structure.py --table_algorithm TABLE_MASTER --image_dir configs/table/example.png
    image

  2. test for table recognition
    python tools/infer/text/predict_table_recognition.py --det_algorithm DB_PPOCRv3 --rec_algorithm SVTR_PPOCRv3_CH --image_dir configs/table/example.png

  • The table structure recognition results are identical to those shown above
  • The OCR recognition results are as shown below
    image
  • By combining the results from both, the table recognition is restored into a CSV format as shown below.
    image

@hongziqi hongziqi force-pushed the feat-support-table-inference branch from cd96335 to c9f808f Compare November 8, 2024 03:36
tools/infer/text/predict_table.py Outdated Show resolved Hide resolved
tools/infer/text/predict_table.py Outdated Show resolved Hide resolved
@hongziqi hongziqi force-pushed the feat-support-table-inference branch 2 times, most recently from b6a2b5f to ca38a0a Compare November 11, 2024 02:36
@hongziqi hongziqi force-pushed the feat-support-table-inference branch from ca38a0a to bf76f4e Compare November 11, 2024 02:44
@CaitinZhao CaitinZhao merged commit 9d2f8f8 into mindspore-lab:main Nov 15, 2024
2 checks passed
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.

4 participants