File size: 12,662 Bytes
5c3724c
 
3043b98
5c3724c
 
 
b46d057
5c3724c
b46d057
 
 
5c3724c
 
 
 
 
 
 
 
 
 
 
 
 
 
b46d057
5c3724c
 
 
 
de88c95
3043b98
b46d057
 
5c3724c
b46d057
5c3724c
 
b46d057
 
 
de88c95
 
5c3724c
 
b46d057
 
 
 
5c3724c
 
 
 
b46d057
5c3724c
b46d057
 
5c3724c
b46d057
5c3724c
 
 
 
 
b46d057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c3724c
b46d057
 
 
 
5c3724c
b46d057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c3724c
b46d057
3043b98
b46d057
 
 
3043b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b46d057
 
 
 
 
 
 
 
 
 
5c3724c
b46d057
 
 
5c3724c
b46d057
 
5c3724c
b46d057
 
 
5c3724c
b46d057
 
 
 
 
5c3724c
 
 
b46d057
5c3724c
b46d057
3043b98
b46d057
 
 
 
 
 
 
 
3043b98
 
b46d057
3043b98
 
b46d057
 
3043b98
5c3724c
 
 
b46d057
 
55517e9
 
 
 
 
 
 
 
 
5c3724c
0094c3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a8117cb
0094c3c
 
 
 
ffe9f64
 
 
 
 
 
 
 
 
 
 
ce92862
 
 
 
 
 
 
 
 
5c3724c
 
 
 
 
 
b46d057
3043b98
5c3724c
 
b46d057
5c3724c
3043b98
5c3724c
 
b46d057
 
 
5c3724c
 
 
b46d057
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
---
license: apache-2.0
pretty_name: Table Recognition Benchmark (17 sources, 184,074 tables)
tags:
- table-recognition
- table-structure-recognition
- document-image-analysis
- ocr
- document-understanding
- cv
- computer-vision
- teds
- paddleocr-vl
language:
- en
- zh
- ja
- de
- fr
- ar
- hi
configs:
- config_name: default
  data_files:
  - split: test
    path: "*.parquet"
---

# Table Recognition Benchmark

17 public and self-built table sources merged into **64 uniformly sized shards**
(**184,074** tables, ~8.6 GB of images). Every row carries **both** an OTSL
and an HTML ground truth, plus a flag marking the tables that carry no cell
text at all.

## Layout

```
shard_0000.parquet ... shard_0063.parquet   # 64 evenly-sized shards
overlong.parquet                            # oversized / over-long tables
README.md                                   # you are here
scripts/fill_otsl.py                        # html -> otsl
scripts/fill_html.py                        # otsl -> html
```

Shards are balanced by **total image bytes, not row count** — each holds
~169 MB of images, and every shard mixes 15–17 different sources, so a single
shard already gives broad coverage.

## Schema

| column | type | meaning |
|---|---|---|
| `bytes` | binary | the table image, as stored (PNG/JPEG) |
| `source` | string | fine-grained original dataset name |
| `benchmark` | string | which of the 16 sources this row came from |
| `sample_id` | string | original sample identifier (may be empty) |
| `rows` / `cols` | int64 | table grid dimensions |
| `otsl` | string | OTSL ground truth |
| `html` | string | HTML ground truth |
| `resolution` | string | `WIDTHxHEIGHT` |
| `width` / `height` | int64 | image dimensions |
| `structure_only` | bool | true when the table has **no cell text at all** |

---

## What is OTSL

**OTSL = Optimized Table Structure Language**, the compact token language
PaddleOCR uses to represent table structure. A table is a flat token stream —
no nesting, no closing tags:

| token | meaning |
|---|---|
| `<fcel>` | a new (filled) cell starts here |
| `<ecel>` | an empty cell |
| `<lcel>` | continuation **to the left** (horizontal merge) |
| `<ulcel>` | continuation **above** (vertical merge) |
| `<xcel>` | continuation both left and above |
| `<nl>` | end of row |

Cell text is inlined directly after its `<fcel>`, so the stream alternates
structure and content:

```
<fcel>Year<fcel>Division<ecel><ecel><nl>
<fcel>2023<fcel>A<ecel><ecel><nl>
```

Compare with HTML for the same table — six characters per cell of pure
syntax, and every merge costs a `colspan`/`rowspan` attribute:

```html
<table><tr><th>Year</th><th>Division</th><td></td><td></td></tr>
<tr><td>2023</td><td>A</td><td></td><td></td></tr></table>
```

OTSL's advantage is that structure and text live in one linear sequence, which
is what a sequence-to-sequence table recogniser predicts directly.

## What is TEDS and TEDS-S

**TEDS = Tree-Edit-Distance-based Similarity** (PubTabNet). Both tables are
turned into ordered trees — `<table>` → `<tr>` → `<td>` — and scored as
`1 - normalized_tree_edit_distance`:

```
TEDS = 1 - TD / max(N_pred, N_gt)
```

where `TD` is the tree edit distance and `N` the node count. It combines two
signals into one number:

- **structure** — did you get the rows, columns, and merges right?
- **text** — did you get the cell *contents* right?

**TEDS-S** is the structure-only variant: cell text is erased before the
trees are compared, while spans (`colspan`/`rowspan`) are preserved. So
`TEDS-S = 1 - TD_struct / max(N_pred, N_gt)`.

The two bracket each other:

| | TEDS | TEDS-S |
|---|---|---|
| table structure wrong | penalised | penalised |
| cell text wrong | penalised | **ignored** |
| use for | full-fidelity output | structure/topology comparison |

A model that nails the grid but hallucinates cell contents scores high on
TEDS-S and low on TEDS — that gap is the diagnostic.

## Why `structure_only` matters, and how to score it

**31,429 rows (13.8%)** are *pure structure*: every cell is empty and only the
grid and span layout is annotated (`synthtabnet` 29,990, `sprint_mustard`
1,429, `tabrecset` 7, `tableverse` 3).

TEDS always compares cell text. Against an all-empty ground truth, that half
of the metric degenerates into *"did the model correctly output nothing"* —
which is not a meaningful quantity, and a model is rewarded for hallucinating
text into a cell that should be blank.

The rule used for this benchmark:

- `structure_only == true`  → score with **TEDS** (TEDS-S is redundant there)
- `structure_only == false` → score with **TEDS-S** (structure is the
  comparable signal across corpora)

```python
ds = load_dataset("CheneyWong/table_recognition_eval",
                  data_files="shard_*.parquet", split="test")

headline = [TEDS if r["structure_only"] else TEDS_S for r in ds]
```

Report the two groups **separately**. Averaging them into one number mixes
incompatible metrics and the ranking stops meaning anything.

## OTSL ↔ HTML are interconvertible

Both formats encode the same table, so either can be derived from the other.
Where a source shipped only one, the other was generated here:

- **`otsl` derived from `html`** for `pubtables1m`, `mmsci`, `pubtablesv2`,
  `tableverse`, `hitab`, `scitsr`, `sprint_mustard`, `pubtabnet_val`,
  `pubtabnet_icdar21`, `omnidocbench`
- **`html` derived from `otsl`** for `tabrecset_zh`, `tabrecset_en`
- **native to the source** for `fintabnet`, `synthtabnet`, `tablet`,
  `ccocr`, `ocrbenchv2`

**All rows have both fields populated.** Rows left with neither after
conversion were dropped rather than shipped without ground truth.

Round-trip fidelity, measured on a 2,500-row sample:

| check | result |
|---|---|
| byte-identical `otsl → html → otsl` | 41.2% |
| identical after ignoring the normalisations below | 72.8% |
| span tokens (`colspan`/`rowspan`) fully preserved | 91.0% |

The conversion is **structurally faithful but not byte-stable**. Three known
normalisations account for the gap:

1. **Row padding.** HTML has no ragged rows — a short row must be padded to the
   grid width, so converting back yields trailing `<ecel>`.
2. **Empty-cell spelling.** `<fcel>` with no text and a bare `<ecel>` mean the
   same thing; we canonicalise to `<ecel>`.
3. **Irregular rowspan layout.** On tables whose vertical merges do not tile
   cleanly, span placement is re-derived rather than preserved verbatim.

If you need exact span placement, keep `otsl` as the source of truth — it is
never generated from HTML for the sources that ship it natively.

### Conversion scripts

Two scripts, both multi-worker:

- [`scripts/fill_otsl.py`](scripts/fill_otsl.py) — HTML → OTSL. Walks the
  parquet row group by row group (memory stays bounded), collects the rows
  whose `otsl` is empty but whose `html` is not, converts them across a
  worker pool, and rewrites the file. Recomputes `structure_only` afterwards,
  since it is derived from `otsl`.

  ```bash
  python scripts/fill_otsl.py shard_0000.parquet --workers 128
  ```

- [`scripts/fill_html.py`](scripts/fill_html.py) — OTSL → HTML, the mirror
  image: fills `html` wherever it is missing but `otsl` is present.

  ```bash
  python scripts/fill_html.py shard_0000.parquet --workers 128
  ```

Neither loads the whole file into memory: rows are processed per row group
and converted in a `multiprocessing.Pool`, so `--workers 128` is safe on a
machine with many cores.

---

## Sources

| benchmark | rows | share | origin | OTSL from |
|---|---:|---:|---|---|
| `pubtables1m` | 93,834 | 41.1% | PubTables-1M test split | HTML |
| `mmsci` | 12,129 | 6.6% | MMSci-Table **test** split | HTML |
| `synthtabnet` | 29,990 | 13.2% | SynthTabNet test | native |
| `fintabnet` | 10,397 | 4.6% | FinTabNet_OTSL test | native |
| `pubtabnet_icdar21` | 9,064 | 4.0% | ICDAR 2021 official test | HTML |
| `pubtablesv2` | 7,680 | 3.4% | PubTables-v2 test split | HTML |
| `tableverse` | 4,951 | 2.2% | TableVerse-5K | HTML |
| `hitab` | 3,597 | 1.6% | HiTab | HTML |
| `scitsr` | 3,000 | 1.3% | SciTSR | HTML |
| `sprint_mustard` | 1,429 | 0.6% | SPRINT-MUSTARD | HTML |
| `tabrecset_en` | 4,394 | 2.4% | TabRecSet-en | native |
| `tabrecset_zh` | 1,065 | 0.6% | TabRecSet-zh | native |
| `tablet` | 909 | 0.4% | TABLET test split | native |
| `omnidocbench16` | 665 | 0.4% | OmniDocBench v1.6 | HTML |
| `omnidocbench15` | 512 | 0.3% | OmniDocBench v1.5 | HTML |
| `ccocr` | 300 | 0.1% | CC-OCR | native |
| `ocrbenchv2` | 158 | 0.1% | OCRBench-v2 table-parsing tasks | HTML |
| **total** | **184,074** | 100% | | |

## Deliberate exclusions

- **TABLET train pool** (17,720 rows) — replaced by the 909-row test split,
  since the train pool overlaps the evaluation set.
- **OCRBench-v2 non-table tasks** (9,300) — OCRBench-v2 is a general document-VQA
  benchmark. POIE, ChartQA, MMMU, textvqa and the rest carry no table annotation
  at all, so they cannot score a table recogniser. Of the 700 genuinely
  table-parsing tasks, 542 say "all tables in the image" with no region to
  crop to; only the 158 with an explicit bbox are included.

Rows that ended up with neither OTSL nor HTML were dropped rather than shipped
without ground truth. **As of this version there are none: all 184,074 rows
carry both.**

## Related datasets in this org

The individual source corpora are published separately, so you can pull just the
ones you need without downloading the merged 184k-row set above:

| dataset | what it is |
|---|---|
| [`FinTabNet-OTSL`](https://huggingface.co/datasets/CheneyWong/FinTabNet-OTSL) | financial statement tables, OTSL annotations |
| [`HiTab`](https://huggingface.co/datasets/CheneyWong/HiTab) | hierarchical tables with dense row/column spans |
| [`MMSci-Table`](https://huggingface.co/datasets/CheneyWong/MMSci-Table) | scientific tables from recent papers |
| [`PubTabNet`](https://huggingface.co/datasets/CheneyWong/PubTabNet) | the original PubTabNet release |
| [`PubTabNet-ICDAR-test-GT`](https://huggingface.co/datasets/CheneyWong/PubTabNet-ICDAR-test-GT) | official ICDAR 2021 challenge ground truth |
| [`PubTables-1M`](https://huggingface.co/datasets/CheneyWong/PubTables-1M) | 1M scientific tables, structure annotations |
| [`PubTables-v2`](https://huggingface.co/datasets/CheneyWong/PubTables-v2) | PubTabNet + PubTables-1M combined |
| [`SPRINT-MUSTARD`](https://huggingface.co/datasets/CheneyWong/SPRINT-MUSTARD) | structure-only tables, 13 languages |
| [`SynthTabNet`](https://huggingface.co/datasets/CheneyWong/SynthTabNet) | synthetic tables |
| [`TABLET`](https://huggingface.co/datasets/CheneyWong/TABLET) | table QA benchmark, 9 subsets |
| [`TableVerse-5K`](https://huggingface.co/datasets/CheneyWong/TableVerse-5K) | 5K complex Chinese tables |
| [`SciTSR`](https://huggingface.co/datasets/CheneyWong/SciTSR) | SciTSR train/val/test tars |
| [`rebuilt_table_sources`](https://huggingface.co/datasets/CheneyWong/rebuilt_table_sources) | the four rebuilt sources on their own: OmniDocBench v1.5/v1.6, CC-OCR, OCRBench-v2 tables |
| [`table_recognition_eval`](https://huggingface.co/datasets/CheneyWong/table_recognition_eval) | this merged benchmark |

Full list: https://huggingface.co/CheneyWong/datasets

## Code

Pipeline code, the batch evaluation harness, and the vLLM environment notes
live in the GitHub project:

**[`Cheney20/paddleocr-vl-table-recognition`](https://github.com/Cheney20/paddleocr-vl-table-recognition)**

This repository holds the data only. The converters referenced above
(`scripts/fill_otsl.py`, `scripts/fill_html.py`) are mirrored there, together
with the evaluation runner and the offline vLLM image instructions.

The offline vLLM image for PaddleOCR-VL-1.6 (7.34 GB) is on Baidu Netdisk:

```
file    : paddleocrvl-docker
link    : https://pan.baidu.com/s/1Vwt9XtYP5aBPjfdXzxBRAA?pwd=y8na
code    : y8na
sha256  : f40e1d785c7c09c29ff1118cdf7edffec500459c3964ca05c419657d2107a364
```

## Loading

```python
from datasets import load_dataset

ds = load_dataset("CheneyWong/table_recognition_eval",
                  data_files="shard_*.parquet", split="test")
print(len(ds))                                   # 184074
print(ds.filter(lambda r: r["benchmark"] == "hitab"))

# structure-only rows, score these with TEDS
struct = ds.filter(lambda r: r["structure_only"])
print(len(struct))
```

`overlong.parquet` holds oversized tables kept out of the 64 so they do not
distort their image-byte balance. Load it separately.

## Citation

Please cite the original datasets you use. This repository only re-packages
them under a unified schema.