All Projects → Holmeyoung → Crnn Pytorch

Holmeyoung / Crnn Pytorch

Licence: mit
Pytorch implementation of CRNN (CNN + RNN + CTCLoss) for all language OCR.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Crnn Pytorch

Basicocr
BasicOCR是一个致力于解决自然场景文字识别算法研究的项目。该项目由长城数字大数据应用技术研究院佟派AI团队发起和维护。
Stars: ✭ 336 (+35.48%)
Mutual labels:  cnn, rnn, ocr
Awesome Speech Recognition Speech Synthesis Papers
Automatic Speech Recognition (ASR), Speaker Verification, Speech Synthesis, Text-to-Speech (TTS), Language Modelling, Singing Voice Synthesis (SVS), Voice Conversion (VC)
Stars: ✭ 2,085 (+740.73%)
Mutual labels:  cnn, rnn
Caption generator
A modular library built on top of Keras and TensorFlow to generate a caption in natural language for any input image.
Stars: ✭ 243 (-2.02%)
Mutual labels:  cnn, rnn
Tensorflow Tutorials
텐서플로우를 기초부터 응용까지 단계별로 연습할 수 있는 소스 코드를 제공합니다
Stars: ✭ 2,096 (+745.16%)
Mutual labels:  cnn, rnn
Lightnet
Efficient, transparent deep learning in hundreds of lines of code.
Stars: ✭ 243 (-2.02%)
Mutual labels:  cnn, rnn
A Convolutional Recurrent Neural Network For Real Time Speech Enhancement
A minimum unofficial implementation of the "A Convolutional Recurrent Neural Network for Real-Time Speech Enhancement" (CRN) using PyTorch
Stars: ✭ 123 (-50.4%)
Mutual labels:  cnn, rnn
Sentence Classification
Sentence Classifications with Neural Networks
Stars: ✭ 177 (-28.63%)
Mutual labels:  cnn, rnn
Captcharecognition
End-to-end variable length Captcha recognition using CNN+RNN+Attention/CTC (pytorch implementation). 端到端的不定长验证码识别
Stars: ✭ 97 (-60.89%)
Mutual labels:  cnn, rnn
Deep Learning With Python
Deep learning codes and projects using Python
Stars: ✭ 195 (-21.37%)
Mutual labels:  cnn, rnn
Iseebetter
iSeeBetter: Spatio-Temporal Video Super Resolution using Recurrent-Generative Back-Projection Networks | Python3 | PyTorch | GANs | CNNs | ResNets | RNNs | Published in Springer Journal of Computational Visual Media, September 2020, Tsinghua University Press
Stars: ✭ 202 (-18.55%)
Mutual labels:  cnn, rnn
Sign Language Gesture Recognition
Sign Language Gesture Recognition From Video Sequences Using RNN And CNN
Stars: ✭ 214 (-13.71%)
Mutual labels:  cnn, rnn
Torchsketch
Stars: ✭ 113 (-54.44%)
Mutual labels:  cnn, rnn
Mnist Classification
Pytorch、Scikit-learn实现多种分类方法,包括逻辑回归(Logistic Regression)、多层感知机(MLP)、支持向量机(SVM)、K近邻(KNN)、CNN、RNN,极简代码适合新手小白入门,附英文实验报告(ACM模板)
Stars: ✭ 109 (-56.05%)
Mutual labels:  cnn, rnn
Easyocr
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
Stars: ✭ 13,379 (+5294.76%)
Mutual labels:  cnn, ocr
Codesearchnet
Datasets, tools, and benchmarks for representation learning of code.
Stars: ✭ 1,378 (+455.65%)
Mutual labels:  cnn, rnn
Eeg Dl
A Deep Learning library for EEG Tasks (Signals) Classification, based on TensorFlow.
Stars: ✭ 165 (-33.47%)
Mutual labels:  cnn, rnn
Pytorch Sentiment Analysis
Tutorials on getting started with PyTorch and TorchText for sentiment analysis.
Stars: ✭ 3,209 (+1193.95%)
Mutual labels:  cnn, rnn
Pytorch Pos Tagging
A tutorial on how to implement models for part-of-speech tagging using PyTorch and TorchText.
Stars: ✭ 96 (-61.29%)
Mutual labels:  cnn, rnn
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-60.89%)
Mutual labels:  cnn, rnn
Keraspp
코딩셰프의 3분 딥러닝, 케라스맛
Stars: ✭ 178 (-28.23%)
Mutual labels:  cnn, rnn

Convolutional Recurrent Neural Network + CTCLoss

I think i have fixed the ctcloss nan problem!

Now!

Please pull the latest code from master.

Please update the pytorch to >= v1.2.0

Enjoy it!

PS: Once there is ctclossnan, please

  1. Change the batchSize to smaller (eg: 8, 16, 32)
  2. Change the lr to smaller (eg: 0.00001, 0.0001)
  3. Contact me by emailing to [email protected]

Dependence

  • CentOS7
  • Python3.6.5
  • torch==1.2.0
  • torchvision==0.4.0
  • Tesla P40 - Nvidia

Run demo

  • Download a pretrained model from Baidu Cloud (extraction code: si32)

  • People who cannot access Baidu can download a copy from Google Drive

  • Run demo

    python demo.py -m path/to/model -i data/demo.jpg
    

    demo

    Expected output

    -妳----真---的的---可---------以 => 妳真的可以
    

Feature

  • Variable length

    It support variable length.

  • Chinese support

    I change it to binary mode when reading the key and value, so you can use it to do Chinese OCR.

  • Change CTCLoss from warp-ctc to torch.nn.CTCLoss

    As we know, warp-ctc need to compile and it seems that it only support PyTorch 0.4. But PyTorch support CTCLoss itself, so i change the loss function to torch.nn.CTCLoss .

  • Solved PyTorch CTCLoss become nan after several epoch

    Just don't know why, but when i train the net, the loss always become nan after several epoch.

    I add a param dealwith_lossnan to params.py . If set it to True , the net will autocheck and replace all nan/inf in gradients to zero.

  • DataParallel

    I add a param multi_gpu to params.py . If you want to use multi gpu to train your net, please set it to True and set the param ngpu to a proper number.

Train your data

Prepare data

Folder mode

  1. Put your images in a folder and organize your images in the following format:

    label_number.jpg

    For example

    • English
    hi_0.jpg hello_1.jpg English_2.jpg English_3.jpg E n g l i s h_4.jpg...
    
    • Chinese
    一身转战_0.jpg 三千里_1.jpg 一剑曾当百万师_2.jpg 一剑曾当百万师_3.jpg 一 剑 曾 当 百 万 师_3.jpg ...
    

    So you can see, the number is used to distinguish the same label.

  2. Run the create_dataset.py in tool folder by

    python tool/create_dataset.py --out lmdb/data/output/path --folder path/to/folder
    
  3. Use the same step to create train and val data.

  4. The advantage of the folder mode is that it's convenient! But due to some illegal character can't be in the path

    Illegal character

    So the disadvantage of the folder mode is that it's labels are limited.

File mode

  1. Your data file should like

    absolute/path/to/image/一身转战_0.jpg
    一身转战
    absolute/path/to/image/三千里_1.jpg
    三千里
    absolute/path/to/image/一剑曾当百万师_2.jpg
    一剑曾当百万师
    absolute/path/to/image/3.jpg
    一剑曾当百万师
    absolute/path/to/image/一 剑 曾 当 百 万 师_4.jpg
    一 剑 曾 当 百 万 师
    absolute/path/to/image/xxx.jpg
    label of xxx.jpg
    .
    .
    .
    

    DO REMEMBER:

    1. It must be the absolute path to image.
    2. The first line can't be empty.
    3. There are no blank line between two data.
  2. Run the create_dataset.py in tool folder by

    python tool/create_dataset.py --out lmdb/data/output/path --file path/to/file
    
  3. Use the same step to create train and val data.

Change parameters and alphabets

Parameters and alphabets can't always be the same in different situation.

  • Change parameters

    Your can see the params.py in detail.

  • Change alphabets

    Please put all the alphabets appeared in your labels to alphabets.py , or the program will throw error during training process.

Train

Run train.py by

python train.py --trainroot path/to/train/dataset --valroot path/to/val/dataset

Reference

meijieru/crnn.pytorch

Sierkinhane/crnn_chinese_characters_rec

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].