Code Monkey home page Code Monkey logo

htr's Introduction

HandwritingRecognition (MultiDimensional RecurrentNeuralNetworks)

Recognize handwritten text in scanned documents using MultiDimensional Recurrent Neural Networks

Creates a network based on MultiDimensional RNNs architecture using python and cython with Connectionist Temporal Classification (CTC) cost function.

Features

  • Creates Multidimensional LSTM network.
  • No need to extract features before feeding it to RNN or LSTM framework.
  • The current configuration takes 2D input but can be extended to N-dimensional input.
  • Uses forward backward algorithm with CTC loss function. This is taken from Andrew Mass stanford-ctc.
  • Runs on Multi-Cores.
  • Uses cython for fast execution.

Installation

  • Installing Cython
  • Installing dill. dill extends python’s pickle module for serializing and de-serializing python objects.

Data Preparation

Downloading IAM dataset for handwriting recognition from IAM. To create data splits for training, validation and testing

python create_data.py path_to_xml_files path_to_words train_samples val_samples 

path_to_xml_files: folder where xml files are stored, path_to_words: folder where images of handwritten words are stored, train_samples: no of training samples, val_samples: no of validation samples.

The IAM dataset contains 115149 images of words, so the following command will create 80k training_data 15k validation_data and 20k testing_data.

python create_data.py /home/xml_files/ /home/data/words/ 80000 15000

Training

First create .so file, which will be used for calling cython functions.

python setup_cython_3.py build_ext --inplace

For training, run the following command

python train.py learning_rate momentum regularization update batch_size epochs

For example,

 python train.py --learning_rate=0.001 --momentum=0.9 --reg=0.0 --update=rmsprop --batch_size=200 --epochs=50

Intial weights are initialized using xavier initialization. After every epoch parameters are saved using cPickle as model_parameters.

Testing

Run the following command

python test.py

Code courtesy: https://github.com/suhaspillai

htr's People

Contributors

nishant-neo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.