sair390/tamil-ocr-qwen25vl
017
Tamil OCR — Qwen2.5-VL-3B Merged Model
Qwen2.5-VL-3B-Instruct fine-tuned and merged for Tamil OCR. LoRA adapter (pre-merge): sair390/tamil-ocr-qwen25vl-lora
Model Details
Training Hyperparameters
Training Data
Synthetic data augmentations: blur, noise, rotation, brightness/contrast, JPEG artifacts, erosion, shadow overlays Real data: ~150 Tamil books, ~75K pages Fonts: NotoSerifTamil, NotoSansTamil, MuktaMalar, HindMadurai, Catamaran Text sources: Tirukkural, Wikipedia sentences, digitized book corpus Text layouts: 75% single-line, 25% multi-line Font sizes: 24–72pt (single-line), 24–48pt (multi-line)
Usage
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from PIL import Image
import torch
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"sair390/tamil-ocr-qwen25vl",
torch_dtype=torch.bfloat16,
device_map="auto",
)
processor = AutoProcessor.from_pretrained("sair390/tamil-ocr-qwen25vl")
image = Image.open("tamil_page.jpg")
messages = [{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Read the Tamil text in this image."},
],
}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[image], return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=512,
temperature=0, # deterministic — best for OCR
do_sample=False,
)
result = processor.decode(output[0], skip_special_tokens=True)
print(result)4-Stage Inference Pipeline
- Preprocessing — deskew + adaptive threshold binarization
- Layout analysis — contour detection, bounding box merge, top-to-bottom sort
- OCR — Qwen2.5-VL inference
- Post-correction — Tamil vowel sign fixes, Unicode filter, common OCR confusions
Inference Requirements
Dependencies: transformers, torch, Pillow, qwen-vl-utils
Limitations
- Optimized for printed Tamil text; handwritten text not tested
- Performance on degraded/low-resolution scans may vary
- Early checkpoint; full training run in progress
- Not evaluated on non-Tamil scripts
