/banti_telugu_ocr

End to end OCR system for Telugu. Based on Convolutional Neural Networks.

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

Comprehensive OCR System for Telugu Language

The Banti Framework

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.

Features

  • 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).

Dependencies

  1. Python3
  2. Numpy, Scipy, Nose etc.
  3. Theano
  4. Pillow
  5. Theanet

Installation Instructions

Using Docker Image

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.

  1. docker pull chprasad/banti_telugu_ocr:20160310
  2. docker 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.

Manual Installation

  1. These instructions are tailored to Ubuntu. You should make changes based on your OS.

  2. Use python3. You should already have it. Just type which python3 and check. You will also be using pip3. Python3.4 comes with pip3. Python3.3 and older need additional installation of pip3. We recommend you upgrade to Python3.4.

Dependencies

  1. Install system dependencies.
sudo apt-get install python3-dev python3-pip g++ libopenblas-dev git
  1. Install requirements.

    If you are using python 3 virtual environment, run

pip install -r requirements.txt

If you want to install them system wide, run

sudo pip3 install -r requirements.txt

Usage

  1. Clone this repo. (banti_telugu_ocr)
git clone git@github.com:TeluguOCR/banti_telugu_ocr.git
cd banti_telugu_ocr
  1. Set the following theano flag(s). (I just put the following in my .bashrc file.)
export THEANO_FLAGS='floatX=float32'
  1. Run the ocr program as
python3 recognize.py sample_images/praasa.tif

You 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 -h

This program can also perform OCR on a box file generated by antanci_ocr system.

python3 recognize.py sample_images/praasa.box