Downloads · 30 days
35
6% of all-time downloads
shubham879/trocr-prescription
trocr-prescription is a image-to-text model from shubham879. Use it when you need a caption or text from an image. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of microsoft/trocr-base-handwritten for handwritten medical prescription text recognition.
Downloads · 30 days
35
6% of all-time downloads
All-time downloads
621
Public
Parameters
334M
1.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.3 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of microsoft/trocr-base-handwritten for handwritten medical prescription text recognition.
It is designed to extract handwritten prescription text from medical images using transformer-based OCR.
This model is intended for:
Can be integrated into:
Not recommended for:
Use cropped line-level prescription images for best performance.
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
processor = TrOCRProcessor.from_pretrained("shubham879/trocr-prescription")
model = VisionEncoderDecoderModel.from_pretrained("shubham879/trocr-prescription")
image = Image.open("sample.png").convert("RGB")
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(text)
The model was fine-tuned using the Doctor’s Handwritten Prescription BD dataset, which contains handwritten medical prescription images.
The model performs well on handwritten prescription text at line level with low character-level error.