• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Laia: A deep learning toolkit for HTR based on Torch

Laia: A deep learning toolkit for HTR

Build Status

Laia is a deep learning toolkit to transcribe handwritten text images.

If you find this toolkit useful in your research, please cite:

@misc{laia2016,
  author = {Joan Puigcerver and
            Daniel Martin-Albo and
            Mauricio Villegas},
  title = {Laia: A deep learning toolkit for HTR},
  year = {2016},
  publisher = {GitHub},
  note = {GitHub repository},
  howpublished = {\url{https://github.com/jpuigcerver/Laia}},
}

Installation

Laia is implemented in Torch, and depends on the following:

Note that currently we only support GPU. You need to use NVIDIA's cuDNN library. Register first for the CUDA Developer Program (it's free) and download the library from NVIDIA's website.

Once Torch is installed the following luarocks are required:

And execute luarocks install https://raw.githubusercontent.com/jpuigcerver/Laia/master/rocks/laia-scm-1.rockspec.

Installation via docker

To ease the installation, there is a public docker image for Laia. To use it first install docker and nvidia-docker, and configure docker so that it can be executed without requiring sudo, see docker linux postinstall. Then the installation of Laia consists of first pulling the image and tagging it as laia:active.

docker pull mauvilsa/laia:[SOME_TAG]
docker tag mauvilsa/laia:[SOME_TAG] laia:active

Replace SOME_TAG with one of the tags available here. Then copy the command line interface script to some directory in your path for easily use from the host.

mkdir -p $HOME/bin
docker run --rm -u $(id -u):$(id -g) -v $HOME:$HOME laia:active bash -c "cp /usr/local/bin/laia-docker $HOME/bin"

After this, all Laia commands can be executed by using the laia-docker command. For further details run.

laia-docker --help

Usage

Training a Laia model using CTC:

Create an "empty" model using:

laia-create-model \
    "$CHANNELS" "$INPUT_HEIGHT" "$((NUM_SYMB+1))" "$MODEL_DIR/model.t7";

Or if installed via docker:

laia-docker create-model \
    "$CHANNELS" "$INPUT_HEIGHT" "$((NUM_SYMB+1))" "$MODEL_DIR/model.t7";

Positional arguments:

  • $CHANNELS: number of channels of the input images.
  • $INPUT_HEIGHT: height of the input images. Note: ALL image must have the same height.
  • $((NUM_SYMB+1)): number of output symbols. Note: Include ONE additional element for the CTC blank symbol.
  • $MODEL_DIR/model.t7: path to the output model.

For optional arguments check laia-create-model -h or laia-create-model -H.

Train the model using:

laia-train-ctc \
    "$MODEL_DIR/model.t7" \
    "$SYMBOLS_TABLE" \
    "$TRAIN_LST" "$TRAIN_GT" "$VALID_LST" "$VALID_GT";

Or if installed via docker:

laia-docker train-ctc \
    "$MODEL_DIR/model.t7" \
    "$SYMBOLS_TABLE" \
    "$TRAIN_LST" "$TRAIN_GT" "$VALID_LST" "$VALID_GT";

Positional arguments:

  • $MODEL_DIR/model.t7 is the path to the input model or checkpoint for training.
  • $SYMBOLS_TABLE is the list of training symbols and their id.
  • $TRAIN_LST is a file containing a list of images for training.
  • $TRAIN_GT is a file containing the list of training transcripts.
  • $VALID_LST is a file containing a list of images for validation.
  • $VALID_GT is a file containing the list of validation transcripts.

For optional arguments check laia-train-ctc -h or laia-create-model -H.

Transcribing

laia-decode "$MODEL_DIR/model.t7" "$TEST_LST";

Or if installed via docker:

laia-docker decode "$MODEL_DIR/model.t7" "$TEST_LST";

Positional arguments:

  • $MODEL_DIR/model.t7 is the path to the model.
  • $TEST_LST is a file containing a list of images for testing.

For optional arguments check laia-decode -h.

Example

For a more detailed example, see the Spanish Numbers README.md in egs/spanish-numbers folder, or the IAM README.md in egs/iam folder.

More Repositories

1

PyLaia

A deep learning toolkit specialized for handwritten document analysis
Python
205
star
2

kaldi-decoders

Custom decoders for Kaldi
C++
80
star
3

pytorch-baidu-ctc

PyTorch bindinga for Baidu's Warp-CTC
Shell
59
star
4

openfst-python

Self-contained Python package for OpenFst
Python
50
star
5

rnnlib

A. Grave's RNNLIB made more readable
nesC
39
star
6

rnn2d

CPU and GPU implementations of some 2D RNN layers
C++
28
star
7

xer

Compute useful transcriptions metrics (CER, WER, SER, ...)
Python
26
star
8

jsp-ga

Job Scheduling Problem using Genetic Algorithms
Python
14
star
9

kaldi-lattice-utils

C++
11
star
10

imgdistort

Library distortions on the GPU
C++
9
star
11

fast_pca

Fast & memory efficient Principal Components Analysis
C++
8
star
12

lattice-remove-ctc-blank

Remove output CTC blank symbols from Kaldi lattices
C++
8
star
13

kws-eval

Tools for the evaluation of Keyword Spotting
C++
7
star
14

htk2kaldi

Convert a HMM/GMM model file from HTK to Kaldi format
Python
5
star
15

nnutils

CPU & CUDA implementation of several neural network utils
C++
5
star
16

kaldi-lattice-search

Search stuff in Kaldi lattices (stuff = any language represented by a DFA)
Shell
4
star
17

parallel-htk

Run HTK experiments in parallel
Shell
4
star
18

miarfid-asr-voxeo

Project using Voxeo platform for Automatic Speech Recognition course within the Master in Artificial Intelligence, Pattern Recognition and Digital Imaging.
PHP
3
star
19

kaldi-lattice-word-index

Build word indexes from character lattices
C++
2
star
20

miarfid-asr-multimodal

Multimodal Automatic Speech Recognition, a toy experiment for a Master's course
Shell
2
star
21

miarfid-htr

Handwriting Text Recognition exercises
C++
1
star
22

miarfid-metl-crf

Project using CRF for handwriting recognition
M
1
star
23

lattice-char-to-word

Convert character to word lattices
C++
1
star
24

parallel-kaldi

Set of scripts to run Kaldi experiments in parallel
Shell
1
star
25

mcfs

Multi-criteria Collaborative Filtering System designed for a Recommendation Systems Master's course.
C++
1
star
26

scompressor

Just another simple compressor/decompressor supporting Huffman/LZ77/LZ78/LZW algorithms
C++
1
star
27

jekyll-blog-example

Example of a Jekyll-powered blog
CSS
1
star