AvoCahDoe commited on
Commit
f7a13e2
·
verified ·
1 Parent(s): 7dda0b7

Update README with viewer schema and raw_export paths

Browse files
Files changed (1) hide show
  1. README.md +202 -216
README.md CHANGED
@@ -1,216 +1,202 @@
1
- ---
2
- license: apache-2.0
3
- language:
4
- - en
5
- - de
6
- tags:
7
- - object-detection
8
- - document-understanding
9
- - invoice
10
- - layout-analysis
11
- - bounding-box
12
- - ocr-prep
13
- task_categories:
14
- - object-detection
15
- size_categories:
16
- - n<1K
17
- pretty_name: Invoice Layout Annotated BBox Dataset
18
- dataset_info:
19
- features:
20
- - name: image
21
- dtype: image
22
- - name: image_id
23
- dtype: int64
24
- - name: document_id
25
- dtype: int64
26
- - name: document_filename
27
- dtype: string
28
- - name: page_number
29
- dtype: int64
30
- - name: width
31
- dtype: int64
32
- - name: height
33
- dtype: int64
34
- - name: objects
35
- struct:
36
- - name: id
37
- list: int64
38
- - name: area
39
- list: float64
40
- - name: bbox
41
- list:
42
- list: float32
43
- length: 4
44
- - name: category
45
- list:
46
- class_label:
47
- names:
48
- '0': invoice_metadata
49
- '1': vendor_block
50
- '2': customer_block
51
- '3': table_block
52
- '4': line_item
53
- '5': summary_block
54
- '6': payment_block
55
- '7': Column
56
- splits:
57
- - name: train
58
- num_bytes: 40359783
59
- num_examples: 76
60
- download_size: 36093604
61
- dataset_size: 40359783
62
- configs:
63
- - config_name: default
64
- data_files:
65
- - split: train
66
- path: data/train-*
67
- ---
68
-
69
- # Invoice Layout Annotated BBox Dataset
70
-
71
- Manually annotated invoice page images exported from **AnnotateEverything**, with axis-aligned bounding boxes for **8 document-layout regions**. Built for training object detectors (YOLO, DETR, etc.) on invoice macro-structure.
72
-
73
- ## Dataset summary
74
-
75
- | Property | Value |
76
- |----------|-------|
77
- | **Pages** | 76 |
78
- | **Documents** | 1 |
79
- | **Source PDF** | `train_images.pdf` |
80
- | **Total annotations** | 771 |
81
- | **Avg boxes / page** | 10.14 |
82
- | **Image width range** | 4252853 px |
83
- | **Image height range** | 570 – 4096 px |
84
- | **Export date** | 2026-06-22T19:27:38.375Z |
85
- | **Annotation tool** | AnnotateEverything |
86
- | **Project** | Invoices (id=2) |
87
- | **On-disk size** | ~40.3 MB |
88
-
89
- ## Classes
90
-
91
- | ID | Name | Description | Color | Count |
92
- |----|------|-------------|-------|-------|
93
- | 0 | `invoice_metadata` | Invoice number, date, header metadata | `#f59e0b` | 83 |
94
- | 1 | `vendor_block` | Seller / vendor address block | `#22c55e` | 73 |
95
- | 2 | `customer_block` | Client / customer address block | `#ef4444` | 74 |
96
- | 3 | `table_block` | Line items table region | `#ec4899` | 76 |
97
- | 4 | `line_item` | Individual line item row | `#8b5cf6` | 257 |
98
- | 5 | `summary_block` | Totals / summary section | `#3b82f6` | 78 |
99
- | 6 | `payment_block` | Payment / IBAN block | `#06b6d4` | 55 |
100
- | 7 | `Column` | Table column header row | `#64748b` | 75 |
101
-
102
- ## Directory layout
103
-
104
- ```
105
- .
106
- ├── README.md # This dataset card
107
- ├── manifest.json # Project metadata, label definitions, document index
108
- ├── annotations.json # Flat index of all pages + bboxes
109
- ├── documents/
110
- │ └── train_images__doc426/
111
- │ ├── document.json # Document metadata
112
- │ └── pages/
113
- │ └── page_NNN/
114
- │ ├── image.png
115
- │ └── annotations.json
116
- └── samples/ # README preview images (JPEG)
117
- ```
118
-
119
- ### Annotation format
120
-
121
- Each page entry in `annotations.json`:
122
-
123
- ```json
124
- {
125
- "document_id": 426,
126
- "document_filename": "train_images.pdf",
127
- "page_number": 1,
128
- "relative_image": "documents/train_images__doc426/pages/page_001/image.png",
129
- "width": 2853,
130
- "height": 4096,
131
- "annotations": [
132
- {
133
- "layer": "Default",
134
- "label": "invoice_metadata",
135
- "bbox": [x_min, y_min, x_max, y_max]
136
- }
137
- ]
138
- }
139
- ```
140
-
141
- Bounding boxes are **absolute pixel coordinates** `[x_min, y_min, x_max, y_max]` in top-left origin.
142
-
143
- ## Sample pages
144
-
145
- ### Page 1 (8 boxes)
146
-
147
- | Original | Annotated |
148
- |----------|-----------|
149
- | ![page 1 original](samples/page_001_original.jpg) | ![page 1 annotated](samples/page_001_annotated.jpg) |
150
- ### Page 20 (13 boxes)
151
-
152
- | Original | Annotated |
153
- |----------|-----------|
154
- | ![page 20 original](samples/page_020_original.jpg) | ![page 20 annotated](samples/page_020_annotated.jpg) |
155
- ### Page 39 (10 boxes)
156
-
157
- | Original | Annotated |
158
- |----------|-----------|
159
- | ![page 39 original](samples/page_039_original.jpg) | ![page 39 annotated](samples/page_039_annotated.jpg) |
160
- ### Page 58 (4 boxes)
161
-
162
- | Original | Annotated |
163
- |----------|-----------|
164
- | ![page 58 original](samples/page_058_original.jpg) | ![page 58 annotated](samples/page_058_annotated.jpg) |
165
- ### Page 76 (8 boxes)
166
-
167
- | Original | Annotated |
168
- |----------|-----------|
169
- | ![page 76 original](samples/page_076_original.jpg) | ![page 76 annotated](samples/page_076_annotated.jpg) |
170
- ### Page 19 (14 boxes)
171
-
172
- | Original | Annotated |
173
- |----------|-----------|
174
- | ![page 19 original](samples/page_019_original.jpg) | ![page 19 annotated](samples/page_019_annotated.jpg) |
175
-
176
- ## Label distribution
177
-
178
- | Label | Count |
179
- |-------|-------|
180
- | `line_item` | 257 |
181
- | `invoice_metadata` | 83 |
182
- | `summary_block` | 78 |
183
- | `table_block` | 76 |
184
- | `Column` | 75 |
185
- | `customer_block (Receiver)` | 74 |
186
- | `vendor_block (Sender)` | 73 |
187
- | `payment_block` | 55 |
188
-
189
- ## Usage
190
-
191
- ### Load annotations from the Hub
192
-
193
- ```python
194
- import json
195
- from huggingface_hub import hf_hub_download
196
-
197
- ann_path = hf_hub_download("AvoCahDoe/invoice-annotated-bbox", "annotations.json", repo_type="dataset")
198
- with open(ann_path) as f:
199
- pages = json.load(f)
200
- ```
201
-
202
- ### Convert to YOLO (invoice-extractor)
203
-
204
- This dataset is the raw export consumed by `prepare_annotated_dataset.py` in the invoice-extractor training pipeline.
205
-
206
- ```bash
207
- python scripts/prepare_annotated_dataset.py
208
- ```
209
-
210
- ## Citation
211
-
212
- If you use this dataset, please cite the upstream annotation project and note the export format (AnnotateEverything bbox export v1).
213
-
214
- ## License
215
-
216
- Apache 2.0
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - de
6
+ tags:
7
+ - object-detection
8
+ - document-understanding
9
+ - invoice
10
+ - layout-analysis
11
+ - bounding-box
12
+ - ocr-prep
13
+ task_categories:
14
+ - object-detection
15
+ size_categories:
16
+ - n<1K
17
+ pretty_name: Invoice Layout Annotated BBox Dataset
18
+ dataset_info:
19
+ features:
20
+ - name: image
21
+ dtype: image
22
+ - name: image_id
23
+ dtype: int64
24
+ - name: document_id
25
+ dtype: int64
26
+ - name: document_filename
27
+ dtype: string
28
+ - name: page_number
29
+ dtype: int64
30
+ - name: width
31
+ dtype: int64
32
+ - name: height
33
+ dtype: int64
34
+ - name: objects
35
+ struct:
36
+ - name: id
37
+ list: int64
38
+ - name: area
39
+ list: float64
40
+ - name: bbox
41
+ list:
42
+ list: float32
43
+ length: 4
44
+ - name: category
45
+ list:
46
+ class_label:
47
+ names:
48
+ '0': invoice_metadata
49
+ '1': vendor_block
50
+ '2': customer_block
51
+ '3': table_block
52
+ '4': line_item
53
+ '5': summary_block
54
+ '6': payment_block
55
+ '7': Column
56
+ splits:
57
+ - name: train
58
+ num_bytes: 40359783
59
+ num_examples: 76
60
+ download_size: 36093604
61
+ dataset_size: 40359783
62
+ configs:
63
+ - config_name: default
64
+ data_files:
65
+ - split: train
66
+ path: data/train-*
67
+ ---
68
+
69
+
70
+ Manually annotated invoice page images exported from **AnnotateEverything**, with axis-aligned bounding boxes for **8 document-layout regions**. Built for training object detectors (YOLO, DETR, etc.) on invoice macro-structure.
71
+
72
+ ## Dataset summary
73
+
74
+ | Property | Value |
75
+ |----------|-------|
76
+ | **Pages** | 76 |
77
+ | **Documents** | 1 |
78
+ | **Source PDF** | `train_images.pdf` |
79
+ | **Total annotations** | 771 |
80
+ | **Avg boxes / page** | 10.14 |
81
+ | **Image width range** | 425 – 2853 px |
82
+ | **Image height range** | 5704096 px |
83
+ | **Export date** | 2026-06-22T19:27:38.375Z |
84
+ | **Annotation tool** | AnnotateEverything |
85
+ | **Project** | Invoices (id=2) |
86
+
87
+ ## Classes
88
+
89
+ | ID | Name | Description | Color | Count |
90
+ |----|------|-------------|-------|-------|
91
+ | 0 | `invoice_metadata` | Invoice number, date, header metadata | `#f59e0b` | 83 |
92
+ | 1 | `vendor_block` | Seller / vendor address block | `#22c55e` | 73 |
93
+ | 2 | `customer_block` | Client / customer address block | `#ef4444` | 74 |
94
+ | 3 | `table_block` | Line items table region | `#ec4899` | 76 |
95
+ | 4 | `line_item` | Individual line item row | `#8b5cf6` | 257 |
96
+ | 5 | `summary_block` | Totals / summary section | `#3b82f6` | 78 |
97
+ | 6 | `payment_block` | Payment / IBAN block | `#06b6d4` | 55 |
98
+ | 7 | `Column` | Table column header row | `#64748b` | 75 |
99
+
100
+ ## Dataset Viewer schema
101
+
102
+ The `train` split uses COCO-style `objects` with `[x, y, width, height]` bboxes (top-left origin):
103
+
104
+ | Column | Type |
105
+ |--------|------|
106
+ | `image` | Image |
107
+ | `image_id`, `document_id`, `page_number`, `width`, `height` | int |
108
+ | `document_filename` | string |
109
+ | `objects.bbox` | list of `[x, y, w, h]` |
110
+ | `objects.category` | ClassLabel (8 layout regions) |
111
+ | `objects.area`, `objects.id` | float / int |
112
+
113
+ ## Raw export layout
114
+
115
+ The original AnnotateEverything export is preserved under `raw_export/`:
116
+
117
+ ```
118
+ raw_export/
119
+ ├── manifest.json
120
+ ├── annotations.json
121
+ └── documents/.../pages/page_NNN/image.png
122
+ ```
123
+
124
+ ## Sample pages
125
+
126
+ ### Page 1 (8 boxes)
127
+
128
+ | Original | Annotated |
129
+ |----------|-----------|
130
+ | ![page 1 original](samples/page_001_original.jpg) | ![page 1 annotated](samples/page_001_annotated.jpg) |
131
+ ### Page 20 (13 boxes)
132
+
133
+ | Original | Annotated |
134
+ |----------|-----------|
135
+ | ![page 20 original](samples/page_020_original.jpg) | ![page 20 annotated](samples/page_020_annotated.jpg) |
136
+ ### Page 39 (10 boxes)
137
+
138
+ | Original | Annotated |
139
+ |----------|-----------|
140
+ | ![page 39 original](samples/page_039_original.jpg) | ![page 39 annotated](samples/page_039_annotated.jpg) |
141
+ ### Page 58 (4 boxes)
142
+
143
+ | Original | Annotated |
144
+ |----------|-----------|
145
+ | ![page 58 original](samples/page_058_original.jpg) | ![page 58 annotated](samples/page_058_annotated.jpg) |
146
+ ### Page 76 (8 boxes)
147
+
148
+ | Original | Annotated |
149
+ |----------|-----------|
150
+ | ![page 76 original](samples/page_076_original.jpg) | ![page 76 annotated](samples/page_076_annotated.jpg) |
151
+ ### Page 19 (14 boxes)
152
+
153
+ | Original | Annotated |
154
+ |----------|-----------|
155
+ | ![page 19 original](samples/page_019_original.jpg) | ![page 19 annotated](samples/page_019_annotated.jpg) |
156
+
157
+ ## Label distribution
158
+
159
+ | Label | Count |
160
+ |-------|-------|
161
+ | `line_item` | 257 |
162
+ | `invoice_metadata` | 83 |
163
+ | `summary_block` | 78 |
164
+ | `table_block` | 76 |
165
+ | `Column` | 75 |
166
+ | `customer_block (Receiver)` | 74 |
167
+ | `vendor_block (Sender)` | 73 |
168
+ | `payment_block` | 55 |
169
+
170
+ ## Usage
171
+
172
+ ### Load with Hugging Face Datasets (recommended)
173
+
174
+ ```python
175
+ from datasets import load_dataset
176
+
177
+ ds = load_dataset("AvoCahDoe/invoice-annotated-bbox")
178
+ example = ds["train"][0]
179
+ print(example["objects"]) # COCO-style bboxes + categories
180
+ example["image"].show()
181
+ ```
182
+
183
+ ### Load raw AnnotateEverything export
184
+
185
+ ```python
186
+ import json
187
+ from huggingface_hub import hf_hub_download
188
+
189
+ ann_path = hf_hub_download("AvoCahDoe/invoice-annotated-bbox", "raw_export/annotations.json", repo_type="dataset")
190
+ with open(ann_path) as f:
191
+ pages = json.load(f)
192
+ ```
193
+
194
+ ### Convert to YOLO (invoice-extractor)
195
+
196
+ ```bash
197
+ python scripts/prepare_annotated_dataset.py
198
+ ```
199
+
200
+ ## License
201
+
202
+ Apache 2.0