waritkan commited on
Commit
1f54d36
·
verified ·
1 Parent(s): 81ade20

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -25
README.md CHANGED
@@ -19,13 +19,13 @@ tags:
19
 
20
  # Thai Handwritten OCR (TrOCR)
21
 
22
- โมเดลรู้จำลายมือเขียนภาษาไทย (Thai Handwritten OCR) พัฒนาโดยการ Fine-tune จาก Microsoft TrOCR
23
 
24
  ## Model Details
25
 
26
  ### Model Description
27
 
28
- โมเดลนี้พัฒนาขึ้นเพื่อแปลงภาพลายมือเขียนภาษาไทยเป็นข้อความ โดยใช้สถาปัตยกรรม TrOCR ซึ่งรวม Vision Transformer (ViT) สำหรับการประมวลผลภาพ และ Transformer Decoder สำหรับการสร้างข้อความ
29
 
30
  - **Developed by:** Warit Sirikosityanggoon
31
  - **Model type:** Vision Encoder-Decoder (TrOCR)
@@ -41,28 +41,28 @@ tags:
41
 
42
  ### Direct Use
43
 
44
- สามารถใช้โมเดลนี้โดยตรงสำหรับการแปลงภาพลายมือเขียนภาษาไทยเป็นข้อความ เหมาะสำหรับ:
45
- - แปลงเอกสารลายมือเขียนภาษาไทย
46
- - ระบบจดจำลายมือเขียนแบบ real-time
47
- - การแปลงโน้ตหรือบันทึกที่เขียนด้วยมือ
48
 
49
  ### Out-of-Scope Use
50
 
51
- - ไม่เหมาะสำหรับภาษาอื่นนอกจากภาษาไทย
52
- - อาจทำงานได้ไม่ดีกับลายมือที่อ่านยากมากหรือภาพคุณภาพต่ำ
53
 
54
  ## Training Details
55
 
56
  ### Training Data
57
 
58
- ใช้ชุดข้อมูล [iapp/thai_handwriting_dataset](https://huggingface.co/datasets/iapp/thai_handwriting_dataset) ซึ่งประกอบด้วยภาพลายมือเขียนภาษาไทยและข้อความที่ถูกต้องคู่กัน
59
 
60
  ### Tokenizer
61
 
62
- ใช้ **SentencePiece แบบ Unigram** สำหรับ Tokenizer แทน Dictionary-based Word Segmentation เนื่องจาก:
63
- - รองรับคำที่ไม่อยู่ในพจนานุกรม (Out-of-Vocabulary)
64
- - รองรับคำสะกดผิดหรือคำไม่สมบูรณ์จากการเขียนลายมือ
65
- - ไม่ต้องพึ่งพาการตัดคำล่วงหน้า (Pre-tokenization)
66
 
67
  **Tokenizer Configuration:**
68
  - Vocab Size: 30,000
@@ -98,7 +98,7 @@ tags:
98
  import editdistance
99
 
100
  def calculate_cer(pred, label):
101
- """Character Error Rate (ยิ่งต่ำยิ่งดี)"""
102
  if len(label) == 0:
103
  return 1.0 if len(pred) > 0 else 0.0
104
  distance = editdistance.eval(pred, label)
@@ -156,23 +156,28 @@ print(text)
156
 
157
  ```
158
  Input Image
159
-
 
160
  Vision Transformer (ViT) Encoder
161
-
 
162
  Cross-Attention
163
-
 
164
  Transformer Decoder
165
-
 
166
  SentencePiece Tokenizer (Unigram)
167
-
 
168
  Thai Text Output
169
  ```
170
 
171
  ## Limitations
172
 
173
- - ประสิทธิภาพขึ้นอยู่กับคุณภาพของภาพและความชัดเจนของลายมือ
174
- - อาจทำงานได้ไม่ดีกับลายมือที่แตกต่างจากข้อมูลที่ใช้ train มาก
175
- - รองรับเฉพาะภาษาไทยเท่านั้น
176
 
177
  ## Citation
178
 
@@ -188,9 +193,9 @@ Thai Text Output
188
 
189
  ## Acknowledgements
190
 
191
- - [Microsoft TrOCR](https://huggingface.co/microsoft/trocr-base-handwritten) สำหรับ Pretrained Model
192
- - [iApp Technology](https://huggingface.co/datasets/iapp/thai_handwriting_dataset) สำหรับ Thai Handwriting Dataset
193
- - [SentencePiece](https://github.com/google/sentencepiece) สำหรับ Tokenizer
194
 
195
  ## Model Card Contact
196
 
 
19
 
20
  # Thai Handwritten OCR (TrOCR)
21
 
22
+ A Thai Handwritten OCR model fine-tuned from Microsoft TrOCR for recognizing Thai handwritten text.
23
 
24
  ## Model Details
25
 
26
  ### Model Description
27
 
28
+ This model is developed to convert Thai handwritten images into text using the TrOCR architecture, which combines Vision Transformer (ViT) for image processing and Transformer Decoder for text generation.
29
 
30
  - **Developed by:** Warit Sirikosityanggoon
31
  - **Model type:** Vision Encoder-Decoder (TrOCR)
 
41
 
42
  ### Direct Use
43
 
44
+ This model can be used directly for converting Thai handwritten images into text. Suitable for:
45
+ - Converting Thai handwritten documents
46
+ - Real-time handwriting recognition systems
47
+ - Digitizing handwritten notes
48
 
49
  ### Out-of-Scope Use
50
 
51
+ - Not suitable for languages other than Thai
52
+ - May not perform well on extremely difficult handwriting or low-quality images
53
 
54
  ## Training Details
55
 
56
  ### Training Data
57
 
58
+ Trained on [iapp/thai_handwriting_dataset](https://huggingface.co/datasets/iapp/thai_handwriting_dataset), which contains Thai handwritten images paired with their corresponding text labels.
59
 
60
  ### Tokenizer
61
 
62
+ Uses **SentencePiece with Unigram algorithm** instead of Dictionary-based Word Segmentation because:
63
+ - Handles Out-of-Vocabulary words effectively
64
+ - Supports misspelled or incomplete words from handwriting
65
+ - No pre-tokenization required
66
 
67
  **Tokenizer Configuration:**
68
  - Vocab Size: 30,000
 
98
  import editdistance
99
 
100
  def calculate_cer(pred, label):
101
+ """Character Error Rate (lower is better)"""
102
  if len(label) == 0:
103
  return 1.0 if len(pred) > 0 else 0.0
104
  distance = editdistance.eval(pred, label)
 
156
 
157
  ```
158
  Input Image
159
+ |
160
+ v
161
  Vision Transformer (ViT) Encoder
162
+ |
163
+ v
164
  Cross-Attention
165
+ |
166
+ v
167
  Transformer Decoder
168
+ |
169
+ v
170
  SentencePiece Tokenizer (Unigram)
171
+ |
172
+ v
173
  Thai Text Output
174
  ```
175
 
176
  ## Limitations
177
 
178
+ - Performance depends on image quality and handwriting clarity
179
+ - May not perform well on handwriting styles significantly different from training data
180
+ - Supports Thai language only
181
 
182
  ## Citation
183
 
 
193
 
194
  ## Acknowledgements
195
 
196
+ - [Microsoft TrOCR](https://huggingface.co/microsoft/trocr-base-handwritten) for Pretrained Model
197
+ - [iApp Technology](https://huggingface.co/datasets/iapp/thai_handwriting_dataset) for Thai Handwriting Dataset
198
+ - [SentencePiece](https://github.com/google/sentencepiece) for Tokenizer
199
 
200
  ## Model Card Contact
201