TrOCR is an OCR (Optical Character Recognition) model proposed by Minghao Li et al. in their paper titled TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models. This model is composed of an image Transformer encoder and an autoregressive text Transformer decoder, enabling it to accurately perform OCR.
In this repository, you will find TrOCR, an OCR model specifically developed for recognizing handwritten Indian documents in various languages including Hindi, Tamil, Malayalam, Bengali, and more. The TrOCR model has been designed to accurately detect and convert text in these languages from images of handwritten documents, making it a valuable tool for various applications such as digitizing old documents, extracting information from scanned documents, and more.
git clone https://github.com/iitb-research-code/indic-trocr.git
cd indic-trocr
virtualenv trocr_env
source trocr_env/bin/activate
pip install requirements.txt
- Download the Word level Handwritten dataset for that language from the IIIT-HW Datasets. This folder contains the train, test and val word-level images and their corresponding text labels in train.txt, test.txt and val.txt files.
- Change the train, test, val text file and root directory paths in
train.py. - We need a language specific RoBERTa decoder model for training TrOCR. Find a RoBERTa model for that language on Hugging Face.
- Copy the model name from Hugging Face and change the
decodevariable online 80intrain.py. - Change the
training_argsonline 113intrain.pyif required. - The model is ready for training. Run the following command:
python train.py