Panhapich's picture
Update README.md
ca5af08 verified
|
Raw
History Blame Contribute Delete
11.7 kB
metadata
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 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

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:

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.

Image (images/anon_stmt_001_p1.png) Image (images/anon_stmt_002_p1.png)

Raw statement image, no annotations

Raw statement image, no annotations

Label (labels/anon_stmt_001_p1.txt) Label (labels/anon_stmt_002_p1.txt)
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
...
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
...

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.


Load with the Hugging Face Hub (download files directly)
from huggingface_hub import snapshot_download

local_dir = snapshot_download(
    repo_id="Panhapich/bank-statement-structure-recognition",
    repo_type="dataset"
)
print(local_dir)
Use with a YOLO training pipeline (e.g. Ultralytics)
# data.yaml
path: ./structure
train: images   # currently single unsplit set β€” update once splits exist
val: images
nc: 2
names: ["header_cell", "body_cell"]
from ultralytics import YOLO

model = YOLO("yolov8n.pt")
model.train(data="data.yaml", epochs=50, imgsz=1024)
Convert YOLO labels β†’ Table Transformer (TATR) / COCO-style boxes
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()]

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 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.

@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.