--- license: cc-by-4.0 language: - km - en task_categories: - object-detection tags: - khmer - text-detection - ocr - document-analysis - yolo - synthetic - scene-text pretty_name: Khmer Text Detection (Ultimate) size_categories: - 10K ``` 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 | Field | Type | Description | |-------|------|-------------| | `image` | `Image` | Decoded PIL image | | `image_path` | `string` | Original file path at collection time | | `source` | `string` | `real_scene_text` / `doclaynet_khmer` / `synthetic_khmer_doc` | | `split` | `string` | `train` or `val` | | `annotations` | `string` | JSON list of YOLO bounding boxes | | `num_objects` | `int32` | Number 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](https://creativecommons.org/licenses/by/4.0/) — free to use, share, and adapt with attribution. ---