Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -12,7 +12,7 @@ tags:
|
|
| 12 |
- synthetic-data
|
| 13 |
pretty_name: Synthetic Bank Statement Table Detection Dataset
|
| 14 |
size_categories:
|
| 15 |
-
- n<
|
| 16 |
dataset_info:
|
| 17 |
features:
|
| 18 |
- name: image
|
|
@@ -50,10 +50,10 @@ A synthetically generated collection of bank statement images with pixel-perfect
|
|
| 50 |
| | |
|
| 51 |
|---|---|
|
| 52 |
| **Task** | Object Detection β Table Detection |
|
| 53 |
-
| **Format** | PNG images +
|
| 54 |
| **Classes** | 1 (`0` = Table) |
|
| 55 |
-
| **Total images** |
|
| 56 |
-
| **Splits** | None yet β single unsplit set |
|
| 57 |
| **Source** | 100% synthetic, generated with Python + ReportLab |
|
| 58 |
| **Real data?** | β No real bank statements, customers, or financial records |
|
| 59 |
| **License** | MIT |
|
|
@@ -74,8 +74,8 @@ Because every annotation is produced during rendering, the resulting labels are
|
|
| 74 |
|
| 75 |
Each sample consists of:
|
| 76 |
|
| 77 |
-
- A synthetic bank statement image
|
| 78 |
-
-
|
| 79 |
- A bounding box surrounding the complete transaction table
|
| 80 |
|
| 81 |
### Layout diversity
|
|
@@ -95,37 +95,30 @@ The generator produces a wide variety of layouts, including:
|
|
| 95 |
## Folder Structure
|
| 96 |
|
| 97 |
```text
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
βββ labels/
|
| 105 |
-
βββ anon_stmt_001_p1.txt
|
| 106 |
-
βββ anon_stmt_001_p2.txt
|
| 107 |
-
βββ anon_stmt_002_p1.txt
|
| 108 |
-
βββ ...
|
| 109 |
```
|
| 110 |
|
| 111 |
-
|
| 112 |
|
| 113 |
-
|
|
|
|
| 114 |
|
| 115 |
-
-
|
| 116 |
-
- `stmt_<statement_id>` β unique statement identifier
|
| 117 |
-
- `p<page_number>` β page number
|
| 118 |
-
|
| 119 |
-
Multi-page statements are stored as separate image/label pairs.
|
| 120 |
|
| 121 |
---
|
| 122 |
|
| 123 |
## Label Format
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
```text
|
| 128 |
-
|
|
|
|
| 129 |
```
|
| 130 |
|
| 131 |
- `class_id`: `0` (Table)
|
|
@@ -139,47 +132,19 @@ class_id center_x center_y width height
|
|
| 139 |
|
| 140 |
## Data Example
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
<table>
|
| 145 |
-
<tr>
|
| 146 |
-
<th>Image</th>
|
| 147 |
-
<th>Image</th>
|
| 148 |
-
</tr>
|
| 149 |
-
<tr>
|
| 150 |
-
<td>
|
| 151 |
-
|
| 152 |
-

|
| 153 |
-
|
| 154 |
-
</td>
|
| 155 |
-
<td>
|
| 156 |
-
|
| 157 |
-

|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
<tr>
|
| 162 |
-
<th>Label</th>
|
| 163 |
-
<th>Label</th>
|
| 164 |
-
</tr>
|
| 165 |
-
<tr>
|
| 166 |
-
<td>
|
| 167 |
-
|
| 168 |
-
```text
|
| 169 |
-
0 0.503 0.548 0.856 0.701
|
| 170 |
-
```
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
|
|
|
| 177 |
```
|
| 178 |
|
| 179 |
-
</td>
|
| 180 |
-
</tr>
|
| 181 |
-
</table>
|
| 182 |
-
|
| 183 |
Each image typically contains one bounding box representing the entire transaction table.
|
| 184 |
|
| 185 |
---
|
|
@@ -188,14 +153,10 @@ Each image typically contains one bounding box representing the entire transacti
|
|
| 188 |
<summary><strong>Load with the Hugging Face Hub</strong></summary>
|
| 189 |
|
| 190 |
```python
|
| 191 |
-
from
|
| 192 |
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
repo_type="dataset"
|
| 196 |
-
)
|
| 197 |
-
|
| 198 |
-
print(local_dir)
|
| 199 |
```
|
| 200 |
|
| 201 |
</details>
|
|
@@ -203,6 +164,29 @@ print(local_dir)
|
|
| 203 |
<details>
|
| 204 |
<summary><strong>Train with Ultralytics YOLO</strong></summary>
|
| 205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
```yaml
|
| 207 |
path: ./table_detection
|
| 208 |
|
|
@@ -238,7 +222,7 @@ Every annotation is generated automatically during document creation:
|
|
| 238 |
1. A synthetic bank statement is procedurally generated.
|
| 239 |
2. ReportLab renders the transaction table.
|
| 240 |
3. The exact table coordinates are captured during rendering.
|
| 241 |
-
4. The coordinates are converted into normalized YOLO format and
|
| 242 |
|
| 243 |
Because annotations originate directly from the rendering engine, they provide pixel-perfect ground truth with zero manual labeling.
|
| 244 |
|
|
|
|
| 12 |
- synthetic-data
|
| 13 |
pretty_name: Synthetic Bank Statement Table Detection Dataset
|
| 14 |
size_categories:
|
| 15 |
+
- 10K<n<100K
|
| 16 |
dataset_info:
|
| 17 |
features:
|
| 18 |
- name: image
|
|
|
|
| 50 |
| | |
|
| 51 |
|---|---|
|
| 52 |
| **Task** | Object Detection β Table Detection |
|
| 53 |
+
| **Format** | Parquet shards with embedded PNG images + inline bounding-box annotations (Hugging Face `datasets` format) |
|
| 54 |
| **Classes** | 1 (`0` = Table) |
|
| 55 |
+
| **Total images** | 15,187 |
|
| 56 |
+
| **Splits** | None yet β single unsplit `train` set |
|
| 57 |
| **Source** | 100% synthetic, generated with Python + ReportLab |
|
| 58 |
| **Real data?** | β No real bank statements, customers, or financial records |
|
| 59 |
| **License** | MIT |
|
|
|
|
| 74 |
|
| 75 |
Each sample consists of:
|
| 76 |
|
| 77 |
+
- A synthetic bank statement image (embedded directly in the parquet row)
|
| 78 |
+
- An inline `objects` field holding the bounding box(es) and class(es)
|
| 79 |
- A bounding box surrounding the complete transaction table
|
| 80 |
|
| 81 |
### Layout diversity
|
|
|
|
| 95 |
## Folder Structure
|
| 96 |
|
| 97 |
```text
|
| 98 |
+
bank-statement-detection/
|
| 99 |
+
βββ data/
|
| 100 |
+
βββ train-00000-of-00008.parquet
|
| 101 |
+
βββ train-00001-of-00008.parquet
|
| 102 |
+
βββ ...
|
| 103 |
+
βββ train-00007-of-00008.parquet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
```
|
| 105 |
|
| 106 |
+
There are no loose image/label files in this repo β every sample (image + its annotation) lives inline in these parquet shards, loadable directly with the `datasets` library (see below). Each row has two fields:
|
| 107 |
|
| 108 |
+
- `image` β the rendered statement page (decoded to a PIL image)
|
| 109 |
+
- `objects` β a struct with `bbox` (list of `[x_center, y_center, width, height]`, normalized) and `category` (list of class ids)
|
| 110 |
|
| 111 |
+
Multi-page statements are stored as separate rows, one per page.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
---
|
| 114 |
|
| 115 |
## Label Format
|
| 116 |
|
| 117 |
+
Each row's `objects` field uses standard YOLO-style coordinates, stored inline rather than as a separate `.txt` file:
|
| 118 |
|
| 119 |
```text
|
| 120 |
+
objects.category[i] = class_id
|
| 121 |
+
objects.bbox[i] = [center_x, center_y, width, height]
|
| 122 |
```
|
| 123 |
|
| 124 |
- `class_id`: `0` (Table)
|
|
|
|
| 132 |
|
| 133 |
## Data Example
|
| 134 |
|
| 135 |
+
Loading a single row shows the image and its inline annotation together:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
```python
|
| 138 |
+
from datasets import load_dataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
+
ds = load_dataset("Panhapich/bank-statement-detection", split="train")
|
| 141 |
+
sample = ds[0]
|
| 142 |
|
| 143 |
+
sample["image"] # PIL.Image, the rendered statement page
|
| 144 |
+
sample["objects"]
|
| 145 |
+
# {'bbox': [[0.503, 0.548, 0.856, 0.701]], 'category': [0]}
|
| 146 |
```
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
Each image typically contains one bounding box representing the entire transaction table.
|
| 149 |
|
| 150 |
---
|
|
|
|
| 153 |
<summary><strong>Load with the Hugging Face Hub</strong></summary>
|
| 154 |
|
| 155 |
```python
|
| 156 |
+
from datasets import load_dataset
|
| 157 |
|
| 158 |
+
ds = load_dataset("Panhapich/bank-statement-detection", split="train")
|
| 159 |
+
print(ds)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
```
|
| 161 |
|
| 162 |
</details>
|
|
|
|
| 164 |
<details>
|
| 165 |
<summary><strong>Train with Ultralytics YOLO</strong></summary>
|
| 166 |
|
| 167 |
+
YOLO expects images and `.txt` labels as loose files, so export the parquet rows to disk first:
|
| 168 |
+
|
| 169 |
+
```python
|
| 170 |
+
from pathlib import Path
|
| 171 |
+
from datasets import load_dataset
|
| 172 |
+
|
| 173 |
+
ds = load_dataset("Panhapich/bank-statement-detection", split="train")
|
| 174 |
+
|
| 175 |
+
img_dir, lbl_dir = Path("table_detection/images"), Path("table_detection/labels")
|
| 176 |
+
img_dir.mkdir(parents=True, exist_ok=True)
|
| 177 |
+
lbl_dir.mkdir(parents=True, exist_ok=True)
|
| 178 |
+
|
| 179 |
+
for i, sample in enumerate(ds):
|
| 180 |
+
sample["image"].save(img_dir / f"{i:06d}.png")
|
| 181 |
+
lines = [
|
| 182 |
+
f"{cls} {' '.join(map(str, bbox))}"
|
| 183 |
+
for bbox, cls in zip(sample["objects"]["bbox"], sample["objects"]["category"])
|
| 184 |
+
]
|
| 185 |
+
(lbl_dir / f"{i:06d}.txt").write_text("\n".join(lines))
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
Then train as usual:
|
| 189 |
+
|
| 190 |
```yaml
|
| 191 |
path: ./table_detection
|
| 192 |
|
|
|
|
| 222 |
1. A synthetic bank statement is procedurally generated.
|
| 223 |
2. ReportLab renders the transaction table.
|
| 224 |
3. The exact table coordinates are captured during rendering.
|
| 225 |
+
4. The coordinates are converted into normalized YOLO format and stored inline as the row's `objects` field.
|
| 226 |
|
| 227 |
Because annotations originate directly from the rendering engine, they provide pixel-perfect ground truth with zero manual labeling.
|
| 228 |
|