Holmeyoung / crnn-pytorch

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

Incorrect number of classes #39

Open maykulkarni opened 4 years ago

maykulkarni commented 4 years ago

Hey thanks for sharing the code, but I found a possible issue while training the network. While editing the number of characters in the alphabet.py file, I followed the guide and replaced the Chinese characters by English one and my network trained fine. But while reading the code and debugging I found that the nClass output dimension of the CRNN was 72 while the number of unique characters in the alphabet.py class was only 36. I eventually realized that that code is splitting the characters wrongly and considering \n newline as a character as well that's why the output dimension was [26x1x72] instead of [26x1x37] this can cause an issue in training. I can raise a PR fixing this if you want. Thanks.

Holmeyoung commented 4 years ago

Of course you can. Thank you~

livekeys commented 4 years ago

Hello, how can I solve this problem!

maykulkarni commented 4 years ago

@livekeys just edit the alphabet.py to have all the characters in the same line this way \n will not be treated as a new character.

livekeys commented 4 years ago

Thank you very much!