TrOCR-norhand-v3 / README.md
MarieRoald's picture
Update README.md
d22eebb verified
|
raw
history blame
1.9 kB
metadata
library_name: transformers
license: cc-by-4.0
language:
  - 'no'
  - nb
  - nn
base_model:
  - microsoft/trocr-base-handwritten

Model Card for Sprakbanken/TrOCR-norhand-v3

This is a TrOCR-model for OCR (optical character recognition) of handwritten historic documents written in Norwegian.
It can be used to recognize text in images of handwritten text.

How to Get Started with the Model

Use the code below to get started with the model.

from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image

processor = TrOCRProcessor.from_pretrained("Sprakbanken/TrOCR-norhand-v3")
model = VisionEncoderDecoderModel.from_pretrained("Sprakbanken/TrOCR-norhand-v3")

image = Image.open("path_to_image.jpg").convert("RGB")

pixel_values = processor(image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)

generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]

Model Details

This model is microsoft/trocr-base-handwritten fine-tuned on the Huggingface version of the NorHand v3 dataset.

Model Description

Uses

You can use the raw model for handwritten text recognition (HTR) on single text-line images in Norwegian.

Out-of-Scope Use

The model only works with images of lines of text. If you have images of entire pages of text, you must segment the text into lines first to benefit from this model.