bgshih / crnn

Convolutional Recurrent Neural Network (CRNN) for image-based sequence recognition.
MIT License
2.06k stars 553 forks source link

how prepare my images? #109

Open letarg0 opened 6 years ago

letarg0 commented 6 years ago

I have set of images for example https://github.com/aero2a/kape- How creating learning files to solve this captcha?

Heisenberg0391 commented 5 years ago

To train a network with ctc, you need 4 items: (1)training sample which is the input image (2)labels which is the ground truth label sequence (3)label sequence length which is the length of ground truth label sequence (4)input_length which is the width of feature map of the final layer in cnn part

letarg0 commented 5 years ago

no problem , look this Is possible generate data using this library https://github.com/letarg0/obrazy I can generate data but what format?

Heisenberg0391 commented 5 years ago

for tf backend they are all ndarray. you can generate your own data as long as you have: (1)text images (2)ground truth sequence, then you need to calculate (3)the length of ground truth sequence and (4)the sequence length (namely the length of rnn input sequence). whats more, you may want to ensure (4) >= (3) to satisfy the function mapping of ctc for your data library, i recommend you to combine single characters to form text sequences, you may want to check this out https://github.com/Heisenberg0391/TextImageGenerator

letarg0 commented 5 years ago

look this https://github.com/letarg0/obrazy/tree/master/letter_images each directory contains image, name directory is the text.

Heisenberg0391 commented 5 years ago

if you want to build a captcha dataset, you have to render a multi-character text image, not a single char image. If you really want to use single char images, you need to (1) load multiple single char images and their class labels according to your target captcha (2) render those characters in a single image (3) build new labels for that image