Downloads · 30 days
608
5% of all-time downloads
fhswf/TrOCR_Math_handwritten
TrOCR_Math_handwritten is a image-to-text model from fhswf. Use it when you need a caption or text from an image. It is set up for transformers. The card lists the license as afl-3.0.
TrOCR model fine-tuned on a part of the mathwriting dataset converted from InkML files into images. It was introduced in the paper TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models by Li e…
Downloads · 30 days
608
5% of all-time downloads
All-time downloads
11.3K
Public
Parameters
609M
4.9 GB on disk
Likes
8
Public
Click a slice to open those files.
.safetensors2.4 GB · 100%
From the Hugging Face model README
TrOCR model fine-tuned on a part of the mathwriting dataset converted from InkML files into images. It was introduced in the paper TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models by Li et al. and first released in this repository.
Here is how to use this model in PyTorch:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
import requests
url = "path/to/image"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
processor = TrOCRProcessor.from_pretrained('fhswf/TrOCR_Math_handwritten')
model = VisionEncoderDecoderModel.from_pretrained('fhswf/TrOCR_Math_handwritten')
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]
You can use the raw model for optical character recognition (OCR) on images containing one mathematical formula.
This model was finetuned on a part of the mathwriting dataset converted from InkML files into images.
Percentage of correct recognition: 77.8% <br> Percentage of correct recognition with one error: 85.7% <br> Percentage of correct recognition with two error: 89.9%
BibTeX:
@misc{li2021trocr,
title={TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models},
author={Minghao Li and Tengchao Lv and Lei Cui and Yijuan Lu and Dinei Florencio and Cha Zhang and Zhoujun Li and Furu Wei},
year={2021},
eprint={2109.10282},
archivePrefix={arXiv},
primaryClass={cs.CL}
}