wjbmattingly commited on
Commit
35c8573
·
verified ·
1 Parent(s): 9a6f27a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -3
README.md CHANGED
@@ -1,3 +1,78 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - lat
5
+ datasets:
6
+ - CATMuS/medieval
7
+ tags:
8
+ - trocr
9
+ - image-to-text
10
+ widget:
11
+ - src: https://huggingface.co/medieval-data/trocr-medieval-latin-caroline/resolve/main/images/heldout2.png
12
+ example_title: Heldout Sample 1
13
+ - src: https://huggingface.co/medieval-data/trocr-medieval-latin-caroline/resolve/main/images/heldout1.png
14
+ example_title: Heldout Sample 2
15
+ ---
16
+
17
+ ![logo](logo-banner.png)
18
+
19
+ # About
20
+
21
+ This is a TROcr model for medieval Castilian, specifically the Hybrida script. The base model was [microsoft/trocr-base-handwritten](https://huggingface.co/microsoft/trocr-base-handwritten) for the [medieval-data/trocr-medieval-latin-caroline](https://huggingface.co/medieval-data/trocr-medieval-latin-caroline). From a saved checkpoint, the model was further finetuned to Castilian Hybrida.
22
+
23
+ The dataset used for training was [CATMuS](https://huggingface.co/datasets/CATMuS/medieval).
24
+
25
+ The model has not been formally tested. Preliminary examination indicates that further finetuning is needed.
26
+
27
+ Finetuning was done with finetune.py found in this repository.
28
+
29
+ # Usage
30
+
31
+ ```python
32
+ from transformers import TrOCRProcessor, VisionEncoderDecoderModel
33
+ from PIL import Image
34
+ import requests
35
+
36
+ # load image from the IAM database
37
+ url = 'https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg'
38
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
39
+
40
+ processor = TrOCRProcessor.from_pretrained('medieval-data/trocr-medieval-castilian-hybrida')
41
+ model = VisionEncoderDecoderModel.from_pretrained('medieval-data/trocr-medieval-castilian-hybrida')
42
+ pixel_values = processor(images=image, return_tensors="pt").pixel_values
43
+
44
+ generated_ids = model.generate(pixel_values)
45
+ generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
46
+ ```
47
+
48
+ # BibTeX entry and citation info
49
+
50
+ ## TrOCR Paper
51
+
52
+ ```tex
53
+ @misc{li2021trocr,
54
+ title={TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models},
55
+ author={Minghao Li and Tengchao Lv and Lei Cui and Yijuan Lu and Dinei Florencio and Cha Zhang and Zhoujun Li and Furu Wei},
56
+ year={2021},
57
+ eprint={2109.10282},
58
+ archivePrefix={arXiv},
59
+ primaryClass={cs.CL}
60
+ }
61
+ ```
62
+
63
+ ## CATMuS Paper
64
+
65
+ ```tex
66
+ @unpublished{clerice:hal-04453952,
67
+ TITLE = {{CATMuS Medieval: A multilingual large-scale cross-century dataset in Latin script for handwritten text recognition and beyond}},
68
+ AUTHOR = {Cl{\'e}rice, Thibault and Pinche, Ariane and Vlachou-Efstathiou, Malamatenia and Chagu{\'e}, Alix and Camps, Jean-Baptiste and Gille-Levenson, Matthias and Brisville-Fertin, Olivier and Fischer, Franz and Gervers, Michaels and Boutreux, Agn{\`e}s and Manton, Avery and Gabay, Simon and O'Connor, Patricia and Haverals, Wouter and Kestemont, Mike and Vandyck, Caroline and Kiessling, Benjamin},
69
+ URL = {https://inria.hal.science/hal-04453952},
70
+ NOTE = {working paper or preprint},
71
+ YEAR = {2024},
72
+ MONTH = Feb,
73
+ KEYWORDS = {Historical sources ; medieval manuscripts ; Latin scripts ; benchmarking dataset ; multilingual ; handwritten text recognition},
74
+ PDF = {https://inria.hal.science/hal-04453952/file/ICDAR24___CATMUS_Medieval-1.pdf},
75
+ HAL_ID = {hal-04453952},
76
+ HAL_VERSION = {v1},
77
+ }
78
+ ```