{"id":13655866,"url":"https://github.com/bgshih/crnn","last_synced_at":"2025-05-15T20:01:16.691Z","repository":{"id":53884624,"uuid":"48272416","full_name":"bgshih/crnn","owner":"bgshih","description":"Convolutional Recurrent Neural Network (CRNN) for image-based sequence recognition.","archived":false,"fork":false,"pushed_at":"2019-03-04T05:12:37.000Z","size":75,"stargazers_count":2076,"open_issues_count":91,"forks_count":550,"subscribers_count":78,"default_branch":"master","last_synced_at":"2025-04-08T01:37:42.310Z","etag":null,"topics":["computer-vision","machine-learning","ocr","sequence-recognition","torch7"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/bgshih.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-19T07:14:57.000Z","updated_at":"2025-03-23T14:50:07.000Z","dependencies_parsed_at":"2022-08-30T22:50:27.361Z","dependency_job_id":null,"html_url":"https://github.com/bgshih/crnn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgshih%2Fcrnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgshih%2Fcrnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgshih%2Fcrnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgshih%2Fcrnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgshih","download_url":"https://codeload.github.com/bgshih/crnn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414457,"owners_count":22067263,"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":["computer-vision","machine-learning","ocr","sequence-recognition","torch7"],"created_at":"2024-08-02T04:00:39.079Z","updated_at":"2025-05-15T20:01:15.912Z","avatar_url":"https://github.com/bgshih.png","language":"Lua","funding_links":[],"categories":["Librarys","Lua","Model Deployment library","Text image recognition"],"sub_categories":["PyTorch \u003ca name=\"pytorch\"/\u003e","2015"],"readme":"Convolutional Recurrent Neural Network\n======================================\n\nThis software implements the Convolutional Recurrent Neural Network (CRNN), a combination of CNN, RNN and CTC loss for image-based sequence recognition tasks, such as scene text recognition and OCR. For details, please refer to our paper http://arxiv.org/abs/1507.05717.\n\n**UPDATE Mar 14, 2017** A Docker file has been added to the project. Thanks to [@varun-suresh](https://github.com/varun-suresh).\n\n**UPDATE May 1, 2017** A PyTorch [port](https://github.com/meijieru/crnn.pytorch) has been made by [@meijieru](https://github.com/meijieru).\n\n**UPDATE Jun 19, 2017** For an end-to-end text detector+recognizer, check out the [CTPN+CRNN implementation](https://github.com/AKSHAYUBHAT/DeepVideoAnalytics/tree/master/notebooks/OCR) by [@AKSHAYUBHAT](https://github.com/AKSHAYUBHAT).\n\nBuild\n-----\n\nThe software has only been tested on Ubuntu 14.04 (x64). CUDA-enabled GPUs are required. To build the project, first install the latest versions of [Torch7](http://torch.ch), [fblualib](https://github.com/facebook/fblualib) and LMDB. Please follow their installation instructions respectively. On Ubuntu, lmdb can be installed by ``apt-get install liblmdb-dev``.\n\nTo build the project, go to ``src/`` and execute ``sh build_cpp.sh`` to build the C++ code. If successful, a file named ``libcrnn.so`` should be produced in the ``src/`` directory.\n\n\nRun demo\n--------\n\nA demo program can be found in ``src/demo.lua``. Before running the demo, download a pretrained model from [here](https://www.dropbox.com/s/tx6cnzkpg99iryi/crnn_demo_model.t7?dl=0). Put the downloaded model file ``crnn_demo_model.t7`` into directory ``model/crnn_demo/``. Then launch the demo by:\n\n    th demo.lua\n\nThe demo reads an example image and recognizes its text content.\n\nExample image:\n![Example Image](./data/demo.png)\n\nExpected output:\n\n    Loading model...\n    Model loaded from ../model/crnn_demo/model.t7\n    Recognized text: available (raw: a-----v--a-i-l-a-bb-l-e---)\n    \nAnother example:\n![Example Image2](./data/demo2.jpg)\n\n    Recognized text: shakeshack (raw: ss-h-a--k-e-ssh--aa-c--k--)\n\n\nUse pretrained model\n--------------------\n\nThe pretrained model can be used for lexicon-free and lexicon-based recognition tasks. Refer to the functions ``recognizeImageLexiconFree`` and ``recognizeImageWithLexicion`` in file ``utilities.lua`` for details.\n\n\nTrain a new model\n-----------------\n\nFollow the following steps to train a new model on your own dataset.\n\n  1. Create a new LMDB dataset. A python program is provided in ``tool/create_dataset.py``. Refer to the function ``createDataset`` for details (need to ``pip install lmdb`` first).\n  2. Create model directory under ``model/``. For example, ``model/foo_model``. Then create\n   configuraton file ``config.lua`` under the model directory. You can copy ``model/crnn_demo/config.lua`` and do modifications.\n  3. Go to ``src/`` and execute ``th main_train.lua ../models/foo_model/``. Model snapshots and logging file will be saved into the model directory.\n\n\nBuild using docker\n------------------\n\n  1. Install docker. Follow the instructions [here](https://docs.docker.com/engine/installation/)\n  2. Install nvidia-docker - Follow the instructions [here](https://github.com/NVIDIA/nvidia-docker)\n  3. Clone this repo, from this directory run `docker build -t crnn_docker .`\n  4. Once the image is built, the docker can be run using `nvidia-docker run -it crnn_docker`.\n  \nCitation\n--------\n\nPlease cite the following paper if you are using the code/model in your research paper.\n\n    @article{ShiBY17,\n      author    = {Baoguang Shi and\n                   Xiang Bai and\n                   Cong Yao},\n      title     = {An End-to-End Trainable Neural Network for Image-Based Sequence Recognition\n                   and Its Application to Scene Text Recognition},\n      journal   = {{IEEE} Trans. Pattern Anal. Mach. Intell.},\n      volume    = {39},\n      number    = {11},\n      pages     = {2298--2304},\n      year      = {2017}\n    }\n\n\nAcknowledgements\n----------------\n\nThe authors would like to thank the developers of Torch7, TH++, [lmdb-lua-ffi](https://github.com/calind/lmdb-lua-ffi) and [char-rnn](https://github.com/karpathy/char-rnn).\n\nPlease let me know if you encounter any issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgshih%2Fcrnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgshih%2Fcrnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgshih%2Fcrnn/lists"}