Panhapich's picture
Update README.md
ca5af08 verified
|
Raw
History Blame Contribute Delete
11.7 kB
---
license: mit
task_categories:
- object-detection
tags:
- image
- computer-vision
- document-analysis
- financial-documents
- table-structure
- yolo
- synthetic-data
pretty_name: Synthetic Bank Statement Table Structure Dataset
size_categories:
- n<10k
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
dataset_info:
features:
- name: image
dtype: image
- name: objects
struct:
- name: bbox
list:
list: float32
- name: category
list: int64
splits:
- name: train
num_bytes: 1878958824.4
num_examples: 8475
download_size: 1816175365
dataset_size: 1878958824.4
---
# Synthetic Bank Statement Table Structure Dataset
A synthetically generated collection of bank statement images with pixel-perfect, automatically-produced bounding box annotations for **table structure recognition (TSR)**.
> 🔑 **In one sentence:** fake bank statements + auto-generated YOLO labels for every table cell, built so you can train table-detection models (TATR, DETR, YOLO) without manual annotation.
---
## At a Glance
| | |
|---|---|
| **Task** | Object Detection → Table Structure Recognition |
| **Format** | PNG images + YOLO-format `.txt` labels |
| **Classes** | 2 (`0` = Header Cell, `1` = Body Cell) |
| **Total images** | 8475 |
| **Splits** | None yet — single unsplit set (train/val/test split not yet defined) |
| **Source** | 100% synthetic, generated with Python + ReportLab |
| **Real data?** | ❌ No real bank statements, customers, or financial records |
| **License** | MIT |
---
## Why This Dataset Exists
This dataset models **clean, digitally-generated bank statement PDFs** — the kind produced directly by a bank's own statement-generation system and downloaded as a native PDF (not a scanned paper document). Manually labeling table cells even in clean digital documents is slow and error-prone — humans miss edges, misjudge wrapped text boundaries, and disagree on where one cell ends and another begins. This dataset sidesteps that entirely: every bounding box is captured **directly from the ReportLab drawing engine at the moment the PDF is rendered**, so the label *is* the ground truth — there's no separate annotation step, and therefore no annotation drift or human error.
This makes it well-suited as **pretraining or augmentation data** for table structure models that will later be fine-tuned or validated on real bank statement PDFs.
---
## What's Inside
### Visual structure being detected
- 🔵 **Header cells** — column titles like Date, Description, Reference, Amount, Balance
- 🟢 **Body cells** — every individual transaction-data cell
### Layout diversity
The generator doesn't produce one templated look — it varies:
- Portrait and landscape orientations
- Multiple banking templates and column counts
- Bordered, borderless, and zebra-striped tables
- Single- and multi-line (wrapped) transaction descriptions
- Dynamic row heights
- Multi-page statements with repeated headers across page breaks (each page is its own image/label pair — see [Folder Structure](#folder-structure) for the naming convention)
- Randomized customer info, transaction narratives, and financial values
This diversity is the main value of the dataset — it's designed to expose a model to many table "shapes" rather than one clean layout repeated many times.
---
## Folder Structure
```text
structure/
├── images/
│ ├── anon_stmt_001_p1.png
│ ├── anon_stmt_001_p2.png
│ ├── anon_stmt_002_p1.png
│ └── ...
└── labels/
├── anon_stmt_001_p1.txt
├── anon_stmt_001_p2.txt
├── anon_stmt_002_p1.txt
└── ...
```
Each image has a matching label file with the same base filename (e.g. `images/anon_stmt_001_p1.png``labels/anon_stmt_001_p1.txt`).
**Filename convention:** `anon_stmt_<statement_id>_p<page_number>`
- `anon_` — flags that the statement is fully anonymized/synthetic (no real customer data)
- `stmt_<statement_id>` — a unique ID per generated statement (e.g. `001`, `002`, ...)
- `p<page_number>` — page number within that statement (`p1`, `p2`, ...). Multi-page statements are stored as **separate image/label pairs per page**, not as a single multi-page file — so `anon_stmt_001_p1.png` and `anon_stmt_001_p2.png` belong to the same logical statement but are two independent training samples.
### Label format
Standard YOLO format — one line per table cell:
```text
class_id center_x center_y width height
```
- `class_id`: `0` (Header Cell) or `1` (Body Cell)
- All coordinates are **normalized** to image width/height (range 0–1)
| Class ID | Label | Description |
|:--------:|-------|-------------|
| `0` | Header Cell | Column header cells (Date, Description, Reference, Amount, Balance, etc.) |
| `1` | Body Cell | Individual transaction-data cells — one box per non-header cell |
---
## Data Example
The table below shows two raw images from `images/` next to the full contents of their matching label files from `labels/` — no annotation overlay drawn on top, just what you'll actually find in the dataset folders. The two samples use different templates to illustrate the layout diversity described above.
<table>
<tr>
<th>Image (<code>images/anon_stmt_001_p1.png</code>)</th>
<th>Image (<code>images/anon_stmt_002_p1.png</code>)</th>
</tr>
<tr>
<td>
![Raw statement image, no annotations](images/anon_stmt_001_p1.png)
</td>
<td>
![Raw statement image, no annotations](images/anon_stmt_002_p1.png)
</td>
</tr>
<tr>
<th>Label (<code>labels/anon_stmt_001_p1.txt</code>)</th>
<th>Label (<code>labels/anon_stmt_002_p1.txt</code>)</th>
</tr>
<tr>
<td>
```text
0 0.083 0.042 0.150 0.018
0 0.245 0.042 0.150 0.018
0 0.407 0.042 0.150 0.018
0 0.569 0.042 0.150 0.018
0 0.731 0.042 0.150 0.018
1 0.083 0.071 0.150 0.022
1 0.245 0.071 0.150 0.022
1 0.407 0.071 0.150 0.022
1 0.569 0.071 0.150 0.022
1 0.731 0.071 0.150 0.022
1 0.083 0.099 0.150 0.022
1 0.245 0.099 0.150 0.022
...
```
</td>
<td>
```text
0 0.071 0.038 0.130 0.020
0 0.213 0.038 0.130 0.020
0 0.355 0.038 0.130 0.020
0 0.497 0.038 0.130 0.020
0 0.639 0.038 0.130 0.020
0 0.781 0.038 0.130 0.020
1 0.071 0.064 0.130 0.024
1 0.213 0.064 0.130 0.024
1 0.355 0.064 0.130 0.024
1 0.497 0.064 0.130 0.024
1 0.639 0.064 0.130 0.024
1 0.781 0.064 0.130 0.024
...
```
</td>
</tr>
</table>
Each line is `class_id center_x center_y width height`, normalized 0–1 against image dimensions — `0` for header cells, `1` for body cells. The number of lines in a label file equals the number of cells visible in its matching image.
---
<details>
<summary><strong>Load with the Hugging Face Hub (download files directly)</strong></summary>
```python
from huggingface_hub import snapshot_download
local_dir = snapshot_download(
repo_id="Panhapich/bank-statement-structure-recognition",
repo_type="dataset"
)
print(local_dir)
```
</details>
<details>
<summary><strong>Use with a YOLO training pipeline (e.g. Ultralytics)</strong></summary>
```yaml
# data.yaml
path: ./structure
train: images # currently single unsplit set — update once splits exist
val: images
nc: 2
names: ["header_cell", "body_cell"]
```
```python
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
model.train(data="data.yaml", epochs=50, imgsz=1024)
```
</details>
<details>
<summary><strong>Convert YOLO labels → Table Transformer (TATR) / COCO-style boxes</strong></summary>
```python
from PIL import Image
def yolo_to_xyxy(line, img_w, img_h):
class_id, cx, cy, w, h = map(float, line.split())
x1 = (cx - w / 2) * img_w
y1 = (cy - h / 2) * img_h
x2 = (cx + w / 2) * img_w
y2 = (cy + h / 2) * img_h
return int(class_id), [x1, y1, x2, y2]
img = Image.open("images/anon_stmt_001_p1.png")
with open("labels/anon_stmt_001_p1.txt") as f:
boxes = [yolo_to_xyxy(line, *img.size) for line in f if line.strip()]
```
</details>
---
## Annotation Methodology
Unlike datasets where humans draw boxes after the fact, every annotation here is produced **during** document generation:
1. A synthetic bank statement is procedurally composed (random bank template, customer info, transactions).
2. ReportLab renders the table to a PDF/image.
3. As each cell is drawn, its exact pixel coordinates are captured **at render time**.
4. Coordinates are converted to normalized YOLO format and written alongside the image.
**Result:** pixel-perfect alignment with zero manual labeling and zero annotation drift — the kind of clean signal that's hard to get from human-labeled data, but also worth knowing about when judging how the dataset will generalize (see [Limitations](#limitations--intended-use) below).
---
## Compatible Models
- `microsoft/table-transformer-structure-recognition-v1.1-all`
- Table Transformer (TATR)
- DETR-based table structure models
- YOLO-family object detectors (YOLOv5/v8/v9/v10, etc.)
- Other transformer-based document layout/understanding architectures
## Intended Applications
- Table Structure Recognition (TSR)
- Document Layout Analysis
- Intelligent Document Processing (IDP)
- Financial document understanding & information extraction
- OCR pipeline development (cell localization prior to text extraction)
- Document AI benchmarking
---
## Limitations & Intended Use
Being upfront about what this dataset is *not*, so it's used appropriately:
- **Not modeling scanned documents.** This dataset simulates clean, digitally-generated bank statement PDFs (the kind a bank produces natively), not scanned paper documents — there's no scanner skew, smudging, or photographic noise either way. If your real-world target documents are scanned/photographed paper statements, this dataset won't cover that domain gap, and you'd need separate scan-augmentation or real scanned samples.
- **Synthetic template variety vs. real-world template variety.** While the generator produces many layouts (bordered/borderless, zebra-striping, multi-page, etc.), it can't fully replicate the sheer diversity of real banks' actual statement designs, fonts, and branding. Models trained only on this data may need fine-tuning on a sample of real bank statement PDFs before deployment.
- **No real financial data.** All customer info, transaction narratives, and amounts are randomized/fabricated — this dataset contains no PII and no real institution branding.
- **Single unsplit set.** There is currently no official train/val/test split — if you need one, you'll need to partition it yourself (e.g. a random 80/10/10 split).
- **Two classes only.** This dataset labels header vs. body cells, not finer structure like row/column spans, merged cells, or currency-specific fields.
**Best used for:** pretraining, data augmentation, or benchmarking table-structure detectors before fine-tuning on a smaller set of real, manually verified bank statement PDFs.
---
## Dataset Origin
This dataset is **entirely synthetic**. No real bank statements, customer information, financial records, proprietary templates, or institution-specific branding are included anywhere in the dataset. All documents were procedurally generated using Python and ReportLab for research purposes.
---
## Citation
If you use this dataset in academic research, please cite your corresponding publication describing the dataset and generation methodology.
```bibtex
@dataset{synthetic_bank_statement_tsr,
title = {Synthetic Bank Statement Table Structure Dataset},
author = {Uk, Panhapich},
year = {2026},
note = {Synthetically generated for table structure recognition research}
}
```
## License
Released under the **MIT License**.