Edit model card

anuashok/ocr-captcha-1

This model is a fine-tuned version of microsoft/trocr-base-printed on your custom dataset.

image/png

Training Summary

  • CER: 0.0496031746031746
  • Hyperparameters:
    • Learning Rate: 3.4123022229050474e-05
    • Batch Size: 8
    • Num Epochs: 6
    • Warmup Ratio: 0.057604550826554274
    • Weight Decay: 0.0716137163865213
    • Num Beams: 5
    • Length Penalty: 0.8270021759785869

Usage

from transformers import VisionEncoderDecoderModel, TrOCRProcessor
import torch
from PIL import Image

# Load model and processor
processor = TrOCRProcessor.from_pretrained("anuashok/ocr-captcha-1")
model = VisionEncoderDecoderModel.from_pretrained("anuashok/ocr-captcha-1")

# Load image
image = Image.open('path_to_your_image.jpg').convert("RGB")

# Prepare image
pixel_values = processor(image, return_tensors="pt").pixel_values

# Generate text
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_text)
Downloads last month
19
Safetensors
Model size
334M params
Tensor type
F32
·
Inference API
Unable to determine this model's library. Check the docs .

Model tree for anuashok/ocr-captcha-v1

Finetuned
(8)
this model