Datasets:
File size: 6,096 Bytes
4b00911 537cca3 4b00911 537cca3 4b00911 537cca3 4b00911 537cca3 4b00911 537cca3 4b00911 537cca3 4b00911 c1fef2e | 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 216 217 218 | ---
dataset_info:
features:
- name: image_id
dtype: int64
- name: image
dtype: image
- name: width
dtype: int64
- name: height
dtype: int64
- name: objects
sequence:
- name: id
dtype: int64
- name: area
dtype: int64
- name: bbox
sequence: float32
length: 4
- name: category
dtype:
class_label:
names:
'0': Textline
'1': Heading
'2': Picture
'3': Caption
'4': Columns
- name: ground_truth
struct:
- name: gt_parse
struct:
- name: headline
sequence: string
- name: textline
sequence: string
splits:
- name: train
num_bytes: 84308039804.908
num_examples: 58738
download_size: 93323036554
dataset_size: 84308039804.908
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
license: mit
task_categories:
- image-classification
- object-detection
- visual-question-answering
language:
- dv
tags:
- dhivehi
- thaana
- ocr
- vqa
- bbox
- textline
pretty_name: dv_page_annotation
size_categories:
- 10K<n<100K
---
# π¦ Dhivehi Synthetic Document Layout + Textline Dataset
This dataset contains **synthetically generated** image-document pairs with detailed layout annotations and ground-truth Dhivehi text extractions.
Itβs designed for document layout analysis, visual document understanding, OCR fine-tuning, and related tasks specifically for Dhivehi script.
***Note: this version image are compressed.***
***Raw version π **Repository**: [Hugging Face Datasets](https://huggingface.co/datasets/alakxender/od-syn-page-annotations)***
## π Dataset Summary
- **Total Examples**: ~58,738
- **Image Content**: Synthetic Dhivehi documents generated to simulate real-world layouts, including headlines, textlines, pictures, and captions.
- **Annotations**:
- Bounding boxes (`bbox`)
- Object areas (`area`)
- Object categories (`category`)
- Ground-truth parsed text, split into:
- `headline` (major headings)
- `textline` (paragraph or text body lines)
## β οΈ Important Note
This dataset is **synthetic** β no real-world documents or personal data were used. It was generated programmatically to train and evaluate models under controlled conditions, without legal or ethical concerns tied to real-world data.
## π·οΈ Categories
| Label ID | Label Name |
|----------|-------------|
| 0 | Textline |
| 1 | Heading |
| 2 | Picture |
| 3 | Caption |
| 4 | Columns |
## π Features
| Field | Type |
|----------------------|-----------------------------------------|
| `image_id` | int64 |
| `image` | image |
| `width` | int64 |
| `height` | int64 |
| `objects` | List of:
- `id`: int64
- `area`: int64
- `bbox`: [x, y, width, height] (float32)
- `category`: label (class label 0β4) |
| `ground_truth.gt_parse` |
- `headline`: list of strings
- `textline`: list of strings |
## π Split
| Split | # Examples | Size (bytes) |
|--------|------------|----------------------|
| Train | 58,738 | ~84.31 GB (compressed) |
## π¦ Download
- **Download size**: ~93.32 GB
- **Uncompressed dataset size**: ~84.31 GB
## π§ Example Use (with π€ Datasets)
```python
from datasets import load_dataset
dataset = load_dataset("alakxender/od-syn-page-annotations")
categories = dataset.features["objects"].feature["category"].names
id2label = {i: name for i, name in enumerate(categories)}
print(id2label)
sample = dataset['train'][0]
print("Image ID:", sample['image_id'])
print("Image size:", sample['width'], "x", sample['height'])
print("First object category:", sample['objects']['category'][0])
print("First headline:", sample['ground_truth']['gt_parse']['headline'][0])
```
## π Visualize
```python
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from datasets import load_dataset
def get_color(idx):
palette = [
"red", "green", "blue", "orange", "purple", "cyan", "magenta", "yellow", "lime", "pink"
]
return palette[idx % len(palette)]
def draw_bboxes(sample, id2label, save_path=None):
"""
Draw bounding boxes and labels on a single dataset sample.
Args:
sample: A dataset example (dict) with 'image' and 'objects'.
id2label: Mapping from category ID to label name.
save_path: If provided, saves the image to this path.
Returns:
PIL Image with drawn bounding boxes.
"""
image = sample["image"]
annotations = sample["objects"]
image = Image.fromarray(np.array(image))
draw = ImageDraw.Draw(image)
try:
font = ImageFont.truetype("arial.ttf", 14)
except:
font = ImageFont.load_default()
for category, box in zip(annotations["category"], annotations["bbox"]):
x, y, w, h = box
color = get_color(category)
draw.rectangle((x, y, x + w, y + h), outline=color, width=2)
label = id2label[category]
bbox = font.getbbox(label)
text_width = bbox[2] - bbox[0]
text_height = bbox[3] - bbox[1]
draw.rectangle([x, y, x + text_width + 4, y + text_height + 2], fill=color)
draw.text((x + 2, y + 1), label, fill="black", font=font)
if save_path:
image.save(save_path)
print(f"Saved image to {save_path}")
else:
image.show()
return image
# Load one sample
dataset = load_dataset("alakxender/od-syn-page-annotations", split="train[:1]")
# Get category mapping
categories = dataset.features["objects"].feature["category"].names
id2label = {i: name for i, name in enumerate(categories)}
# Draw bounding boxes on the first sample
draw_bboxes(
sample=dataset[0],
id2label=id2label,
save_path="sample_0.png"
)
```
|