Downloads · 30 days
51
2% of all-time downloads
Daniil-Domino/trocr-base-ru-dialectic-stackmix
trocr-base-ru-dialectic-stackmix is a image-to-text model from Daniil-Domino. 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.
The TrOCR-base-ru model was fine-tuned on synthetic datasets generated using StackMix method and based on various fonts.
Downloads · 30 days
51
2% of all-time downloads
All-time downloads
2.4K
Public
Parameters
334M
1.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.3 GB · 100%
From the Hugging Face model README
The TrOCR-base-ru model was fine-tuned on synthetic datasets generated using StackMix method and based on various fonts.
For more information, check out the GitHub repository.
TrOCR-base-ru was fine-tuned for Handwritten Russian Text Recognition in dialectological cards. The model was trained for a total of 20 epochs with a batch size of 16 using dual NVIDIA T4 GPUs. The fine-tuning process took approximately 28 hours.
# Load libraries
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
import matplotlib.pyplot as plt
from PIL import Image
# Load image
img_path = 'path/to/image'
image = Image.open(img_path).convert("RGB")
# Load model and processor
model_name = "Daniil-Domino/trocr-base-ru-dialectic-stackmix"
processor = TrOCRProcessor.from_pretrained(model_name)
model = VisionEncoderDecoderModel.from_pretrained(model_name)
# Preprocess and run inference
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
# Output result
print(generated_text)
# Display input image
plt.axis("off")
plt.imshow(image)
plt.show()
Below are the key evaluation metrics on the validation set: