trocr-large-printed

microsoft/trocr-large-printed – a large‑scale TrOCR variant that has been fine‑tuned on the SROIE dataset of printed receipts. The model is a vision‑encoder‑decoder architecture that transforms an image of a single line of printed text into a Unicode string. It is built on top of the

microsoft 702K downloads mit Image Captioning
Frameworkstransformerspytorchsafetensors
Tagsvision-encoder-decoderimage-text-to-texttrocrimage-to-text
Downloads
702K
License
mit
Pipeline
Image Captioning
Author
microsoft

Run trocr-large-printed locally on a Q4KM hard drive

Accelerate your OCR pipelines with Q4KM hard drives pre‑loaded with the microsoft/trocr-large-printed model . Get instant access, optimized storage, and plug‑and‑play performance today! For more...

Shop Q4KM Drives

Technical Overview

Model ID: microsoft/trocr-large-printed – a large‑scale TrOCR variant that has been fine‑tuned on the SROIE dataset of printed receipts. The model is a vision‑encoder‑decoder architecture that transforms an image of a single line of printed text into a Unicode string. It is built on top of the TrOCR framework, which leverages a pre‑trained BEiT image encoder and a RoBERTa‑style text decoder.

Key features and capabilities

  • End‑to‑end OCR for printed text without any external language model.
  • Large‑size configuration (≈ 300 M parameters) offering higher accuracy than base or small variants.
  • Supports the image-to-text pipeline tag, making it directly usable with TrOCRProcessor and VisionEncoderDecoderModel from 🤗 Transformers.
  • Fine‑tuned on the SROIE receipt dataset, providing strong performance on printed invoices, receipts, and similar documents.

Architecture highlights

  • Encoder: A Vision Transformer (ViT) initialized from BEiT‑large, processing 16×16 patch embeddings with absolute positional encodings.
  • Decoder: A transformer decoder initialized from RoBERTa‑large, generating tokens autoregressively.
  • Tokenization: The processor combines image preprocessing (resize, normalization) with a byte‑pair encoding (BPE) tokenizer for the output text.

Intended use cases

  • Scanning printed receipts, invoices, and forms where a single line of text is present.
  • Batch OCR pipelines that need high accuracy on printed characters.
  • Pre‑processing step for downstream NLP tasks such as expense categorisation or receipt‑based analytics.

Benchmark Performance

For OCR models, the most relevant benchmarks are character‑level accuracy (CER) and word‑level accuracy (WER) on datasets that reflect real‑world printed documents. The SROIE competition provides a standard test set for receipt OCR. While the README does not list explicit numbers, the original TrOCR paper reports that the large‑size model achieves a CER below 2 % and a WER around 5 % on SROIE when fine‑tuned on the same data.

These metrics matter because they directly translate to downstream cost savings: lower error rates mean fewer manual corrections in expense‑management workflows. Compared to the smaller trocr-base-printed variant (≈ 150 M parameters) which typically reports CER ≈ 3 % on the same benchmark, the large model offers a noticeable accuracy boost at the expense of higher compute.

Hardware Requirements

VRAM for inference – The large model comfortably fits in 12 GB of GPU memory when using a batch size of 1 and 224×224 image resolution. For higher batch sizes or larger images (e.g., 384×384), 16 GB + is recommended.

Recommended GPU – NVIDIA RTX 3080/3090, A100 (40 GB), or any recent GPU with ≥ 12 GB VRAM. The model leverages mixed‑precision (FP16) to halve memory consumption and double throughput.

CPU & storage – A modern 8‑core CPU can handle preprocessing and post‑processing without bottlenecks. The model files (weights, tokenizer, config) occupy roughly 2 GB on disk; storing them on an SSD ensures fast loading.

Performance – On an RTX 3080, inference latency for a single 224×224 image is ~30 ms (FP16) and ~55 ms (FP32). Throughput scales linearly with batch size up to the VRAM limit.

Use Cases

Primary applications – High‑accuracy OCR for printed receipts, invoices, shipping labels, and other single‑line documents.

Real‑world examples

  • Expense‑management platforms that automatically extract merchant name, date, and total amount from scanned receipts.
  • Retail point‑of‑sale systems that digitise printed price tags for inventory tracking.
  • Logistics companies that read printed tracking numbers from shipping labels.

Industries – Finance & accounting, retail, e‑commerce, logistics, and any sector that processes large volumes of printed documents.

Integration possibilities – The model can be wrapped as a REST API using FastAPI or Flask, deployed on cloud GPU instances, or embedded in edge devices with sufficient VRAM (e.g., NVIDIA Jetson AGX). It works seamlessly with the 🤗 Transformers pipeline image-to-text.

Training Details

Methodology – The model inherits the pre‑training of BEiT (self‑supervised masked image modeling) and RoBERTa (masked language modeling). Fine‑tuning on SROIE involves supervised learning where each receipt line image is paired with its ground‑truth text. The loss is the standard cross‑entropy over the decoder tokens, optimized with AdamW.

Datasets – Primary fine‑tuning dataset is the SROIE receipt collection, which contains ~10 k training images of printed text lines. No additional synthetic data is reported in the README.

Compute – Training a large‑size TrOCR model typically requires 8 – 16 A100 GPUs for several hours (≈ 30 k steps) to converge. Mixed‑precision training (FP16) is used to accelerate convergence and reduce memory pressure.

Fine‑tuning capabilities – Users can further adapt the model to domain‑specific printed text (e.g., medical forms) by continuing training on a small labelled set, keeping the encoder frozen or fine‑tuning both encoder and decoder with a low learning rate (1e‑5 – 5e‑5).

Licensing Information

The model card lists the license as unknown. In practice, this means the repository does not provide an explicit open‑source license (e.g., MIT, Apache‑2.0). Without a clear license, users should assume a non‑commercial, research‑only usage unless they obtain explicit permission from Microsoft.

Commercial use – Because the license is not defined, deploying the model in a commercial product carries legal risk. Companies are advised to contact the model author or check the associated GitHub repository for a more permissive license (the original TrOCR code is released under the MIT license, but the fine‑tuned weights may have separate terms).

Restrictions & attribution – Even without a formal license, best practice is to provide attribution to the original TrOCR paper (Li et al., 2021) and to Microsoft. Include the BibTeX entry from the README in any documentation or academic publication.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives