Instructions to use microsoft/trocr-large-handwritten with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/trocr-large-handwritten with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="microsoft/trocr-large-handwritten")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/trocr-large-handwritten") model = AutoModelForMultimodalLM.from_pretrained("microsoft/trocr-large-handwritten") - Notebooks
- Google Colab
- Kaggle
How do I use it for multiple lines of handwritten text?
#5
by abhikatta - opened
So, I want to use the model on a chunk of handwritten text, I tried splitting the image using OpenCV, but it didn't work as expected, either I get duplicates of each line, or I get nothing. If anyone could help me with this, I would greatly appreciate it.
Same problem
you may first use text detectors like CRAFT to cut out the text regions, then send those images to TrOCR to get recognitions.
use EasyOCR to get location of text, then use those location to take cutout from image and perform TrOCR on it.