wjbmattingly commited on
Commit
eb4f066
1 Parent(s): 97a6a25

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +87 -3
README.md CHANGED
@@ -1,3 +1,87 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - lat
5
+ - fr
6
+ - it
7
+ - spa
8
+ - ca
9
+ datasets:
10
+ - CATMuS/medieval
11
+ tags:
12
+ - trocr
13
+ - image-to-text
14
+ widget:
15
+ - src: >-
16
+ https://huggingface.co/medieval-data/trocr-medieval-cursiva/resolve/main/images/humanistica-1.png
17
+ example_title: Humanistica 1
18
+ - src: >-
19
+ https://huggingface.co/medieval-data/trocr-medieval-cursiva/resolve/main/images/humanistica-2.png
20
+ example_title: Humanistica 2
21
+ - src: >-
22
+ https://huggingface.co/medieval-data/trocr-medieval-cursiva/resolve/main/images/humanistica-3.png
23
+ example_title: Humanistica 3
24
+ ---
25
+
26
+ ![logo](logo-cursiva.png)
27
+
28
+ # About
29
+
30
+ This is a TrOCR model for medieval Humanistica. The base model was [microsoft/trocr-base-handwritten](https://huggingface.co/microsoft/trocr-base-handwritten). The model was then finetuned to Caroline: [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 Humanistica.
31
+
32
+ The dataset used for training was [CATMuS](https://huggingface.co/datasets/CATMuS/medieval).
33
+
34
+ The model has not been formally tested. Preliminary examination indicates that further finetuning is needed.
35
+
36
+ Finetuning was done with finetune.py found in this repository.
37
+
38
+ # Usage
39
+
40
+ ```python
41
+ from transformers import TrOCRProcessor, VisionEncoderDecoderModel
42
+ from PIL import Image
43
+ import requests
44
+
45
+ # load image from the IAM database
46
+ url = 'https://huggingface.co/medieval-data/trocr-medieval-humanistica/resolve/main/images/humanistica-1.png'
47
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
48
+
49
+ processor = TrOCRProcessor.from_pretrained('medieval-data/trocr-medieval-humanistica')
50
+ model = VisionEncoderDecoderModel.from_pretrained('medieval-data/trocr-medieval-humanistica')
51
+ pixel_values = processor(images=image, return_tensors="pt").pixel_values
52
+
53
+ generated_ids = model.generate(pixel_values)
54
+ generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
55
+ ```
56
+
57
+ # BibTeX entry and citation info
58
+
59
+ ## TrOCR Paper
60
+
61
+ ```tex
62
+ @misc{li2021trocr,
63
+ title={TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models},
64
+ author={Minghao Li and Tengchao Lv and Lei Cui and Yijuan Lu and Dinei Florencio and Cha Zhang and Zhoujun Li and Furu Wei},
65
+ year={2021},
66
+ eprint={2109.10282},
67
+ archivePrefix={arXiv},
68
+ primaryClass={cs.CL}
69
+ }
70
+ ```
71
+
72
+ ## CATMuS Paper
73
+
74
+ ```tex
75
+ @unpublished{clerice:hal-04453952,
76
+ TITLE = {{CATMuS Medieval: A multilingual large-scale cross-century dataset in Latin script for handwritten text recognition and beyond}},
77
+ 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},
78
+ URL = {https://inria.hal.science/hal-04453952},
79
+ NOTE = {working paper or preprint},
80
+ YEAR = {2024},
81
+ MONTH = Feb,
82
+ KEYWORDS = {Historical sources ; medieval manuscripts ; Latin scripts ; benchmarking dataset ; multilingual ; handwritten text recognition},
83
+ PDF = {https://inria.hal.science/hal-04453952/file/ICDAR24___CATMUS_Medieval-1.pdf},
84
+ HAL_ID = {hal-04453952},
85
+ HAL_VERSION = {v1},
86
+ }
87
+ ```