wjbmattingly commited on
Commit
b6193e9
·
verified ·
1 Parent(s): 184c369

Update README.md

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