fhswf/TrOCR_Math_handwritten
8603
1---2library_name: transformers3pipeline_tag: image-to-text4license: afl-3.05---6 7# Model Card for TrOCR_Math_handwritten8 9<!-- Provide a quick summary of what the model is/does. -->10 11 12 13## Model Details14 15 16<!-- Provide a longer summary of what this model is. -->17 18TrOCR model fine-tuned on a part of the [mathwriting](https://github.com/google-research/google-research/tree/master/mathwriting) dataset converted from InkML files into images. It was introduced in the paper [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) by Li et al. and first released in [this repository](https://github.com/microsoft/unilm/tree/master/trocr).19 20- **Developed by:** [More Information Needed]21- **Model type:** Transformer OCR22- **License:** afl-3.023- **Finetuned from model [optional]:** [TrOCR_large_stage1](https://huggingface.co/microsoft/trocr-large-stage1)24 25 26## Uses27 28Here is how to use this model in PyTorch:29 30```python31from transformers import TrOCRProcessor, VisionEncoderDecoderModel32from PIL import Image33import requests34 35url = "path/to/image"36image = Image.open(requests.get(url, stream=True).raw).convert("RGB")37processor = TrOCRProcessor.from_pretrained('fhswf/TrOCR_Math_handwritten')38model = VisionEncoderDecoderModel.from_pretrained('fhswf/TrOCR_Math_handwritten')39pixel_values = processor(images=image, return_tensors="pt").pixel_values40generated_ids = model.generate(pixel_values)41generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]42```43 44## Bias, Risks, and Limitations45 46You can use the raw model for optical character recognition (OCR) on images containing one mathematical formula.47 48 49 50## Training Details51 52### Training Data53 54<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->55 56This model was finetuned on a part of the [mathwriting](https://github.com/google-research/google-research/tree/master/mathwriting) dataset converted from InkML files into images.57 58 59 60## Evaluation61 62<!-- This section describes the evaluation protocols and provides the results. -->63Percentage of correct recognition: 77.8% <br>64Percentage of correct recognition with one error: 85.7% <br>65Percentage of correct recognition with two error: 89.9%66 67 68 69 70**BibTeX:**71 72```bibtex73@misc{li2021trocr,74 title={TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models}, 75 author={Minghao Li and Tengchao Lv and Lei Cui and Yijuan Lu and Dinei Florencio and Cha Zhang and Zhoujun Li and Furu Wei},76 year={2021},77 eprint={2109.10282},78 archivePrefix={arXiv},79 primaryClass={cs.CL}80}81```