Update README.md
Browse files
README.md
CHANGED
@@ -11,4 +11,21 @@ Vision Encoder Decoder Models
|
|
11 |
- Use microsoft/trocr-base-handwritten as encoder.
|
12 |
- Use airesearch/wangchanberta-base-att-spm-uncased as decoder
|
13 |
- Fine-tune on 250k synthetic text images dataset using [ThaiGov V2 Corpus](https://github.com/PyThaiNLP/thaigov-v2-corpus)
|
14 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
- Use microsoft/trocr-base-handwritten as encoder.
|
12 |
- Use airesearch/wangchanberta-base-att-spm-uncased as decoder
|
13 |
- Fine-tune on 250k synthetic text images dataset using [ThaiGov V2 Corpus](https://github.com/PyThaiNLP/thaigov-v2-corpus)
|
14 |
+
- Use [SynthTIGER](https://github.com/clovaai/synthtiger) to generate synthetic text image.
|
15 |
+
- It is useful to fine-tune any Thai OCR task.
|
16 |
+
|
17 |
+
# Usage
|
18 |
+
|
19 |
+
```
|
20 |
+
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
|
21 |
+
|
22 |
+
processor = TrOCRProcessor.from_pretrained("kkatiz/ocr-nithan")
|
23 |
+
model = VisionEncoderDecoderModel.from_pretrained("kkatiz/ocr-nithan")
|
24 |
+
|
25 |
+
image = Image.open(img_path).convert("RGB")
|
26 |
+
pixel_values = processor(image, return_tensors="pt").pixel_values
|
27 |
+
generated_ids = model.generate(pixel_values)
|
28 |
+
|
29 |
+
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
30 |
+
print(generated_text)
|
31 |
+
```
|