All Projects → rakeshvar → Rnn_ctc

rakeshvar / Rnn_ctc

Licence: apache-2.0
Recurrent Neural Network and Long Short Term Memory (LSTM) with Connectionist Temporal Classification implemented in Theano. Includes a Toy training example.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Rnn ctc

Pytorch Kaldi
pytorch-kaldi is a project for developing state-of-the-art DNN/RNN hybrid speech recognition systems. The DNN part is managed by pytorch, while feature extraction, label computation, and decoding are performed with the kaldi toolkit.
Stars: ✭ 2,097 (+853.18%)
Mutual labels:  lstm, speech-recognition, rnn, recurrent-neural-networks, gru
Patter
speech-to-text in pytorch
Stars: ✭ 71 (-67.73%)
Mutual labels:  speech-recognition, rnn, speech-to-text, ocr
sequence-rnn-py
Sequence analyzing using Recurrent Neural Networks (RNN) based on Keras
Stars: ✭ 28 (-87.27%)
Mutual labels:  theano, recurrent-neural-networks, lstm, rnn
theano-recurrence
Recurrent Neural Networks (RNN, GRU, LSTM) and their Bidirectional versions (BiRNN, BiGRU, BiLSTM) for word & character level language modelling in Theano
Stars: ✭ 40 (-81.82%)
Mutual labels:  theano, lstm, gru, rnn
Lstm Ctc Ocr
using rnn (lstm or gru) and ctc to convert line image into text, based on torch7 and warp-ctc
Stars: ✭ 70 (-68.18%)
Mutual labels:  lstm, recurrent-neural-networks, ctc, ocr
Theano Kaldi Rnn
THEANO-KALDI-RNNs is a project implementing various Recurrent Neural Networks (RNNs) for RNN-HMM speech recognition. The Theano Code is coupled with the Kaldi decoder.
Stars: ✭ 31 (-85.91%)
Mutual labels:  rnn, recurrent-neural-networks, gru, theano
Ai Reading Materials
Some of the ML and DL related reading materials, research papers that I've read
Stars: ✭ 79 (-64.09%)
Mutual labels:  lstm, recurrent-neural-networks, ocr
Pytorch Pos Tagging
A tutorial on how to implement models for part-of-speech tagging using PyTorch and TorchText.
Stars: ✭ 96 (-56.36%)
Mutual labels:  lstm, rnn, recurrent-neural-networks
See Rnn
RNN and general weights, gradients, & activations visualization in Keras & TensorFlow
Stars: ✭ 102 (-53.64%)
Mutual labels:  lstm, rnn, gru
Linear Attention Recurrent Neural Network
A recurrent attention module consisting of an LSTM cell which can query its own past cell states by the means of windowed multi-head attention. The formulas are derived from the BN-LSTM and the Transformer Network. The LARNN cell with attention can be easily used inside a loop on the cell state, just like any other RNN. (LARNN)
Stars: ✭ 119 (-45.91%)
Mutual labels:  lstm, rnn, recurrent-neural-networks
Caffe ocr
主流ocr算法研究实验性的项目,目前实现了CNN+BLSTM+CTC架构
Stars: ✭ 1,156 (+425.45%)
Mutual labels:  lstm, ctc, ocr
Pytorch Rnn Text Classification
Word Embedding + LSTM + FC
Stars: ✭ 112 (-49.09%)
Mutual labels:  lstm, rnn, gru
Tensorflow Ctc Speech Recognition
Application of Connectionist Temporal Classification (CTC) for Speech Recognition (Tensorflow 1.0 but compatible with 2.0).
Stars: ✭ 127 (-42.27%)
Mutual labels:  speech-recognition, speech-to-text, ctc
Gru Svm
[ICMLC 2018] A Neural Network Architecture Combining Gated Recurrent Unit (GRU) and Support Vector Machine (SVM) for Intrusion Detection
Stars: ✭ 76 (-65.45%)
Mutual labels:  rnn, recurrent-neural-networks, gru
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-55.91%)
Mutual labels:  lstm, rnn, recurrent-neural-networks
Rnn Text Classification Tf
Tensorflow Implementation of Recurrent Neural Network (Vanilla, LSTM, GRU) for Text Classification
Stars: ✭ 114 (-48.18%)
Mutual labels:  lstm, recurrent-neural-networks, gru
Hey Jetson
Deep Learning based Automatic Speech Recognition with attention for the Nvidia Jetson.
Stars: ✭ 161 (-26.82%)
Mutual labels:  speech-recognition, recurrent-neural-networks, speech-to-text
Load forecasting
Load forcasting on Delhi area electric power load using ARIMA, RNN, LSTM and GRU models
Stars: ✭ 160 (-27.27%)
Mutual labels:  lstm, rnn, gru
Icdar 2019 Sroie
ICDAR 2019 Robust Reading Challenge on Scanned Receipts OCR and Information Extraction
Stars: ✭ 202 (-8.18%)
Mutual labels:  lstm, ctc, ocr
Gdax Orderbook Ml
Application of machine learning to the Coinbase (GDAX) orderbook
Stars: ✭ 60 (-72.73%)
Mutual labels:  lstm, recurrent-neural-networks, gru

RNN CTC

Recurrent Neural Network with Connectionist Temporal Classifical implemented in Theano. Includes toy training examples.

Use

The goal of this problem is to train a Neural Network (with recurrent connections) to learn to read sequences. As a part of the training we show it a series of such sequences (tablets of text in our examples) and also tell it what the tablet contains (the labels of the written characters).

Methodology

We need to keep feeding our RNN the samples of text in two forms (written and labelled). If you have your own written samples you can train our system the offline way. If you have a scribe that can generate samples as you go, you can train one sample at a time, the online way.

Specifying parameters

You will need to specify a lot of parameters. Here is a overview. The file configs/default.ast has all the parameters specified (as a python dictionary), so compare that with these instructions.

  • Data Generation (cf. configs/alphabets.ast)

    • Scribe (The class that generates the samples)
      • alphabet: 'ascii_alphabet' (0-9a-zA-Z etc.) or 'hindu_alphabet' (0-9 hindu numerals)
      • noise: Amount of noise in the image
      • vbuffer, hbuffer: horizontal and vertical buffers
      • avg_seq_len: Average length of the tablet
      • varying_len: (bool) Make the length random
      • nchars_per_sample: This will make each tablet have the same number of characters. This over-rides avg_seq_len.
    • num_samples
  • Training (cf. configs/default.ast)

    • num_epochs
      • Offline case: Goes over the same data num_epochs times.
      • Online case: Each epoch has different data, resulting in generating a total of num_epochs * num_samples unique data samples!
    • train_on_fraction
      • Offline case: Fraction of samples that are used as training data
  • Neural Network (cf. configs/midlayer.ast and configs/optimizers.ast)

    • use_log_space: Perform calculations via the logarithms of probabilities.
    • mid_layer: The middle layer to be used. See the nnet/layers module for all the options you have.
    • mid_layer_args: The arguments needed for the middle layer. Depends on the mid_layer. See the constructor of the corresponding mid_layer class.
    • optimizer: The optimization algorithm to be used. sgd, adagrad, rmsprop, adadelta etc.
    • optimzier_args: The arguments that the optimizer needs. See the corresponding function in the file nnet/updates.py. Note: This should not contain the learning rate.
    • learning_rate_args:
      • initial_rate: Initial learning rate.
      • anneal:
        • constant: Learning rate will be kept constant
        • inverse: Will decay as the inverse of the epoch.
        • inverse_sqrt: Will decay as the inverse of the square root of the epoch.
      • epochs_to_half: Rate at which the learning_rate is annealed. Higher number means slower rate.

Usage

Offline Training

For this you need to generate data first and then train it using train_offline.py.

Generate Data

You can use hindu numerals or the entire ascii set, specified via an ast file.

python3 gen_data.py <output_name.pkl> [config=configs/default.ast]*
Train Network

You can train on the generated pickle file as:

python3 train_offline.py data.pkl [config=configs/default.ast]*

Online Training

You can generate and train simultaneously as:

python3 train_online.py [config=configs/default.ast]*

Examples

All the programs mentioned above can take multiple config files, later files override former ones. configs/default.ast is loaded by default.

Offline

# First generate the ast files based on given examples then...
python3 gen_data.py hindu_avg_len_60.py configs/hindu.ast configs/len_60.ast
python3 train_offline.py hindu_3chars.py configs/adagrad.ast configs/bilstm.ast configs/ilr.01.ast

Online

python3 train_online.py configs/hindu.ast configs/adagrad.ast configs/bilstm.ast configs/ilr.01.ast

Working Example

# Offline
python3 gen_data.py hindu3.py configs/working_eg.ast
python3 train_offline.py hindu3.py configs/working_eg.ast
# Online
python3 train_online.py configs/working_eg.ast

#Offline

Sample Output

# Using data from scribe.py hindu
Shown : 0 2 2 5 
Seen  : 0 2 2 5 
Images (Shown & Seen) : 

 0¦                            ¦
 1¦          ██  ██            ¦
 2¦         █  ██  ████        ¦
 3¦           █   █ █          ¦
 4¦      ██  █   █  ███        ¦
 5¦     █  █████████  █        ¦
 6¦     █  █        █ █        ¦
 7¦      ██         ███        ¦
 
 0¦░░░░░░░░░█░░░░░░░░░░░░░░░░░░¦
 1¦░░░░░░░░░░░░░░░░░░░░░░░░░░░░¦
 2¦░░░░░░░░░░░░░█░░░█░░░░░░░░░░¦
 3¦░░░░░░░░░░░░░░░░░░░░░░░░░░░░¦
 4¦░░░░░░░░░░░░░░░░░░░░░░░░░░░░¦
 5¦░░░░░░░░░░░░░░░░░░░█▓░░░░░░░¦
 6¦█████████░███░███░█░▒███████¦

References

  • Graves, Alex. Supervised Sequence Labelling with Recurrent Neural Networks. Chapters 2, 3, 7 and 9.
  • Available at Springer
  • University Edition via. Springer Link.
  • Free Preprint

Credits

Dependencies

  • Numpy
  • Theano

Can easily port to python2 by adding lines like these where necessary. In the interest of the future generations, we highly recommend you do not do that.

from __future__ import print_function
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].