This framework relies on the ability of a segmentation algorithm to break the text in to glyphs. Hence it can be extended to other scripts with well seperated images like Malayalam, Oriya, Tamil, Kannada, Thai etc.
- Opens box files generated by antanci_segmenter
- Passes them to a neural network trained by theanet
- n-gram modelling of the language
- Ability to stich broken glyphs (using the language model).
Easiest method is to pull the pre-built image from Docker hub and run in a container. You can do this with the following commands.
docker pull chprasad/banti_telugu_ocr:20160310docker run -it chprasad/banti_telugu_ocr:20160310 /bin/bash
If you do not have Docker on your machine, you can set that up first with instrictions available from Docker documentation.
-
These instructions are tailored to Ubuntu. You should make changes based on your OS.
-
Use python3. You should already have it. Just type
which python3and check. You will also be usingpip3. Python3.4 comes withpip3. Python3.3 and older need additional installation ofpip3. We recommend you upgrade to Python3.4.
- Install system dependencies.
sudo apt-get install python3-dev python3-pip g++ libopenblas-dev git-
Install requirements.
If you are using python 3 virtual environment, run
pip install -r requirements.txtIf you want to install them system wide, run
sudo pip3 install -r requirements.txt- Clone this repo. (banti_telugu_ocr)
git clone git@github.com:TeluguOCR/banti_telugu_ocr.git
cd banti_telugu_ocr- Set the following theano flag(s). (I just put the following in my .bashrc file.)
export THEANO_FLAGS='floatX=float32'- Run the ocr program as
python3 recognize.py sample_images/praasa.tifYou will find the output in sample_images/praasa.ml.txt, praasa.nogram.txt, praasa.gram.txt. Pick the one that works best for you.
You can also use other image formats as
python3 recognize.py <path_to_your_image>.[jpg|png|...]To see full options and get help run
python3 recognize.py -hThis program can also perform OCR on a box file generated by antanci_ocr system.
python3 recognize.py sample_images/praasa.box