paulpall's picture
11-2025_update (#2)
ca64a0a verified
metadata
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

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

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

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

# 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: