Model Card for trocr-18th-c-english-obb
This model is a finetuned TrOCR model designed for use on 18th century documents written in English. It was trained on the Revolutionary City Corpus. Although document layout analysis is not part of this model, the model was trained on document segments extracted as oriented bounding boxes. It is recommended to run this model as part of an Automatic Text Recognition pipeline using YOLO26 trained for oriented bounding box detection.
Model Details
Model Description
- Developed by: Center for Digital Scholarship, American Philosophical Society
- Model type: TrOCR
- Language(s) (NLP): English
- License: MIT
- Finetuned from model: microsoft/trocr-base-handwritten
Uses
Direct Use
The model's primary use is for handwritten text recognition on 18th century English. The model has been tested on samples of varying quality, including pages with heavy amounts of bleedthrough and damage, and should perform reasonably well across a wide variety of materials.
Downstream Use
The training data included a negligible amount of material in French and Latin. While the model may perform out of the box on these languages, it should be finetuned for most non-English tasks. The model has some success with 19th and 20th century English, but it will not perform as well in these domains as for 18th century English.
Out-of-Scope Use
This model will not work for languages written in scripts other than Latin and will perform poorly on languages other than English.
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
# load an image
path = 'path/to/your/image.jpg'
image = Image.open(path)
processor=TrOCRProcessor.from_pretrained('american-philosophical-society/trocr-18th-c-english-obb')
model = VisionEncoderDecoderModel.from_pretrained('american-philosopical-society/trocr-18th-c-english-obb')
pixel_values = processor(images=image, return_tensors='pt').pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
Alternatively, code for inference and integration with Islandora has been uploaded to GitHub.
Training Details
Training Data
This model was trained on The Revolutionary City Corpus (1758-1805): Ground Truth for Handwritten Text Recognition (HTR) for 18th Century Documents in English. Text was extracted from the ALTO files and the line boundaries were converted to oriented bounding boxes. The text was then rotated to a regular bounding box and extracted.
Evaluation
Testing Data, Factors & Metrics
Metrics
Character Error Rate: 6.27%