• Stars
    star
    347
  • Rank 122,141 (Top 3 %)
  • Language
    Python
  • Created almost 6 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

This repository implements the the encoder and decoder model with attention model for OCR

attention-ocr.pytorch:Encoder+Decoder+attention model

This repository implements the the encoder and decoder model with attention model for OCR, the encoder uses CNN+Bi-LSTM, the decoder uses GRU. This repository is modified from https://github.com/meijieru/crnn.pytorch
Earlier I had an open source version, but had some problems identifying images of fixed width. Recently I modified the model to support image recognition with variable width. The function is the same as CRNN. Due to the time problem, there is no pre-training model this time, which will be updated later.

requirements

pytorch 0.4.1
opencv_python

cd Attention_ocr.pytorch
pip install -r requirements.txt

Test

pretrained model coming soon

Train

  1. Here i choose a small dataset from Synthetic_Chinese_String_Dataset, about 270000+ images for training, 20000 images for testing. download the image data from Baidu
  2. the train_list.txt and test_list.txt are created as the follow form:
# path/to/image_name.jpg label
path/AttentionData/50843500_2726670787.jpg 情笼罩在他们满是沧桑
path/AttentionData/57724421_3902051606.jpg 心态的松弛决定了比赛
path/AttentionData/52041437_3766953320.jpg 虾的鲜美自是不可待言
  1. change the trainlist and vallist parameter in train.py, and start train
cd Attention_ocr.pytorch
python train.py --trainlist ./data/ch_train.txt --vallist ./data/ch_test.txt

then you can see in the terminel as follow: attentionocr there uses the decoderV2 model for decoder.

The previous version

git checkout AttentionOcrV1

Reference

  1. crnn.pytorch
  2. Attention-OCR
  3. Seq2Seq-PyTorch
  4. caffe_ocr

TO DO

  • change LSTM to Conv1D, it can greatly accelerate the inference
  • change the cnn bone model with inception net, densenet
  • realize the decoder with transformer model

More Repositories

1

CenterFace.pytorch

unofficial version of centerface, which achieves the best balance between speed and accuracy at face detection
Python
229
star
2

SRN.pytorch

Unofficial PyTorch implementation of Towards Accurate Scene Text Recognition with Semantic Reasoning Networks
Python
184
star
3

Bert_OCR.pytorch

Unofficial PyTorch implementation of 2D Attentional Irregular Scene Text Recognizer
Python
130
star
4

DDRNet.pytorch

This is the unofficial code of Deep Dual-resolution Networks for Real-time and Accurate Semantic Segmentation of Road Scenes. which achieve state-of-the-art trade-off between accuracy and speed on cityscapes and camvid, without using inference acceleration and extra data
Python
124
star
5

CLPR.pytorch

End to End Chinese License Plate Recognition
Python
75
star
6

FOTS.pytorch

an unofficial implementation of FOTS: Fast Oriented Text Spotting with a Unified Network
C++
67
star
7

facemask

口罩检测。凑个热闹,和百度类似的是否佩戴口罩检测分类,但是速度会更快。
Python
26
star
8

ocr_annotation

using python and flask for ocr annotation web tool
Python
23
star
9

Self_cross_entropy

Write a cross_entropy function in pytorch to remove the abnormal nan value
Python
9
star
10

Flask_UI_Pytorch

create a sample UI for deep learning by using flask
HTML
7
star
11

GIOU_EAST

use giou loss function for east
Python
6
star
12

tensorrt.test

test tensorrt c++/python api, c++/python plugins.
C++
5
star
13

dler.collection

a collection of studing
C++
4
star
14

transformerOcr

use transformer as the decoder model for OCR
1
star
15

flask_api

Flask deep learning API demo
Python
1
star
16

AI.hisi

AI在hisi开发板上的部署,评测,对比
C
1
star
17

tensorrt.collection

some example and benchmark for using tensorrt
C++
1
star