Datasets:
File size: 6,797 Bytes
9f8ebb1 ca64a0a 9f8ebb1 ca64a0a 9f8ebb1 ca64a0a 9f8ebb1 ca64a0a 9f8ebb1 ca64a0a 9f8ebb1 ca64a0a 9f8ebb1 ca64a0a 9f8ebb1 ca64a0a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
---
task_categories:
- object-detection
language:
- et
license: cc-by-sa-4.0
tags:
- Estonia
- historical-documents
- coordinates
- layout-analysis
- text-detection
- document-structure
- transkribus
- page-analysis
pretty_name: ArchXAI Page Layouts
size_categories:
- 1K<n<10K
---
# π ArchXAI Estonian Document Coordinate Dataset
## Dataset Description
This dataset contains coordinate annotations for Estonian historical documents, extracted from Transkribus exports. It includes full page images with precise coordinate information for text regions and text lines, designed for text detection, layout analysis, and document structure understanding tasks.
## π Dataset Summary
- **Total Examples**: 1,671 images
- **Language**: πͺπͺ Estonian
- **Dataset Size**: ~2 GB
- **Task**: Text Detection, Layout Analysis, Document Structure Analysis
- **Domain**: Historical Documents, Archival Materials
- **Source**: Transkribus PAGE XML exports
## ποΈ Dataset Structure
### π Features
- **image**: Full page image (PIL Image)
- **text_regions**: Coordinate string for text region polygons in format: `region_1:((x1,y1),(x2,y2),...),region_2:((x1,y1),...)`
- **text_lines**: Coordinate string for text line polygons in format: `line_1:((x1,y1),(x2,y2),...),line_2:((x1,y1),...)`
- **document_title**: Source document name
- **reference**: AIS reference number
### π― Coordinate Format
The coordinates are stored as simple, readable strings:
**Text Regions**: Each region is numbered and contains rectangle points
```
region_1:((704,968),(704,2814),(2764,2814),(2764,968)),region_2:((3349,897),(3349,3256),(5284,3256),(5284,897))
```
**Text Lines**: Each line is numbered and contains polygon points
```
line_1:((237,349),(400,352),(480,405),(500,420)),line_2:((255,483),(379,469),(420,485),(445,500))
```
## π» Usage Examples
### Basic Loading
```python
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("Rahvusarhiiv/ArchXAI_document_segmentation")
# Access a sample
sample = dataset['train'][0]
image = sample['image']
text_regions = sample['text_regions']
text_lines = sample['text_lines']
document = sample['document_title']
```
### Parse Coordinates
```python
def parse_coordinates(coord_string):
"""Parse coordinate string into list of polygons."""
regions = []
if not coord_string:
return regions
# Split by regions/lines
parts = coord_string.split('),region_') if 'region_' in coord_string else coord_string.split('),line_')
for part in parts:
# Extract coordinates
if ':(' in part:
coords_str = part.split(':(')[1] if ':(' in part else part
coords_str = coords_str.rstrip(')')
# Parse coordinate pairs
coords = []
pairs = coords_str.split('),(')
for pair in pairs:
pair = pair.strip('()')
if ',' in pair:
x, y = pair.split(',')
coords.append((int(x), int(y)))
if coords:
regions.append(coords)
return regions
# Example usage
sample = dataset['train'][0]
text_regions = parse_coordinates(sample['text_regions'])
text_lines = parse_coordinates(sample['text_lines'])
print(f"Found {len(text_regions)} text regions")
print(f"Found {len(text_lines)} text lines")
```
### Visualize Coordinates
```python
from PIL import Image, ImageDraw
def visualize_coordinates(image, text_regions, text_lines):
"""Draw coordinates on image."""
img_copy = image.copy()
draw = ImageDraw.Draw(img_copy)
# Parse and draw text regions (red)
regions = parse_coordinates(text_regions)
for region in regions:
if len(region) >= 3:
draw.polygon(region, outline='red', width=2)
# Parse and draw text lines (blue)
lines = parse_coordinates(text_lines)
for line in lines:
if len(line) >= 3:
draw.polygon(line, outline='blue', width=1)
return img_copy
# Visualize first sample
sample = dataset['train'][0]
annotated_image = visualize_coordinates(
sample['image'],
sample['text_regions'],
sample['text_lines']
)
annotated_image.show()
```
### Filter by Document
```python
# Filter by specific document
document_pages = dataset['train'].filter(lambda x: 'Aleksander Warma' in x['document_title'])
# Group by document
from collections import defaultdict
by_document = defaultdict(list)
for i, sample in enumerate(dataset['train']):
by_document[sample['document_title']].append(i)
print(f"Documents in dataset: {list(by_document.keys())}")
```
## π― Use Cases
This dataset is valuable for:
- **Text Detection**: Locating text regions and lines in historical documents
- **Layout Analysis Models**: Training systems to understand document structure
- **Reading Order Detection**: Understanding the sequence of text elements
- **Document Digitization**: Preprocessing Estonian archival materials
- **OCR Pipeline Development**: Creating robust text recognition workflows
- **Digital Humanities**: Analyzing Estonian historical document layouts
- **Computer Vision Research**: Document understanding and structure analysis
## π§ Technical Details
### Coordinate System
- Coordinates are in pixel space relative to the full page image
- Origin (0,0) is at top-left corner
- Polygons are stored as sequences of (x,y) points
- Text regions typically have 4 points (rectangles)
- Text lines may have variable number of points following text baseline
### Data Processing
- Extracted from Transkribus PAGE XML format
- Coordinate precision maintained from original annotations
- Images converted to RGB format for consistency
- Document titles extracted from Transkribus folder structure
## β οΈ Data Quality Notes
- Image quality varies based on historical document preservation
- Some pages may have irregular text layouts due to historical formatting
- Coordinate accuracy depends on original Transkribus annotation quality
- Text regions may overlap or have complex shapes
## π« Limitations
- Limited to Estonian language documents
- Historical document layouts may not represent modern document structures
- Dataset size is focused on quality over quantity
- Coordinate formats are optimised for polygon representation
- Some documents may have incomplete coordinate annotations
## π Contact
Depending on the nature of your question, please contact one of the following:
- Content of dataset: [@svlp](https://huggingface.co/svlp) or [@LudwigRoine](https://huggingface.co/LudwigRoine)
- Format or anything technical: [@paulpall](https://huggingface.co/paulpall)
- For everything else: [the National Archives of Estonia](https://www.ra.ee/en/kontakt/). |