Repository navigation
[models] Assemble table grids from cells and page words, add TablePredictor.predict_regions and new TableCenterNet checkpoint - #2222
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2222 +/- ##
==========================================
+ Coverage 97.86% 98.16% +0.29%
==========================================
Files 171 172 +1
Lines 11774 11974 +200
==========================================
+ Hits 11523 11754 +231
+ Misses 251 220 -31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
felixdittrich92
marked this pull request as ready for review
November 11, 2026 11:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tables are now assembled from the predicted cells and the words of the page, so the grid follows the text: missed cells, header rows and totals outside the predicted cells are added, rows the model split are merged, and rows it merged are split along their text lines.
Changes
Table assembly
doctr/models/table_structure/grid.py:fill_table_grid: assigns every word of a table to a cell, completes the grid with the words lying in no cell, merges split rows / columns, removes the ones without text and splits merged rows along their text linesassemble_page_table: applies it to a table given in page coordinates (straight or rotated)TablePredictor.predict_regions(pages, regions, word_boxes, class_name): crops the table regions of a layout prediction, drops the cells centered in the context margin, indexes rows / columns from the cell edges and returns the tables in page coordinates, each cell listing its word indices in reading order. It replacesOCRPredictor._tables_from_regions.DocumentBuilder._build_tablesdelegates toassemble_page_table; the word-assignment helpers of the builder are removed.TableCenterNet
tablecenternet-b0d6f603.pt_vote_line_indicesis replaced by_index_lines: grid lines are indexed from the geometry only; the model logic gives the axis direction and the absolute offsetgeometric_logic=True; the geometric re-indexing moved toTablePredictor.predict_regionsReading order
Docs & tests
predict_regionsadded to the API reference and the user guidepredict_regions,_index_linesand the two reading-order casesBehaviour changes
TableCell.objectness_scoreisNonefor a cell made from words;Table.confidenceis the mean over the scored cellsTablePredictorreturns the logical coordinates of the model (no geometric re-indexing)OCRPredictor._tables_from_regionsand theDocumentBuildertable helpers (_assign_cell_words,_table_grids,_localize_logic, ...);_build_tablestakes apage_shape