Holmeyoung / crnn-pytorch

Pytorch implementation of CRNN (CNN + RNN + CTCLoss) for all language OCR.
MIT License
377 stars 105 forks source link

training with variable length images and text #43

Closed ghost closed 4 years ago

ghost commented 4 years ago

I have two questions:

  1. Do your codes currently support training with variable text length?

  2. Does "keep_ratio = True" work for training? If I want to train the model with with variable length images should I also have to modify create_dataset.py?

in this site (https://github.com/meijieru/crnn.pytorch) the author mentions that "If you want to train with variable length images (keep the origin ratio for example), please modify the tool/create_dataset.py and sort the image according to the text length"

Thanks a lot.

Holmeyoung commented 4 years ago

Yeah, it supports variable text length.

  1. Set keep_ratio = True

  2. Just create dataset with different label length and train(e.g. train.txt).

    1.jpg
    12
    2.jpg
    123
ghost commented 4 years ago

thank you very much. Words cannot describe my gratitude to you.