FormStruct-Bench / README.md
Richard
Keep only train, validation, and test index manifests
0894f79
|
Raw
History Blame Contribute Delete
17.6 kB
---
license: other
license_name: mixed-source-specific
license_link: https://huggingface.co/datasets/D2I-CUHK-Shenzhen/FormStruct-Bench/blob/main/DATA_LICENSE.md
pretty_name: FormStruct-Bench
language:
- ar
- de
- en
- es
- ja
- pt
- zh
task_categories:
- image-to-text
- document-question-answering
- object-detection
tags:
- document-ai
- form-understanding
- key-information-extraction
- layout-analysis
- multilingual
- structured-prediction
size_categories:
- 1K<n<10K
---
# FormStruct-Bench
## Dataset Description
FormStruct-Bench is a multilingual benchmark for extracting the semantic and
spatial structure of forms from document images. The repository combines a
7,000-page main benchmark, a controlled visual-degradation set, and
template-level layout annotations. It supports evaluation of vision-language
models and document AI systems on hierarchical key-value extraction, document
structure recovery, region localization, table and line-item understanding,
and selection-widget interpretation.
The main task takes a single form image as input and predicts its complete
hierarchical answer tree. Template annotations provide complementary pixel-space
regions and layout metadata for structure-aware evaluation.
> **Rights-audit notice (2026-07-23):** Apache-2.0 applies to the associated
> software repository only, not to this dataset. The source, rights, and privacy
> evidence needed to authorize redistribution has not yet been verified for
> every template. Consult `DATA_LICENSE.md` and
> `provenance/template_rights.csv` before accessing or redistributing files.
> Rows marked `UNVERIFIED_DO_NOT_REDISTRIBUTE` are not cleared for
> redistribution. Some source material is reported under CC BY-NC-SA 4.0 or
> other terms; those terms apply only where the per-template record links
> verifiable evidence.
## Repository Contents
| Component | Scope | Description |
| --- | ---: | --- |
| `datasets/` | 70 canonical templates + 10 redundant directories | 7,000 official benchmark pages; redundant directories are excluded |
| `dataset-augment/` | 1,216 degraded pages | Controlled visual robustness data |
| `template_annotation/` | 70 benchmark templates + 10 redundant templates | Template-level fields, boxes, and layout metadata |
| `splits/template_stratified_seed42/` | 70 templates, 7,000 indexed pages | Official train/validation/test assignments |
| `provenance/template_rights.csv` | 80 template records | Per-template source, rights, privacy, and redistribution audit status |
The repository currently retains directories for 80 templates, but the main
benchmark contains 100 filled instances for each of 70 canonical templates
(7,000 pages). The 10 additional directories correspond to the redundant
templates listed below and are excluded from the official benchmark and all
splits. The augmentation data contains
degraded variants of selected source pages. The template annotations contain
annotations for all 70 main-benchmark templates plus 10 redundant templates.
The 70 templates in `datasets/` define the canonical dataset scope. The extra
annotation files are retained only as redundant data and are not part of the
formal benchmark.
## Main Benchmark
### Statistics
| Property | Value |
| --- | ---: |
| Templates | 70 |
| Instances per template | 100 |
| Total document pages | 7,000 |
| Valid PNG and `answer.json` pairs | 7,000 |
| Total leaf fields | 256,806 |
| Empty leaf fields | 0 |
| Unique canonical answers | 6,921 |
| Unique image pixel hashes | 6,946 |
Each main sample contains the same answer in three representations:
- `answer.json`: machine-readable hierarchical key-value data;
- `answer.md`: a human-readable nested list; and
- `answer.html`: a browser-renderable hierarchical view.
### Language Distribution
| Language | Script | Direction | Templates | Instances |
| --- | --- | --- | ---: | ---: |
| Japanese | Han, Hiragana, Katakana | LTR | 22 | 2,200 |
| English | Latin | LTR | 19 | 1,900 |
| Chinese | Han | LTR | 11 | 1,100 |
| Arabic | Arabic | RTL | 8 | 800 |
| Spanish | Latin | LTR | 3 | 300 |
| Portuguese | Latin | LTR | 3 | 300 |
| German | Latin | LTR | 2 | 200 |
| Chinese-English | Han and Latin | LTR | 2 | 200 |
| **Total** | | | **70** | **7,000** |
The filename prefix `zn` is retained from the original data and denotes
Chinese; it is not an ISO 639 language code. `zn_en` denotes bilingual
Chinese-English templates.
### Directory Structure
```text
datasets/
{template_name}/
{instance_id}/
{template_name}-{instance_id}.png
answer.json
answer.md
answer.html
```
Example:
```text
datasets/en_1/01/
en_1-01.png
answer.json
answer.md
answer.html
```
### Answer Format
`answer.json` stores the semantic answer as a nested JSON object. Internal
objects represent sections or semantic groups, while leaf values contain the
text associated with individual form fields.
```json
{
"PRODUCT SPECIFICATION": {
"Brand": "Marlboro",
"Company": "Philip Morris International",
"Country": "United States"
},
"Prepared by": "Laura Bennett",
"Date": "28/02/2024"
}
```
The schema varies by template and can also vary across instances of the same
template. Systems should therefore predict the full hierarchy instead of
assuming one fixed global field schema.
## Template Annotations
`template_annotation/` contains 80 standalone JSON files with one reviewed
template annotation per file. Exactly 70 files correspond to the canonical
templates in the main dataset. The following 10 files are redundant data and
must be excluded from official dataset statistics, splits, training scope, and
evaluation:
```text
de_3.json
de_4.json
es_4.json
ja_23.json
ja_24.json
ja_25.json
ja_26.json
ja_27.json
ja_28.json
zn_12.json
```
The annotation directory as a whole covers Arabic, German, English, Spanish,
Japanese, Portuguese, Chinese, and bilingual Chinese-English forms. Unless a
separate exploratory use explicitly requires the redundant files, consumers
should join annotations against the 70 template names present in `datasets/`.
### Annotation Statistics
The structural statistics below use only the 70 canonical benchmark
annotations and exclude the 10 redundant files.
| Property | Value |
| --- | ---: |
| Annotation files | 80 |
| Canonical benchmark annotations | 70 |
| Redundant annotations | 10 |
| Regions per canonical template | 1-9 (mean 4.59) |
| Fields per canonical template | 14-86 (mean 42.69) |
| Local grids per canonical template | 0-2 (mean 0.20) |
| Canonical portrait templates (`864 x 1232`) | 63 |
| Canonical landscape templates (`1232 x 864`) | 7 |
### Annotation Schema
Each file contains:
- `id`: template identifier;
- `img`: source-image reference from the annotation environment;
- `original_width`, `original_height`: page dimensions in pixels;
- `fields`: recursive field annotations;
- `semantic_key`: normalized semantic field name;
- `original_label`: label in the source document language;
- `bbox`: pixel-space box in `[x_min, y_min, x_max, y_max]` format;
- `data_type`: types such as `text`, `number`, `checkbox`, and
`checkbox_multi`;
- `value` or `values`: one or more associated value or option regions;
- `keys`: nested child fields; and
- `metadata`: structural, visual, domain, language, difficulty, section,
region, table-region, and line-item-group metadata.
Shortened example:
```json
{
"id": 182,
"img": "/data/upload/2/49a188a5-en_1.jpg",
"original_width": 864,
"original_height": 1232,
"fields": [
{
"semantic_key": "Brand",
"original_label": "Brand",
"bbox": [84, 192, 129, 208],
"data_type": "text",
"value": {
"bbox": [142, 190, 335, 207],
"data_type": "text"
}
}
],
"metadata": {
"language": "English",
"domain": "business",
"layout_structure": {
"page_bbox": [0, 0, 864, 1232]
}
}
}
```
The `img` entries are internal annotation-system paths, not downloadable URLs.
Use the JSON filenames to associate template annotations with matching template
names in the main benchmark.
## Visual-Degradation Data
`dataset-augment/` supports controlled robustness evaluation. It contains 76
source pages with:
- 1,140 factorial variants from five degradation families at three severity
levels; and
- 76 additional `combined` degradation images.
The five factorial degradation families are:
| Variant | Effect |
| --- | --- |
| `blur_noise` | Blur, image noise, salt-and-pepper noise, motion blur, and JPEG artifacts |
| `dilate` | Thickened foreground ink or table lines with controlled local bending |
| `erode` | Thinned or faded foreground ink and table lines |
| `perspective_skew` | Rotation, translation, scale, and perspective displacement |
| `occlusion_stain` | Stains, shadows, creases, and partial occlusion |
Factorial variants use `low`, `medium`, and `high` severity levels. Their
directory structure is:
```text
dataset-augment/
{template_name}/
{source_instance_id}/
{variant}/
{level}/
{template_name}-{source_instance_id}.png
answer.json
augment_meta.json
```
Each `augment_meta.json` records the deterministic seed, transformation
parameters, source and output sizes, before/after image metrics, and pixel
difference statistics. The 76 top-level `combined` images have image and
augmentation metadata but do not include an `answer.json` sidecar. Evaluation
code should pair only samples that have the required clean source and answer.
## Loading the Data
The repository uses a task-specific directory structure rather than a single
tabular file. A minimal Python loader for the main benchmark is:
```python
import json
from pathlib import Path
root = Path("datasets")
samples = []
for image_path in sorted(root.glob("*/*/*.png")):
answer_path = image_path.parent / "answer.json"
if not answer_path.is_file():
continue
samples.append(
{
"template": image_path.parent.parent.name,
"instance_id": image_path.parent.name,
"image_path": str(image_path),
"answer": json.loads(answer_path.read_text(encoding="utf-8")),
}
)
print(len(samples)) # 7000
```
Template annotations can be loaded independently:
```python
annotation_root = Path("template_annotation")
annotations = {
path.stem: json.loads(path.read_text(encoding="utf-8"))
for path in sorted(annotation_root.glob("*.json"))
}
```
## Tasks and Evaluation
The repository is suitable for:
- image-to-hierarchical-JSON extraction;
- form key-value extraction with full semantic paths;
- document schema and hierarchy recovery;
- region and line-item-group localization;
- table, widget, and key-value relation analysis;
- multilingual and right-to-left form understanding; and
- robustness evaluation under controlled visual degradation.
Relevant evaluation families include whole-page exact match, normalized schema
tree-edit similarity, normalized value edit similarity, path-sensitive field
accuracy, region F1 at an IoU threshold, line-item-group F1, and widget answer
accuracy. Evaluation code and exact metric definitions are maintained in the
associated FormStruct-Bench project repository.
## Splits
FormStruct-Bench defines one official, fixed, template-disjoint split generated
with seed 42. The split used in the paper is:
| Split | Templates | Pages | Human-review status |
| --- | ---: | ---: | --- |
| Train | 49 | 4,900 | Not claimed as fully reviewed |
| Validation | 10 | 1,000 | Not claimed as fully reviewed |
| Test | 11 | 1,100 | Fully reviewed |
The authoritative release files are:
- `splits/template_stratified_seed42/train_index.jsonl`;
- `splits/template_stratified_seed42/val_index.jsonl`;
- `splits/template_stratified_seed42/test_index.jsonl`.
The JSONL paths use the public repository's normalized template directory names
and resolve from the repository root. The 10 redundant templates are excluded
from every split. Do not randomly split pages: instances from the same template
share substantial visual and semantic structure and would leak across
partitions. Results should report the dataset revision and use these manifests.
## Data Creation and Provenance
The repository contains populated form pages, hierarchical answer sidecars,
reviewed template annotations, and deterministic visual augmentations. The
augmentation metadata records seeds and parameters for reproducibility.
`provenance/template_rights.csv` is the controlling, per-template audit record
for source title and URL, rightsholder, source license and evidence, privacy
review, and redistribution status. It covers all 70 canonical templates and
the 10 redundant templates. Blank evidence fields mean that the fact has not
been established; they do not mean public domain or unrestricted use.
At the 2026-07-23 release audit, the repository metadata did not contain enough
machine-readable evidence to close these fields for any template. Those rows
are conservatively marked `UNVERIFIED_DO_NOT_REDISTRIBUTE`. The paper reports
that some materials are subject to CC BY-NC-SA 4.0 or mixed copyright terms,
but an aggregate statement cannot establish which terms govern an individual
file. A row may be changed to `CLEARED` only after it names the source,
rightsholder, applicable license, evidence URL or archived permission, and a
completed privacy review. See `provenance/README.md` for the audit procedure.
## Data Quality and Limitations
- The benchmark contains many pages per template but only 70 main templates.
Page-level results are therefore clustered and should not be interpreted as
7,000 independent document designs.
- The language and domain distributions are imbalanced. Japanese and English
account for most main templates.
- Exact pixel hashing finds 6,946 unique images among 7,000 pages. Duplicate or
near-duplicate images can affect evaluation if splits are created without
template and duplicate controls.
- Some source `answer.json` files contain repeated object keys. Standard JSON
parsers retain only the last repeated key, while the Markdown and HTML
sidecars may preserve all repeated entries. Consumers should audit this
behavior for their task.
- The 1,216 augmented images form a selected robustness collection, not a
degradation of all 7,000 main pages. Downstream evaluation may use a smaller
subset after clean-pair validation.
- The 10 redundant annotation files listed above are outside the canonical
70-template scope. They must not be included in official benchmark results;
join components by template name rather than assuming identical coverage.
- The repository currently also retains `datasets/` directories for those 10
redundant templates. Their presence is archival only: they are excluded from
the official 7,000-page count and every released split.
- Template annotation `img` values are non-portable internal paths.
- Automatically derived difficulty and visual metadata should not be treated
as independently validated human judgments.
- Form fields and populated values may resemble personal, financial, medical,
employment, or government information. The data must not be used to make
decisions about real individuals.
## Privacy and Responsible Use
The forms include identity-like names and values as well as fields associated
with potentially sensitive domains. The current release records do not
establish that every value is synthetic or anonymized. This is tracked per
template in `provenance/template_rights.csv`; an unverified row is not
privacy-cleared. Report suspected personal or sensitive information through
the repository's Community tab and identify the template and instance so
maintainers can remove or quarantine it.
FormStruct-Bench is intended for document AI research and system evaluation.
It is not intended for identity verification, eligibility decisions,
surveillance, or automated decisions that affect individuals.
## License and Rights
This dataset has no blanket Apache-2.0 license. Hugging Face metadata uses
`license: other` because rights are mixed and source-specific:
- Apache-2.0 covers only code in the associated software repository.
- CC BY-NC-SA 4.0 applies only to files whose per-template audit row cites
evidence for that license; its attribution, non-commercial, and share-alike
conditions remain in force.
- Base images and document designs under other terms remain subject to those
source terms.
- Answers and annotations may be derivative of the underlying form, and
augmented images inherit restrictions from their clean source image.
- `UNVERIFIED_DO_NOT_REDISTRIBUTE` means that the release does not provide a
verified grant of redistribution rights for that row.
`DATA_LICENSE.md` defines the component-level policy and
`provenance/template_rights.csv` is the controlling per-template record. Access
to repository files does not itself grant copyright, privacy, publicity,
trademark, database, or other rights.
## Citation
No canonical citation is included in the current repository. When reporting
results, cite the Hugging Face dataset repository and record the exact commit
or revision used. Add the associated paper's BibTeX entry here when it becomes
available.
## Maintenance
Questions, corrections, and data-quality reports should be submitted through
the Hugging Face dataset repository's Community tab. Versioned releases should
document changes to template coverage, answer files, annotations, and
augmentation metadata.