{"id":21622584,"url":"https://github.com/jpuigcerver/laia","last_synced_at":"2025-04-11T11:12:24.040Z","repository":{"id":63889329,"uuid":"53951527","full_name":"jpuigcerver/Laia","owner":"jpuigcerver","description":"Laia: A deep learning toolkit for HTR based on Torch","archived":false,"fork":false,"pushed_at":"2019-06-25T16:16:01.000Z","size":1884,"stargazers_count":149,"open_issues_count":8,"forks_count":55,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-25T07:36:12.573Z","etag":null,"topics":["deep-learning","htr","torch"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpuigcerver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-15T14:32:19.000Z","updated_at":"2025-02-06T09:03:38.000Z","dependencies_parsed_at":"2023-01-14T12:00:56.195Z","dependency_job_id":null,"html_url":"https://github.com/jpuigcerver/Laia","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpuigcerver%2FLaia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpuigcerver%2FLaia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpuigcerver%2FLaia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpuigcerver%2FLaia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpuigcerver","download_url":"https://codeload.github.com/jpuigcerver/Laia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248381791,"owners_count":21094528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","htr","torch"],"created_at":"2024-11-25T00:09:13.768Z","updated_at":"2025-04-11T11:12:23.977Z","avatar_url":"https://github.com/jpuigcerver.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laia: A deep learning toolkit for HTR\n\n[![Build Status](https://travis-ci.com/jpuigcerver/Laia.svg?token=HF64eTvPxEUcjjUPXpgm\u0026branch=master)](https://travis-ci.com/jpuigcerver/Laia)\n\nLaia is a deep learning toolkit to transcribe handwritten text images.\n\nIf you find this toolkit useful in your research, please cite:\n\n```\n@misc{laia2016,\n  author = {Joan Puigcerver and\n            Daniel Martin-Albo and\n            Mauricio Villegas},\n  title = {Laia: A deep learning toolkit for HTR},\n  year = {2016},\n  publisher = {GitHub},\n  note = {GitHub repository},\n  howpublished = {\\url{https://github.com/jpuigcerver/Laia}},\n}\n```\n\n## Installation\n\nLaia is implemented in [Torch](http://torch.ch/), and depends on the following:\n\n- [CUDA \u003e=7.5](https://developer.nvidia.com/cuda-downloads)\n- [cuDNN \u003e= 5.1](https://developer.nvidia.com/cudnn)\n\nNote 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](https://developer.nvidia.com/cudnn).\n\nOnce Torch is installed the following luarocks are required:\n\n- You also have to  install the [cuDNN bindings for Torch](https://github.com/soumith/cudnn.torch)\n- [Baidu's CTC](https://github.com/baidu-research/warp-ctc)\n- [imgdistort](https://github.com/jpuigcerver/imgdistort)\n\nAnd execute `luarocks install https://raw.githubusercontent.com/jpuigcerver/Laia/master/rocks/laia-scm-1.rockspec`.\n\n\n## Installation via docker\n\nTo ease the installation, there is a public [docker image for Laia](https://hub.docker.com/r/mauvilsa/laia/). To use it first install [docker](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce) and [nvidia-docker](https://github.com/NVIDIA/nvidia-docker/releases), and configure docker so that it can be executed without requiring sudo, see [docker linux postinstall](https://docs.docker.com/engine/installation/linux/linux-postinstall/). Then the installation of Laia consists of first pulling the image and tagging it as laia:active.\n\n    docker pull mauvilsa/laia:[SOME_TAG]\n    docker tag mauvilsa/laia:[SOME_TAG] laia:active\n\nReplace SOME_TAG with one of the tags available [here](https://hub.docker.com/r/mauvilsa/laia/tags/). Then copy the command line interface script to some directory in your path for easily use from the host.\n\n    mkdir -p $HOME/bin\n    docker run --rm -u $(id -u):$(id -g) -v $HOME:$HOME laia:active bash -c \"cp /usr/local/bin/laia-docker $HOME/bin\"\n\nAfter this, all Laia commands can be executed by using the laia-docker command. For further details run.\n\n    laia-docker --help\n\n\n## Usage\n\n### Training a Laia model using CTC:\n\nCreate an \"empty\" model using:\n```bash\nlaia-create-model \\\n    \"$CHANNELS\" \"$INPUT_HEIGHT\" \"$((NUM_SYMB+1))\" \"$MODEL_DIR/model.t7\";\n```\nOr if installed via docker:\n```bash\nlaia-docker create-model \\\n    \"$CHANNELS\" \"$INPUT_HEIGHT\" \"$((NUM_SYMB+1))\" \"$MODEL_DIR/model.t7\";\n```\nPositional arguments:\n- `$CHANNELS`: number of channels of the input images.\n- `$INPUT_HEIGHT`: height of the input images. Note: **ALL** image must have the same height.\n- `$((NUM_SYMB+1))`: number of output symbols. Note: Include **ONE** additional element for the CTC blank symbol.\n- `$MODEL_DIR/model.t7`: path to the output model.\n\nFor optional arguments check `laia-create-model -h` or `laia-create-model -H`.\n\nTrain the model using:\n```bash\nlaia-train-ctc \\\n    \"$MODEL_DIR/model.t7\" \\\n    \"$SYMBOLS_TABLE\" \\\n    \"$TRAIN_LST\" \"$TRAIN_GT\" \"$VALID_LST\" \"$VALID_GT\";\n```\nOr if installed via docker:\n```bash\nlaia-docker train-ctc \\\n    \"$MODEL_DIR/model.t7\" \\\n    \"$SYMBOLS_TABLE\" \\\n    \"$TRAIN_LST\" \"$TRAIN_GT\" \"$VALID_LST\" \"$VALID_GT\";\n```\nPositional arguments:\n- `$MODEL_DIR/model.t7` is the path to the input model or checkpoint for training.\n- `$SYMBOLS_TABLE` is the list of training symbols and their id.\n- `$TRAIN_LST` is a file containing a list of images for training.\n- `$TRAIN_GT` is a file containing the list of training transcripts.\n- `$VALID_LST` is a file containing a list of images for validation.\n- `$VALID_GT` is a file containing the list of validation transcripts.\n\nFor optional arguments check `laia-train-ctc -h` or `laia-create-model -H`.\n\n### Transcribing\n\n```bash\nlaia-decode \"$MODEL_DIR/model.t7\" \"$TEST_LST\";\n```\nOr if installed via docker:\n```bash\nlaia-docker decode \"$MODEL_DIR/model.t7\" \"$TEST_LST\";\n```\nPositional arguments:\n- `$MODEL_DIR/model.t7` is the path to the model.\n- `$TEST_LST` is a file containing a list of images for testing.\n\nFor optional arguments check `laia-decode -h`.\n\n### Example\n\nFor a more detailed example, see the Spanish Numbers\n[README.md](egs/spanish-numbers/README.md) in `egs/spanish-numbers` folder, or\nthe IAM [README.md](egs/iam/README.md) in `egs/iam` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpuigcerver%2Flaia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpuigcerver%2Flaia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpuigcerver%2Flaia/lists"}