CheneyWong's picture
README: canonical OTSL convention, what changed and why
8c9d577 verified
|
Raw History Blame Contribute Delete
6.71 kB
---
license: apache-2.0
pretty_name: Table Recognition Benchmark (17 sources, 184,074 tables) — canonical PaddleOCR-VL 1.6 OTSL
tags:
- table-recognition
- table-structure-recognition
- document-image-analysis
- ocr
- document-understanding
- teds
- paddleocr-vl
language:
- en
- zh
- ja
- de
- fr
- ar
- hi
configs:
- config_name: default
data_files:
- split: test
path: "shard_*.parquet"
---
# Table Recognition Benchmark — canonical PaddleOCR-VL 1.6 OTSL
17 public and self-built table sources merged into **64 uniformly sized shards**
(**184,074** tables, ~8.6 GB of images). Every row carries an OTSL ground truth
in **PaddleOCR-VL 1.6's own OTSL convention**, the HTML ground truth, and a flag
marking the tables that carry no cell text at all.
This is a **corrected** release. The previous release
(`CheneyWong/table_recognition_eval`) shipped an OTSL column whose rowspan
structure did not follow PaddleOCR-VL's own parser, and whose documentation
listed a token that **does not exist in the 1.6 vocabulary**. See
[What changed](#what-changed-and-why) — in short, **42.6% of the rows have a
different ground truth here**.
## Layout
```
shard_0000.parquet ... shard_0063.parquet # 64 evenly-sized shards
scores_reference_base.parquet # reference run: PaddleOCR-VL 1.6 (base), per-sample scores
scores_reference_sft_ckpt2800.parquet # reference run: our SFT ckpt-2800, per-sample scores
README.md # you are here
scripts/otsl_norm.py # the canonicaliser (HTML -> 1.6 OTSL)
scripts/canonical_teds.py # the scorer used for the reference runs
scripts/README.md # how to rebuild / verify
```
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 17 sources this row came from |
| `sample_id` | string | original sample identifier (may be empty) |
| `rows` / `cols` | int64 | table grid dimensions |
| `otsl` | string | **canonical** OTSL ground truth (PaddleOCR-VL 1.6 convention) |
| `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** |
| `otsl_prev` | string | the ground truth of the previous release (kept for reference) |
| `otsl_changed` | bool | true when `otsl` differs from `otsl_prev` |
## 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. The vocabulary is **exactly six tokens** (this is
PaddleOCR-VL 1.6's own tokenizer, `PaddleOCR-VL-1.6/tokenizer.json`):
| token | id | meaning |
|---|---:|---|
| `<fcel>` | 101309 | a new (filled) cell starts here |
| `<ecel>` | 101308 | an empty cell |
| `<lcel>` | 101311 | continuation **to the left** (horizontal merge) |
| `<ucel>` | 101312 | continuation **above** (vertical merge) |
| `<xcel>` | 101310 | continuation both left and above |
| `<nl>` | 101313 | end of row |
Cell text is inlined directly after its `<fcel>`, so the stream alternates
structure and content:
```
<fcel>Year<fcel>Division<ecel><nl>
<fcel>2023<fcel>A<ecel><nl>
```
A **rowspan** is a continuation *row*, not a marker inside the cell:
```
<fcel>A<fcel>B<lcel><nl> A spans two rows, B spans two columns
<ucel><fcel>C<fcel>D<nl> <- the continuation row, <ucel> holds A's column
```
## What changed, and why
The previous release's `otsl` column was produced by an HTML→OTSL converter
that (a) put a rowspan's continuation marker **inside the same row** using a
token `<ulcel>`, and (b) padded every row with `<ecel>` up to a fixed column
count.
**`<ulcel>` is not a PaddleOCR-VL 1.6 token.** It is not in the model's
vocabulary, so the model can never emit it; and the usual scorer
(`canonical_teds.py`, used by OmniDocBench-style table evaluation) does not list
it among the tokens it recognises either, so it silently ends up **inside the
cell text**:
```
<fcel><ulcel><ulcel>characteristic -> cell text = "<ulcel><ulcel>characteristic"
```
Rows containing `<ulcel>` in the previous release:
| source | rows with `<ulcel>` |
|---|---:|
| pubtables1m | 37% |
| ccocr | 33% |
| omnidocbench16 | 25% |
| pubtabnet_icdar21 | 23% |
| tablet | 22% |
| omnidocbench15 | 20% |
| ocrbenchv2 | 17% |
| scitsr | 16% |
| fintabnet | 14% |
This release rebuilds the ground truth from the **original HTML** following
PaddleOCR-VL 1.6's own parser
(`paddlex/inference/pipelines/paddleocr_vl/uilts.py::otsl_parse_texts`):
* a cell starts at `<fcel>` (with text) or `<ecel>` (empty);
* a **colspan** puts `<lcel>` in the same row, to the right;
* a **rowspan** puts `<ucel>` in the row(s) **below**, in the same column;
* a cell merged both ways is `<xcel>`;
* rows are **not** padded — the row width is the row width.
Where a source's HTML in the previous release was only a shell (all cells
empty, the text living in the source annotation), the source annotation is kept
instead of the HTML-derived one, so no text is ever lost.
**Verification.** The canonical OTSL was parsed back with PaddleOCR-VL 1.6's own
parser and compared cell by cell (text, rowspan, colspan) against the grid
rebuilt from the HTML: **99.77% identical** (2,993 / 3,000 samples; the 7
differences are extra empty cells produced by the official parser's internal
"pad every row to max_cols" step, not structural errors).
## Reference runs
`scores_reference_*.parquet` hold the per-sample scores of two reference runs
against **this** ground truth, so the numbers below are reproducible:
| run | model | pooled TEDS-S |
|---|---|---|
| base | PaddleOCR-VL 1.6 (no fine-tuning) | see `scores_reference_base.parquet` |
| sft_ckpt2800 | our SFT (checkpoint-2800) | see `scores_reference_sft_ckpt2800.parquet` |
The scorer is `scripts/canonical_teds.py` (primary metric TEDS-S; note that for
pure-structure tables, whose cells are all empty, only TEDS-S is meaningful).
## Intended use
Training and evaluating table-structure recognition models on 17 public and
self-built table sources. The images are cropped table images; the labels are
structure + cell text.
If you use this dataset, please also cite the original sources of the
individual tables (the `source` column names them).