Darayut commited on
Commit
414548b
·
verified ·
1 Parent(s): 54a8364

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +156 -30
README.md CHANGED
@@ -1,32 +1,158 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: image
5
- dtype: image
6
- - name: image_path
7
- dtype: string
8
- - name: source
9
- dtype: string
10
- - name: split
11
- dtype: string
12
- - name: annotations
13
- dtype: string
14
- - name: num_objects
15
- dtype: int32
16
- splits:
17
- - name: train
18
- num_bytes: 9212999500
19
- num_examples: 30658
20
- - name: val
21
- num_bytes: 836584640
22
- num_examples: 2764
23
- download_size: 8854148134
24
- dataset_size: 10049584140
25
- configs:
26
- - config_name: default
27
- data_files:
28
- - split: train
29
- path: data/train-*
30
- - split: val
31
- path: data/val-*
32
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - km
5
+ task_categories:
6
+ - object-detection
7
+ tags:
8
+ - khmer
9
+ - text-detection
10
+ - ocr
11
+ - document-analysis
12
+ - yolo
13
+ - synthetic
14
+ - scene-text
15
+ pretty_name: Khmer Text Detection (Ultimate)
16
+ size_categories:
17
+ - 10K<n<100K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ---
19
+
20
+ # Khmer Text Detection — Ultimate Dataset
21
+
22
+ A large-scale, multi-source dataset for **Khmer text detection** using YOLO-format bounding box annotations.
23
+ Combines real scene text, document layout images, and synthetically generated Khmer document images.
24
+
25
+ ---
26
+
27
+ ## Dataset Summary
28
+
29
+ | Split | Images |
30
+ |-------|--------|
31
+ | Train | 30,658 |
32
+ | Val | 2,764 |
33
+ | **Total** | **33,422** |
34
+
35
+ ### Classes
36
+
37
+ | ID | Name | Description |
38
+ |----|------|-------------|
39
+ | 0 | `text_line` | A line of Khmer or mixed-script text |
40
+ | 1 | `image` | An embedded image/figure region within a document |
41
+
42
+ ---
43
+
44
+ ## Data Sources
45
+
46
+ ### 1. Real Scene Text (`real_scene_text`)
47
+ Images captured in natural environments — street signs, storefronts, billboards, and handwritten Khmer documents.
48
+ Derived from the **DonkeySmall** base dataset (~26K images).
49
+
50
+ ### 2. Document Layout (`doclaynet_khmer`)
51
+ Images from the **DocLayNet**-style multi-class document layout corpus, re-labelled for the two-class schema.
52
+ Covers printed Khmer documents: official reports, newspapers, and books.
53
+
54
+ ### 3. Synthetic Khmer Documents (`synthetic_khmer_doc`)
55
+ Programmatically generated document images using custom Khmer text rendering pipelines.
56
+ Fonts, sizes, backgrounds, and layouts are randomised. Labels are auto-generated (zero annotation cost).
57
+
58
+ ---
59
+
60
+ ## Annotation Format
61
+
62
+ Labels follow **YOLO v8** format — coordinates normalised to `[0, 1]`:
63
+
64
+ ```
65
+ <class_id> <cx> <cy> <width> <height>
66
+ ```
67
+
68
+ The `annotations` field is a JSON-serialised list:
69
+
70
+ ```json
71
+ [
72
+ {"class_id": 0, "cx": 0.512, "cy": 0.234, "w": 0.310, "h": 0.045},
73
+ {"class_id": 1, "cx": 0.720, "cy": 0.600, "w": 0.200, "h": 0.250}
74
+ ]
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Dataset Fields
80
+
81
+ | Field | Type | Description |
82
+ |-------|------|-------------|
83
+ | `image` | `Image` | Decoded PIL image |
84
+ | `image_path` | `string` | Original file path at collection time |
85
+ | `source` | `string` | `real_scene_text` / `doclaynet_khmer` / `synthetic_khmer_doc` |
86
+ | `split` | `string` | `train` or `val` |
87
+ | `annotations` | `string` | JSON list of YOLO bounding boxes |
88
+ | `num_objects` | `int32` | Number of annotated objects |
89
+
90
+ ---
91
+
92
+ ## Usage
93
+
94
+ ```python
95
+ from datasets import load_dataset
96
+
97
+ ds = load_dataset("Darayut/Multilingual-Textline-Detection-Dataset")
98
+
99
+ sample = ds["train"][0]
100
+ print(sample["source"], sample["num_objects"])
101
+ sample["image"].show()
102
+ ```
103
+
104
+ ### Convert back to YOLO label files
105
+
106
+ ```python
107
+ import json
108
+ from pathlib import Path
109
+
110
+ def save_labels(split, out_dir):
111
+ Path(out_dir).mkdir(parents=True, exist_ok=True)
112
+ for row in ds[split]:
113
+ stem = Path(row["image_path"]).stem
114
+ anns = json.loads(row["annotations"])
115
+ with open(f"{out_dir}/{stem}.txt", "w") as f:
116
+ for a in anns:
117
+ f.write(f"{a['class_id']} {a['cx']:.6f} {a['cy']:.6f} {a['w']:.6f} {a['h']:.6f}\n")
118
+
119
+ save_labels("train", "labels/train")
120
+ save_labels("val", "labels/val")
121
+ ```
122
+
123
+ ### YAML config for YOLOv8 training
124
+
125
+ ```yaml
126
+ train: /path/to/images/train
127
+ val: /path/to/images/val
128
+ nc: 2
129
+ names:
130
+ 0: text_line
131
+ 1: image
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Limitations
137
+
138
+ - Synthetic images may not capture all real-world degradation (blur, skew, lighting variation).
139
+ - Scene-text labels are semi-automatic and may have occasional missed detections.
140
+ - Dataset is primarily Khmer script; other scripts appear only incidentally.
141
+
142
+ ---
143
+
144
+ ## License
145
+
146
+ [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) — free to use, share, and adapt with attribution.
147
+
148
+ ---
149
+
150
+ ## Citation
151
+
152
+ ```bibtex
153
+ @dataset{khmer_text_detection_ultimate,
154
+ title = {Khmer Text Detection — Ultimate Dataset},
155
+ year = {2025},
156
+ url = {https://huggingface.co/datasets/Darayut/Multilingual-Textline-Detection-Dataset}
157
+ }
158
+ ```