Add VLM-based Handwritten Text Recognition Pipeline (GSoC 2026 - Aniket Junghare) - #140
Open
junghare-aniket wants to merge 21 commits into
Open
Add VLM-based Handwritten Text Recognition Pipeline (GSoC 2026 - Aniket Junghare)#140junghare-aniket wants to merge 21 commits into
junghare-aniket wants to merge 21 commits into
Conversation
Implement fine-tuning for Qwen2.5-VL model for handwriting OCR. Includes dataset preparation, model loading, and training logic.
Implement Gradio app for transcribing Old Spanish handwritten documents using a LoRA fine-tuned model. Includes document analysis, line segmentation, and transcription visualization.
Added comprehensive README for the handwritten text recognition project, detailing project goals, approach, evaluation metrics, and usage instructions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a VLM-centric end-to-end Handwritten Text Recognition (HTR) pipeline for early modern Spanish manuscripts, developed as part of GSoC 2026.
Unlike a traditional OCR-first approach, this pipeline places a Vision-Language Model (Qwen2.5-VL-7B-Instruct, LoRA fine-tuned) at the center of every processing stage: document analysis, literal reading, and correction, rather than using a VLM only as a late-stage corrector. A fine-tuned TrOCR model (developed during GSoC 2025) is used as an optional supplementary line-level OCR stage.
What's included
finetune.py— LoRA fine-tuning script for Qwen2.5-VL-7B-Instructinference.py— full 4-stage inference pipeline (VLM + optional TrOCR)evaluate.py— CER/WER evaluation scriptapp/— Gradio web app (same code deployed live on Hugging Face Spaces)scripts/— SLURM job scripts for fine-tuning, inference, and evaluationResults
Evaluated on the Rodrigo, Orinoco, and Tridis datasets. Full CER/WER tables and analysis are in the folder's README.
Try it live