CoolFace
Datasetpublic

Darayut/Textline-Detection-Dataset

Textline Detection — Ultimate Dataset A large-scale, multi-source dataset for textline detection using YOLO-format bounding box annotations. Combines real scene text, document layout images, and synthetically generated Khmer document images. Dataset Summary Split Images Train 30,658 Val 2,764 Total 33,422 Classes ID Name Description 0 text_line A line of Khmer or mixed-script text 1 image An embedded image/figure… See the full description on the dataset page: https://huggingface.co/datasets/Darayut/Textline-Detection-Dataset.

sourceHugging Facecc-by-4.0updated 6mo agoView on Hugging Face
0likes33downloads
Dataset Card

Textline Detection — Ultimate Dataset

A large-scale, multi-source dataset for textline detection using YOLO-format bounding box annotations. Combines real scene text, document layout images, and synthetically generated Khmer document images.


Dataset Summary

SplitImages
Train30,658
Val2,764
Total33,422

Classes

IDNameDescription
0text_lineA line of Khmer or mixed-script text
1imageAn embedded image/figure region within a document

Data Sources

1. Real Scene Text

Images captured in natural environments — street signs, storefronts, billboards, and handwritten Khmer documents. Derived from the DonkeySmall base dataset (~26K images).

2. Document Layout

Images from the DocLayNet multi-class document layout corpus, re-labelled for the two-class schema. Covers documents: official reports, newspapers, and books.

3. Synthetic Khmer Documents

Programmatically generated document images using custom Khmer text rendering pipelines. Fonts, sizes, backgrounds, and layouts are randomised. Labels are auto-generated (zero annotation cost).


Annotation Format

Labels follow YOLO v8 format — coordinates normalised to [0, 1]:

<class_id> <cx> <cy> <width> <height>

The annotations field is a JSON-serialised list:

json
[
  {"class_id": 0, "cx": 0.512, "cy": 0.234, "w": 0.310, "h": 0.045},
  {"class_id": 1, "cx": 0.720, "cy": 0.600, "w": 0.200, "h": 0.250}
]

Dataset Fields

FieldTypeDescription
imageImageDecoded PIL image
image_pathstringOriginal file path at collection time
sourcestringreal_scene_text / doclaynet_khmer / synthetic_khmer_doc
splitstringtrain or val
annotationsstringJSON list of YOLO bounding boxes
num_objectsint32Number of annotated objects

Usage

python
from datasets import load_dataset

ds = load_dataset("Darayut/Multilingual-Textline-Detection-Dataset")

sample = ds["train"][0]
print(sample["source"], sample["num_objects"])
sample["image"].show()

Convert back to YOLO label files

python
import json
from pathlib import Path

def save_labels(split, out_dir):
    Path(out_dir).mkdir(parents=True, exist_ok=True)
    for row in ds[split]:
        stem = Path(row["image_path"]).stem
        anns = json.loads(row["annotations"])
        with open(f"{out_dir}/{stem}.txt", "w") as f:
            for a in anns:
                f.write(f"{a['class_id']} {a['cx']:.6f} {a['cy']:.6f} {a['w']:.6f} {a['h']:.6f}\n")

save_labels("train", "labels/train")
save_labels("val",   "labels/val")

YAML config for YOLOv8 training

yaml
train: /path/to/images/train
val:   /path/to/images/val
nc: 2
names:
  0: text_line
  1: image

Limitations

  • Synthetic images may not capture all real-world degradation (blur, skew, lighting variation).
  • Scene-text labels are semi-automatic and may have occasional missed detections.
  • Dataset is primarily Khmer script; other scripts appear only incidentally.

License

CC BY 4.0 — free to use, share, and adapt with attribution.