# TrOCR

> Transformer-based optical character recognition with pre-trained image and text Transformers

Source: https://talira.ai/catalog/trocr-9aw5e1rs
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: AI model
- Categories: [ai / ocr](https://talira.ai/categories/ai/ocr), [ai / models / ocr](https://talira.ai/categories/ai/models/ocr)
- Licence: MIT[^3][^4]
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes[^1]
- Backed by: [Microsoft](https://talira.ai/orgs/microsoft.md)
- Creator: Minghao Li, Tengchao Lv, Lei Cui, Furu Wei and others at Microsoft Research
- Funding: public company (NASDAQ:MSFT)[^5]

TrOCR is a family of text recognition models from Microsoft Research, introduced in the paper "TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models" (AAAI 2023). Each is an encoder-decoder: an image Transformer initialised from BEiT reads the image in 16x16 patches and a text Transformer initialised from RoBERTa generates the text. Microsoft released small (62M parameters), base (334M) and large (558M) sizes, each fine-tuned for handwriting on the IAM dataset, for printed receipts on SROIE, or for scene text, plus the pre-trained stage-1 checkpoints for your own fine-tuning. The weights are on Hugging Face and run with Hugging Face Transformers; the original fairseq code is in Microsoft's unilm repository under the MIT licence.

## Links

- Website: https://github.com/microsoft/unilm/tree/master/trocr
- GitHub: https://github.com/microsoft/unilm
- Docs: https://huggingface.co/docs/transformers/model_doc/trocr

## Problems it solves

- recognise handwritten text lines from scanned notes with an open model I run myself
- transformer OCR model I can fine-tune on my own handwriting samples or historical documents
- read printed receipt text line by line with an open-weights model
- MIT-licensed handwriting recognition model that runs locally with Hugging Face Transformers
- recognise the text in cropped line images that my own text detector already found
- scene text recognition model for words photographed in natural images
- pretrained OCR encoder-decoder checkpoint to start from instead of training from scratch

## Features

- handwritten variants fine-tuned on IAM (cased CER 4.22 small, 3.42 base, 2.89 large)
- printed variants fine-tuned on SROIE receipts (F1 95.86 to 96.60)
- scene text recognition (STR) variants
- stage-1 pre-trained checkpoints for fine-tuning
- small 62M, base 334M and large 558M parameter sizes
- BEiT image encoder and RoBERTa text decoder
- TrOCRProcessor and VisionEncoderDecoderModel in Hugging Face Transformers
- original fairseq training and fine-tuning scripts

## Limitations

- Doesn't read whole pages: each model reads a single line of text from a cropped image, so a separate text detector must find the lines first[^1][^2]

## Capabilities

- Has official SDKs: plan not known

## Trust

Overall: 0.45 out of 1.
Signals: backing 0.75, extensibility 0.00.

- backed by Microsoft
- created by Minghao Li, Tengchao Lv, Lei Cui, Furu Wei and others at Microsoft Research
- funding: public company (NASDAQ:MSFT)

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [PP-OCRv5](https://talira.ai/catalog/pp-ocrv5-jxc0pj5z.md): PaddleOCR's fifth-generation text detection and recognition models, server and mobile sizes
- [PP-OCRv6](https://talira.ai/catalog/pp-ocrv6-jzbxc0ky.md): PaddleOCR's sixth-generation text detection and recognition models, from 1.5M to 34.5M parameters
- [Tesseract](https://talira.ai/catalog/tesseract-n5wxbj3p.md): Tesseract Open Source OCR Engine
- [docTR](https://talira.ai/catalog/doctr-5n27z5h2.md): Document Text Recognition: open source OCR powered by PyTorch
- [EasyOCR](https://talira.ai/catalog/easyocr-hd0rqfgh.md): Ready-to-use OCR with 80+ supported languages and all popular writing scripts
- [Mistral OCR](https://talira.ai/catalog/mistral-ocr-nzhs5x26.md): Mistral AI's document OCR model and API: PDFs and images to structured Markdown, priced per page

## Sources

[^1]: https://huggingface.co/microsoft/trocr-base-handwritten (checked 20 Nov 2026)
[^2]: https://huggingface.co/microsoft/trocr-base-printed (checked 20 Nov 2026)
[^3]: https://github.com/microsoft/unilm/blob/master/LICENSE (checked 20 Nov 2026)
[^4]: https://github.com/microsoft/unilm/tree/master/trocr (checked 20 Nov 2026)
[^5]: https://www.sec.gov/files/company_tickers_exchange.json (checked 20 Nov 2026)
