Back to paper library
Paper notesarXiv 2019ECCV 2020

PubTabNet

Cells Out of Place

Original paper

Image-based table recognition: data, model, and evaluation

Paper authors

Xu Zhong · Elaheh ShafieiBavani · Antonio Jimeno Yepes

Publication
ECCV 2020Conference
First submitted to arXiv
arXiv:1911.10683
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{documentunderstandingpubtabnet2019,
  title = {{Image-based table recognition: data, model, and evaluation}},
  author = {Xu Zhong and Elaheh ShafieiBavani and Antonio Jimeno Yepes},
  year = {2019},
  eprint = {1911.10683},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.10683}
}
On this page

Moving a table from a paper into a spreadsheet is a chore plenty of people have probably done by hand.

If what you have is a text-based PDF, there are tools such as Tabula and Camelot to try; they read the text coordinates in the PDF and then guess which words belong to the same cell. But faced with a scan, a screenshot, or a table whose header has several layers of merged cells, these tools can easily tear the whole table to pieces.

This paper comes from a team at IBM Research Australia. Only a few months earlier, the same team had built the layout analysis dataset PubLayNet; this time they turned the same method toward tables and produced a dataset, PubTabNet, a model, EDD, and, while they were at it, an evaluation metric, TEDS.

Of the three, the one with the longest-lasting influence is the last, the metric.

Defining the Problem

The authors first divide table-related work into three kinds:

  • Table detection: find the boxes of the tables on a full document page.
  • Table structure recognition: recover only the structure of rows, columns and merged cells.
  • Table recognition: recover both the structure and the text in every cell.

This paper does the third kind, and from images only.

At the time, the data available for training was either too small or missing something. The ICDAR 2013 table competition labeled both structure and content but had only 156 tables; ICDAR 2019 had 3.6k, but labeled only the cell positions and not the text inside them; TableBank was large, but its structure part had no text content. For learning "image to table" with deep learning, there simply wasn't enough paired data.

On the modeling side, the closest approach came from image-to-markup. Deng et al.'s WYGIWYS used an attention-based encoder-decoder to turn images of math formulas into LaTeX; the same model was later used to turn table images into LaTeX, with results that can only be called mediocre. A table's output sequence is long and messy, with the table structure and the cell text all crammed into one decoder.

Evaluation had problems too. Competitions at the time often used an "adjacency relation" metric. It flattens a table into a list of relations of the form "which cell is to the right of this one, and which is below it," considering only non-empty cells, and then compares prediction and ground truth by precision, recall and F1.

The authors point out its two loopholes:

  1. It only looks at directly adjacent non-empty cells. An empty cell in the wrong place, or a cell shifted several cells over, barely shows up.
  2. A relation has to match exactly to count. Get one letter wrong in a cell's text and every relation involving that cell counts as wrong; there is no score for "slightly off."

Where does the data come from? How does a model recover structure and text together? And how should the score be computed? This paper takes on all three at once.

Solving the Problem

Fishing 560,000 Tables Out of PubMed

PubMed Central's open-access subset (PMCOA) contains over a million papers, each with both a PDF and structured XML. The tables in the XML are already HTML-like markup; as long as you can find where a table sits in the PDF, you get both "the table image" and "its HTML."

To find the position, the authors simply reuse PubLayNet's matching algorithm. Table regions are converted to images at 72 PPI, a deliberately low resolution, to relax the model's demands on input quality.

Automatic matching is bound to get some pairs wrong, so every table has to pass a check. The text extracted from inside the box in the PDF is compared with the text in the XML annotation: the cosine similarity of their TF-IDF features must exceed 90%, and the difference in length between the two must be under 10%, for the box to count.

Then comes a series of clean-ups:

  • Tables where any cell spans more than 10 rows or 10 columns are removed, and so are tables using any character that appears fewer than 50 times across all tables.
  • Tables containing math formula nodes are removed, because those are written inconsistently in the XML.
  • Things that can't be seen in the image are deleted, such as hyperlinks and abbreviation definitions.
  • Some journals mark header cells with th and others with td; all are unified to td, and their header status is kept by their position under thead.
  • Every attribute on td other than rowspan and colspan is dropped, since the rest only govern how things look in a browser.

Finally the data is split 60/20/20 into training, development and test sets, with 548,592 tables in the training set.

There is a small detail here. Tables with merged cells are only a minority, so scoring on the raw test set would let simple tables dominate the result. The authors also drew 5,000 tables with spanning cells and 5,000 without from each of the development and test sets to form balanced versions. Everywhere below, "simple" and "complex" mean without and with merged cells.

One Reads the Structure, One Reads the Text

Original Fig. 1: the EDD architecture. At the top, the table image enters the Encoder; in the middle, the blue structure decoder produces one structure token per step through attention A_s and a recurrent unit R_s, in the order <thead>, <tr>, <td>, </td>, <td>, </td>; each time it produces <td>, a green arrow sends the structure decoder's state down to the red cell decoder below, whose A_c and R_c produce D, o, g or C, a, t one character at a time; at the bottom is the merged output <thead><tr><td>Dog…</td>…<td>Cat…</td>…
Original Fig. 1, Zhong et al., from PDF page 2, arXiv license, scholarly quotation.

EDD stands for encoder-dual-decoder: one CNN encoder feeding two decoders.

The authors give two reasons. Recognizing table structure and recognizing cell text are very different jobs, and forcing both onto one decoder doesn't work well; on the other hand, structural information can help locate "which cell we're reading now." So the two decoders should be separate, but they can't each go their own way.

Let's walk through the small table in the paper's Fig. 2. It has two rows: the header is a "Dog" spanning two columns plus a "Cat," and the body has three cells, "Woof," "Arf" and "Meow."

Original Fig. 2: on the left, the HTML source of a small table, with <td colspan="2">Dog<sup>a</sup></td> and <td>Cat</td> in the header row and three cells, Woof, Arf and Meow, in the body row; in the middle, the structure tokens cut from it, in the order <thead>, <tr>, <td, colspan="2", >, </td>, <td>, </td>, </tr>, </thead>, <tbody>, <tr>, three pairs of <td></td>, </tr>, </tbody>; on the right, the text tokens of each cell: D, o, g, <sup>, a, </sup>; C, a, t; W, o, o, f; A, r, f; M, e, o, w.
Original Fig. 2, Zhong et al., from PDF page 4, arXiv license, scholarly quotation.

In training, the ground-truth HTML is split into two sequences.

The middle column is the structure tokens, only the tags that control the table's shape. The opening of a merged cell is split into three tokens: <td, colspan="2" and >. The structure vocabulary for the entire training set has only 32 tokens.

The right column is the text tokens. Each cell's content is split into characters, and an HTML tag inside a cell (such as <sup>) counts as one token. This vocabulary has 281 tokens.

At inference, the structure decoder starts generating from <thead> and <tr> onward. When it produces <td>, or the final > that closes a merged cell's opening, it signals "a new cell starts here." The cell decoder is then called up; it takes the structure decoder's hidden state at this step as its cue, computes attention over the image features, and writes out D, o, g one character at a time. Once the cell is done, control goes back to the structure decoder, which carries on.

With this trigger, the cell decoder produces exactly as many pieces of text as the structure decoder produces cells, one for one. Finally the text is put back into the matching <td>, and you have the complete HTML.

The two decoders' losses are combined as a weighted sum:

l=λ ls+(1−λ) lcl = \lambda\, l_s + (1 - \lambda)\, l_c

lsl_s is the cross-entropy of the structure tokens and lcl_c that of the text tokens.

Training has two stages. First only the encoder and the structure decoder are trained (λ=1\lambda = 1), so the model learns to draw the table's skeleton; then the whole EDD is trained together (λ=0.5\lambda = 0.5). It took about 16 days on two V100s.

Other settings:

  • The encoder is ResNet-18; the authors added on GitHub that it was trained from scratch, without loading ImageNet weights.
  • Both decoders are single-layer LSTMs, with hidden states of 256 and 512 respectively.
  • Training images are all resized to 448×448448 \times 448. To fit in GPU memory, training uses only the 399k tables whose width and height are at most 512 pixels, with no more than 300 structure tokens and no cell longer than 100 tokens. The development and test sets have no such limits.
  • Inference uses beam search with a beam width of 3.

ResNet-18 shrinks the image by a factor of 32 by default. The authors tried five configurations of the last layer and found that setting the last layer's stride to 1, for a higher-resolution feature map, and giving structure and text each their own last layer worked better. The final choice uses stride 1 on both sides and is called EDD-S1S1.

Treating the Table as a Tree

An HTML table is a tree to begin with. Under the root are thead and tbody, below them come the tr rows, and the leaves are the individual td cells. Each td carries three attributes: how many columns it spans, how many rows it spans, and what's written inside.

Since it's a tree, the gap between two tables can be measured with tree edit distance, the smallest number of insertions, deletions or substitutions needed to turn one tree into the other. The authors compute it with Pawlik and Augsten's APTED algorithm and set the cost of each operation like this:

  • Inserting or deleting a node costs 1.
  • Substituting two nodes costs 1 if either of them isn't a td.
  • If both are td but their column or row spans differ, the cost is 1.
  • If both are td with the same column and row spans, the cost is the normalized Levenshtein distance between the two cells' text, between 0 and 1.

The final score is:

TEDS(Ta,Tb)=1−EditDist(Ta,Tb)max⁡(∣Ta∣,∣Tb∣)\text{TEDS}(T_a, T_b) = 1 - \frac{\text{EditDist}(T_a, T_b)}{\max\big(|T_a|, |T_b|\big)}

∣T∣|T| is the number of nodes in the tree. The score for a whole test set is the average TEDS over its tables.

Let's try it on that small table. To keep the arithmetic easy, first remove Dog's superscript a; the remaining nodes are thead, tbody, two tr and five td, 9 in all.

Suppose the model reads Arf as Ant and gets everything else right. The two strings differ by two characters and the longer one has 3 characters, so the substitution cost is 2/32/3, and

TEDS=1−2/39≈0.926\text{TEDS} = 1 - \frac{2/3}{9} \approx 0.926

If the model gets all the text right but misses Dog's colspan="2", that cell's substitution cost is a flat 1, and the score becomes 1−1/9≈0.8891 - 1/9 \approx 0.889. Missing the whole Meow cell amounts to deleting one node, which is also 0.889.

A little wrong text costs a little; a structural error costs the whole cell. As for how the adjacency relation metric would score the same table, the authors designed two perturbation experiments to compare them.

The first is cell shifting. Some cells in the first row are pushed down, with cells further to the right pushed further, and the vacated spots are filled with empty cells.

Original Fig. 3: a gene table before and after perturbation. (a) Before perturbation, the first row holds eleven column names such as gene, ALK, BRAF and CDKN1A, with three rows of values below for HCC827, A549 and NCI-H460; (b) after perturbation, 90% of the column names in the first row have been pushed down into a staircase, each on its own row, with every vacated position left empty.
Original Fig. 3, Zhong et al., from PDF page 5, arXiv license, scholarly quotation.

This is the result of pushing down 90% of the cells in the first row, and anyone can see at a glance that the table is broken. TEDS gives it 34.9%, while the adjacency relation F1 is still 80.3%.

The reason is the first loophole. Adjacency relations only look at a non-empty cell and its nearest non-empty neighbor; how many empty cells lie between them isn't the metric's concern.

The second is text perturbation: each character is replaced by another with some probability. With only 10% of the characters replaced, TEDS is 93.2%, while the adjacency relation F1 is down to 19.1%. That's the second loophole, where one wrong character in a cell makes every adjacency relation involving that cell count as wrong.

Original Fig. 5: two line charts, both with the perturbation level from 0.1 to 0.9 on the x-axis and the score from 0 to 1 on the y-axis; the blue line is TEDS and the red line the adjacency relation F1. (a) Cell shift: the red line declines slowly from about 0.99 to about 0.76, while the blue line falls from about 0.89 to about 0.40. (b) Text perturbation: the red line drops quickly from about 0.25 to 0, while the blue line falls almost linearly from about 0.92 to about 0.45.
Original Fig. 5, Zhong et al., from PDF page 5, arXiv license, scholarly quotation.

Raise the perturbation from 10% to 90%, and the two metrics' behavior becomes very clear.

The left chart is cell shifting: the red line barely moves and still sits near 80% when the table is unrecognizable. The right chart is text perturbation: the red line is nearly zero by 30%, while TEDS falls almost in a straight line as the typos pile up. The adjacency relation metric is too numb to structural errors and too sensitive to typos.

Discussion

Against Off-the-Shelf Tools

There are two kinds of baselines. One is off-the-shelf tools. Tabula, Traprange, Camelot and PDFPlumber only take text-based PDFs, so the authors cropped the tables directly from the original PDFs for them; Adobe Acrobat Pro was tested on both PDFs and 300 PPI images. The other is WYGIWYS, trained on the same samples with the same CNN encoder as EDD, which rules out the possibility that EDD "just swapped in a stronger encoder."

All outputs are converted into the same kind of tree, and TEDS (%) is computed on the balanced test set:

InputMethodSimpleComplexAll
PDFTabula78.057.867.9
PDFTraprange60.849.955.4
PDFCamelot80.066.073.0
PDFPDFPlumber44.935.940.4
PDFAcrobat Pro68.961.865.3
ImageAcrobat Pro53.853.553.7
ImageWYGIWYS81.775.578.6
ImageEDD91.285.488.3

Three things stand out in this table:

  1. EDD, looking only at images, beats the tools that read the PDF text directly. Camelot is the best of the off-the-shelf tools at 73.0 overall; EDD gets 88.3. These tools receive the correct text ready-made from the PDF and lose on structure.
  2. The same Acrobat drops nearly 12 points going from PDF to image. Recognizing tables from images alone really is harder.
  3. EDD beats WYGIWYS by 9.7 points, with a slightly larger gap on complex tables (9.9) than on simple ones (9.5). The two share the same encoder and training data; the difference is splitting one decoder into two.

The authors also picked a table with a very complex header for a side-by-side comparison. It has seven columns, three header rows and four body rows, and the header contains four merged cells spanning three rows and two spanning three columns. EDD gets the structure completely right and only misreads PF as PC, for a TEDS of 99.8%; WYGIWYS misses the second header row, at 89.8%; the off-the-shelf tools all land between 30% and 75% on this table, and every one of their problems comes from the merged cells.

The attention visualizations also match the design intent. When the structure decoder generates <tr> it looks at the whole row, and when it generates <td> it looks at that cell; the cell decoder's attention is more concentrated still, landing on the few characters it's writing. When generating </td>, the structure decoder's attention is spread out, because </td> always follows <td> or >, so it can be guessed from the preceding tokens alone and there's little need to look at the image.

The Bigger the Table, the Worse It Fares

The authors split the test set into 15 groups along each of four attributes: width, height, number of structure tokens, and number of tokens in the longest cell. EDD beats WYGIWYS in every group, but both decline as tables get larger.

The more interesting part is the thresholds used in training. Except for width, the scores don't drop off suddenly near the thresholds, so "never having seen a table that big" isn't the main cause. The authors believe the problem is resizing every image to 448×448448 \times 448: the bigger the table, the harder it gets squeezed, and the harder its text is to read.

The reasoning is plausible, but the paper runs no experiment with "different resize sizes" to verify it.

A Different Dataset

To show that EDD isn't limited to PubTabNet, the authors used the generator from the TIES paper to synthesize 500,000 tables in four styles, ranging from neat tables with ruled borders around every cell to tables with merged cells whose whole image has been perspective-distorted.

TIES is a graph neural network model. It first reads the text with OCR, then judges whether any two words share a cell, a row or a column; it doesn't generate HTML directly, so TEDS can't be computed for it. The authors compare by "the proportion of tables with fully correct structure" instead, and to be fair, EDD's text errors aren't counted either:

Style 1Style 2Style 3Style 4
TIES96.994.752.968.5
EDD99.799.997.298.0

EDD's TEDS is at 99.7% or above on all four styles. TIES drops noticeably on the third and fourth, more complex styles; EDD doesn't.

Keep in mind, though, that this is synthetic data, whose layouts are dictated by the generator's rules and are much simpler than tables in real papers. The experiment shows that EDD can learn another set of layouts; other real-world document types the paper doesn't test.

What About the Code?

That's the paper. Now let's see whether you can actually use it.

The PubTabNet dataset and the TEDS code were both released. EDD was not.

In November 2019, right after the paper went online, someone on GitHub asked whether there was a pretrained model. The authors answered the same day: "Yes, there is. It is under IBM open sourcing approval." Two months later the reply had become "Due to IP issues, it may take a long time," and in November 2020 it was "there are no updates yet." Today the README says outright, "Due to legal constraints, the source code of the model will not be released" (still under open sourcing approval). In 2023 the person who opened that issue came back with a comment that said, roughly, three years on, maybe the team had been laid off, and the asker had moved on to a different research direction anyway.

The authors were actually very helpful. In another issue, someone was reimplementing the model from the paper, and the authors spent two or three months answering question after question, explaining clearly how to store the hidden states, how the cell decoder builds its batches, and whether the encoder should be pretrained. In the end, though, the person asking still didn't finish training for lack of hardware. Another person who reproduced the structure decoder found its output normal under teacher forcing but broken once inference switched to beam search, and that problem went nowhere either.

The test set has a story of its own. The paper says 568k tables, but the download holds only about 510,000 annotations; the test set's answers were held back for the ICDAR 2021 table recognition competition. The competition released its own final evaluation set in 2022, but the answers for the 10,000-table balanced test set used in the paper's main experiments were something people in the issues still couldn't find in 2025, so they used the validation set as the test set instead. When IBM's own later TableFormer described PubTabNet, it too listed only the training and validation splits. The PubTabNet scores in later papers weren't computed on the same tables as this paper's main results.

In July 2025, IBM's data platform was shut down and all the official download links stopped working. Fortunately, the authors moved the dataset to Hugging Face the same day, and it's still available.

Finally, the data itself. Tables often have a kind of small heading that spans an entire row and divides the body into sections. When Microsoft later built PubTables-1M, they counted that among the PubTabNet tables with such headings, 58.65% have at least one written as "one cell of text plus several empty cells" instead of a single merged cell. The two look exactly the same in the image, but as ground truth they contradict each other. Automatic matching saved on labeling costs, and the price is that these invisible inconsistencies all get counted into the TEDS scores.

Conclusion

EDD's design is straightforward. It generates structure and text separately and aligns the two through the structure decoder's state. Against the single-decoder WYGIWYS, with the same encoder and data, it gains 9.7 points, the paper's strongest evidence for the model. But the code was never released, and later table recognition models moved on to Transformers and cell-coordinate prediction, so EDD mostly appears in other people's comparison tables as a baseline.

What lasted are PubTabNet and TEDS. Later table recognition models, such as TableFormer, all train and compare on PubTabNet; in 2024 and 2025, the table scores in document parsing benchmarks like OmniDocBench still use TEDS, and even the structure_only option in the official code has become another common metric, TEDS-S, which compares only the structure and ignores the text.

TEDS has its quirks, too. It compares how alike two HTML trees look, so if a table is correctly split into two, or the same content is written with different markup, the score drops. When you see a model with a very high TEDS, hold the applause and first take a look at what its ground truth looks like.