Code Monkey home page Code Monkey logo

crnn_seq2seq_ocr.pytorch's Introduction

crnn_seq2seq_ocr.PyTorch

This software implements the Convolutional Recurrent Neural Network (CRNN), a combination of CNN and Sequence to sequence model with attention for image-based sequence recognition tasks, such as scene text recognition and OCR.

This network architecture is implemented from Robust Scene Text Recognition with Automatic Rectification

arch.jpg

The crnn+ctc ocr can be found here bai-shang/crnn_ctc_ocr.Tensorflow

Dependencies

All dependencies should be installed are as follow:

  • Python3.5
  • PyTorch
  • opencv-python
  • numpy
  • Pillow

Required packages can be installed with

pip3 install -r requirements.txt

This software only tested in Python3.5!

Run demo

Asume your current work directory is "crnn_seq2seq_ocr.Pytorch":

#cd crnn_seq2seq_ocr.Pytorch
python3 inference.py --img_path ./data/test_img/20439171_260546633.jpg \
    --encoder model/pretrained/encoder.pth --decoder model/pretrained/decoder.pth

Result is:

20439171_260546633.jpg

predict_string: 于采取的是“激变”的 => predict_probility: 0.860094428062439

Train a new model

path/to/your/image/50843500_2726670787.jpg 情笼罩在他们满是沧桑
path/to/your/image/57724421_3902051606.jpg 心态的松弛决定了比赛
path/to/your/image/52041437_3766953320.jpg 虾的鲜美自是不可待言

You can use the "data/convert_text_list.py" script to create the two lists or finish it by yourself.

cd data
python3 convert_text_list.py SyntheticChineseStringDataset/train.txt > train_list.txt
python3 convert_text_list.py SyntheticChineseStringDataset/test.txt > test_list.txt
  • Start training
#cd crnn_seq2seq_ocr.Pytorch
python3 --train_list train_list.txt --eval_list test_list.txt --model ./model/crnn/ 

Then the training messages are printed to terminal like

Reference

crnn_seq2seq_ocr.pytorch's People

Contributors

bai-shang avatar

Watchers

 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.