Skip to content

Commit dee04c5

Browse files
artizclaude
andcommitted
fix(pdf): emit padded tables + align groundtruth to live docling
PDF tables were compact to match the stale committed groundtruth, but conformance.sh (and DOCX/HTML) score against live published docling, which uses padded GitHub tables — so the compact rows showed as cosmetic diffs (e.g. 2305-pg9 = 14 vs live). The PDF backend no longer opts into compact tables, so it emits the padded format like every other backend. Regenerated the committed PDF groundtruth from live docling (the conformance reference) via scripts/docling_convert.py, so the fixtures and conformance.sh agree. Result vs live docling: 2305-pg9 → EXACT (4/14), and the table papers drop sharply (2203 321→275, 2206 304→276, 2305v1 94→68) now that the table format matches. multi_page/code_and_formula/picture_classification stay exact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bd4cb28 commit dee04c5

8 files changed

Lines changed: 255 additions & 239 deletions

File tree

crates/fleischwolf-pdf/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ impl Pipeline {
105105
// is gigabytes for a multi-thousand-page document and drives the machine
106106
// into swap).
107107
let mut doc = DoclingDocument::new(name);
108-
// The PDF groundtruth corpus predates docling-core's padded table
109-
// serializer, so PDF output uses the compact `| a | b |` table form.
110-
doc.compact_tables = true;
111108
pdfium_backend::for_each_page(bytes, password, |n, _total, mut page| {
112109
self.process_one_page(n, &mut page, &mut doc)
113110
})?;
@@ -187,7 +184,6 @@ impl Pipeline {
187184
name: &str,
188185
) -> Result<DoclingDocument, PdfError> {
189186
let mut doc = DoclingDocument::new(name);
190-
doc.compact_tables = true; // compact table form for PDF/image/METS output
191187
for (n, page) in pages.iter_mut().enumerate() {
192188
self.process_one_page(n, page, &mut doc)?;
193189
}

tests/data/pdf/groundtruth/2203.01017v2.md

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ The occurrence of tables in documents is ubiquitous. They often summarise quanti
1414

1515
## a. Picture of a table:
1616

17-
| 1 |
18-
| - |
17+
| 1 |
18+
|-----|
1919

2020
7
2121

22-
| 0 | 1 2 1 | 1 2 1 | 1 2 1 |
23-
| - | - | - | - |
24-
| 3 4 | 5 | 6 | 7 |
25-
| 9 13 | 10 | 11 | 12 |
26-
| 8 2 | 14 | 15 | 16 |
27-
| 17 | 18 | 19 | 20 |
22+
| 0 | 1 2 1 | 1 2 1 | 1 2 1 |
23+
|------|---------|---------|---------|
24+
| 3 4 | 5 | 6 | 7 |
25+
| 9 13 | 10 | 11 | 12 |
26+
| 8 2 | 14 | 15 | 16 |
27+
| 17 | 18 | 19 | 20 |
2828

2929
Figure 1: Picture of a table with subtle, complex features such as (1) multi-column headers, (2) cell with multi-row text and (3) cells with no content. Image from PubTabNet evaluation set, filename: 'PMC2944238 004 02'.
3030

@@ -85,14 +85,14 @@ In this regard, we have prepared four synthetic datasets, each one containing 15
8585

8686
Table 1: Both 'Combined-Tabnet' and 'CombinedTabnet' are variations of the following: (*) The CombinedTabnet dataset is the processed combination of PubTabNet and Fintabnet. (**) The combined dataset is the processed combination of PubTabNet, Fintabnet and TableBank.
8787

88-
| | Tags | Bbox | Size | Format |
89-
| - | - | - | - | - |
90-
| PubTabNet | 3 | 3 | 509k | PNG |
91-
| FinTabNet | 3 | 3 | 112k | PDF |
92-
| TableBank | 3 | 7 | 145k | JPEG |
93-
| Combined-Tabnet(*) | 3 | 3 | 400k | PNG |
94-
| Combined(**) | 3 | 3 | 500k | PNG |
95-
| SynthTabNet | 3 | 3 | 600k | PNG |
88+
| | Tags | Bbox | Size | Format |
89+
|--------------------|--------|--------|--------|----------|
90+
| PubTabNet | 3 | 3 | 509k | PNG |
91+
| FinTabNet | 3 | 3 | 112k | PDF |
92+
| TableBank | 3 | 7 | 145k | JPEG |
93+
| Combined-Tabnet(*) | 3 | 3 | 400k | PNG |
94+
| Combined(**) | 3 | 3 | 500k | PNG |
95+
| SynthTabNet | 3 | 3 | 600k | PNG |
9696

9797
Tab. 1 summarizes the various attributes of the datasets.
9898

@@ -166,18 +166,18 @@ where T a and T b represent tables in tree structure HTML format. EditDist denot
166166

167167
Structure. As shown in Tab. 2, TableFormer outperforms all SOTA methods across different datasets by a large margin for predicting the table structure from an image. All the more, our model outperforms pre-trained methods. During the evaluation we do not apply any table filtering. We also provide our baseline results on the SynthTabNet dataset. It has been observed that large tables (e.g. tables that occupy half of the page or more) yield poor predictions. We attribute this issue to the image resizing during the preprocessing step, that produces downsampled images with indistinguishable features. This problem can be addressed by treating such big tables with a separate model which accepts a large input image size.
168168

169-
| Model | Dataset | Simple | TEDS Complex | All |
170-
| - | - | - | - | - |
171-
| EDD | PTN | 91.1 | 88.7 | 89.9 |
172-
| GTE | PTN | - | - | 93.01 |
173-
| TableFormer | PTN | 98.5 | 95.0 | 96.75 |
174-
| EDD | FTN | 88.4 | 92.08 | 90.6 |
175-
| GTE | FTN | - | - | 87.14 |
176-
| GTE (FT) | FTN | - | - | 91.02 |
177-
| TableFormer | FTN | 97.5 | 96.0 | 96.8 |
178-
| EDD | TB | 86.0 | - | 86.0 |
179-
| TableFormer | TB | 89.6 | - | 89.6 |
180-
| TableFormer | STN | 96.9 | 95.7 | 96.7 |
169+
| Model | Dataset | Simple | TEDS Complex | All |
170+
|-------------|-----------|----------|----------------|-------|
171+
| EDD | PTN | 91.1 | 88.7 | 89.9 |
172+
| GTE | PTN | - | - | 93.01 |
173+
| TableFormer | PTN | 98.5 | 95.0 | 96.75 |
174+
| EDD | FTN | 88.4 | 92.08 | 90.6 |
175+
| GTE | FTN | - | - | 87.14 |
176+
| GTE (FT) | FTN | - | - | 91.02 |
177+
| TableFormer | FTN | 97.5 | 96.0 | 96.8 |
178+
| EDD | TB | 86.0 | - | 86.0 |
179+
| TableFormer | TB | 89.6 | - | 89.6 |
180+
| TableFormer | STN | 96.9 | 95.7 | 96.7 |
181181

182182
Table 2: Structure results on PubTabNet (PTN), FinTabNet (FTN), TableBank (TB) and SynthTabNet (STN).
183183

@@ -187,24 +187,24 @@ Cell Detection. Like any object detector, our Cell BBox Detector provides boundi
187187

188188
Table 3: Cell Bounding Box detection results on PubTabNet, and FinTabNet. PP: Post-processing.
189189

190-
| Model | Dataset | mAP | mAP (PP) |
191-
| - | - | - | - |
192-
| EDD+BBox | PubTabNet | 79.2 | 82.7 |
193-
| TableFormer | PubTabNet | 82.1 | 86.8 |
194-
| TableFormer | SynthTabNet | 87.7 | - |
190+
| Model | Dataset | mAP | mAP (PP) |
191+
|-------------|-------------|-------|------------|
192+
| EDD+BBox | PubTabNet | 79.2 | 82.7 |
193+
| TableFormer | PubTabNet | 82.1 | 86.8 |
194+
| TableFormer | SynthTabNet | 87.7 | - |
195195

196196
Cell Content. In this section, we evaluate the entire pipeline of recovering a table with content. Here we put our approach to test by capitalizing on extracting content from the PDF cells rather than decoding from images. Tab. 4 shows the TEDs score of HTML code representing the structure of the table along with the content inserted in the data cell and compared with the ground-truth. Our method achieved a 5.3% increase over the state-of-the-art, and commercial solutions. We believe our scores would be higher if the HTML ground-truth matched the extracted PDF cell content. Unfortunately, there are small discrepancies such as spacings around words or special characters with various unicode representations.
197197

198198
Table 4: Results of structure with content retrieved using cell detection on PubTabNet. In all cases the input is PDF documents with cropped tables.
199199

200-
| Model | Simple | TEDS Complex | All |
201-
| - | - | - | - |
202-
| Tabula | 78.0 | 57.8 | 67.9 |
203-
| Traprange | 60.8 | 49.9 | 55.4 |
204-
| Camelot | 80.0 | 66.0 | 73.0 |
205-
| Acrobat Pro | 68.9 | 61.8 | 65.3 |
206-
| EDD | 91.2 | 85.4 | 88.3 |
207-
| TableFormer | 95.4 | 90.1 | 93.6 |
200+
| Model | Simple | TEDS Complex | All |
201+
|-------------|----------|----------------|-------|
202+
| Tabula | 78.0 | 57.8 | 67.9 |
203+
| Traprange | 60.8 | 49.9 | 55.4 |
204+
| Camelot | 80.0 | 66.0 | 73.0 |
205+
| Acrobat Pro | 68.9 | 61.8 | 65.3 |
206+
| EDD | 91.2 | 85.4 | 88.3 |
207+
| TableFormer | 95.4 | 90.1 | 93.6 |
208208

209209
- a. Red - PDF cells, Green - predicted bounding boxes, Blue - post-processed predictions matched to PDF cells
210210

@@ -349,24 +349,40 @@ Figure 9: Example of a table with big empty distance between cells.
349349

350350
<!-- image -->
351351

352-
Figure 10: Example of a complex table with empty cells.
352+
| | | ANOVA | ANOVA | 2 |
353+
|-----------|---------|---------|---------|--------------|
354+
| 3 | Sum Sq | 5Df | FValue | Pr (>F) |
355+
| | 5745.2 | | 266.75 | 4.64 × 10−9 |
356+
| 2onc | 2191.39 | | 0.7 | 2.76 × 10 |
357+
| R1× conc | 2648.33 | | 1.48 | 1.07 × 10 -6 |
358+
| Residuals | 236.91 | | 6 | |
353359

354-
<!-- image -->
360+
Figure 10: Example of a complex table with empty cells.
355361

356362
<!-- image -->
357363

358364
Figure 11: Simple table with different style and empty cells.
359365

366+
<!-- image -->
367+
360368
Figure 13: Table predictions example on colorful table.
361369

362370
<!-- image -->
363371

372+
PDF Cells
373+
364374
Figure 12: Simple table predictions and post processing.
365375

366376
<!-- image -->
367377

368378
Figure 14: Example with multi-line text.
369379

380+
4 [4.0]
381+
382+
9 μ4.1
383+
384+
## PDF Cells
385+
370386
Figure 15: Example with triangular table.
371387

372388
<!-- image -->

0 commit comments

Comments
 (0)