MaybeShewill-CV / CRNN_Tensorflow

Convolutional Recurrent Neural Networks(CRNN) for Scene Text Recognition
MIT License
1.03k stars 388 forks source link

inferencing using the saved_model.pb #241

Closed un-lock-me closed 5 years ago

un-lock-me commented 5 years ago

Hello there,

Thanks for sharing your project with us. I want to use the saved_model.pb in order to run the inferencing. To put it another way, the same as test_shadownet.py which test on a single image, but I want to do the save using the saved model. can you please help me with this?

Your help is much appreciated.

The reason I want to change the test_shadownet.py is that it uses

    codec = tf_io_pipline_fast_tools.CrnnFeatureReader(
        char_dict_path=char_dict_path,
        ord_map_dict_path=ord_map_dict_path
    )

    net = crnn_net.ShadowNet(
        phase='test',
        hidden_nums=CFG.ARCH.HIDDEN_UNITS,
        layers_nums=CFG.ARCH.HIDDEN_LAYERS,
        num_classes=CFG.ARCH.NUM_CLASSES
    )

But I want to use ur model seperately in another environment without needing to any modules.

MaybeShewill-CV commented 5 years ago

@saria85 https://github.com/MaybeShewill-CV/CRNN_Tensorflow/blob/master/tools/export_saved_model.py You may check this which I think will be helpful:)

un-lock-me commented 5 years ago

@saria85 https://github.com/MaybeShewill-CV/CRNN_Tensorflow/blob/master/tools/export_saved_model.py You may check this which I think will be helpful:)

Thank you so much for your quick reply, I greatly appreciate it and impress with such good work in which you have considered a lot of things about your code. I just check it and it is working, though I have not got a good result on this image. Can you please share your idea why the result is not good, (it just returned pses)!

again Thanks a lot!

un-lock-me commented 5 years ago

I input the simpler image still did not output result, it seems it is only on short text, am I correct?

MaybeShewill-CV commented 5 years ago

@saria85 1.First the model can not locate where the text region is. 2. Second if you're familiar with synth90k dataset you will find out the dataset is composed of single english words rather than sentences. Of course the CRNN model can be trained with sentences you may the Chinese's model which was trained by short chinese sentences. 3.You may test if the mode can recognize the single word in your PDF:)

MaybeShewill-CV commented 5 years ago

@saria85 You may some of the test results in my local machine:) test_1 test_2 test_3

un-lock-me commented 5 years ago

Thank you so much for your answer, I tried it in short text, but not one word in a scene. like 5 words in an image but the result was not good. Now I want to train your model on http://www.iapr-tc11.org/mediawiki/index.php?title=NEOCR:_Natural_Environment_OCR_Dataset.

I will share the result with you. Also, do you know any model can do both short text and long text, or is there any way I can accomplish that?

Thank you.

MaybeShewill-CV commented 5 years ago

@saria85 The conn model can used to recognize sequence but you need to feed sequence dataset to train it. You may see the Chinese sequence recognition test result:)

MaybeShewill-CV commented 5 years ago

@saria85 I will release a model trained on this dataset once I got spare time:)

un-lock-me commented 5 years ago

@saria85 I will release a model trained on this dataset once I got spare time:)

That would be really great:)

AhmadShaik commented 5 years ago

@MaybeShewill-CV I am trying to recognise text from a single well cropped image, but I am getting incorrect recognitions. I am using the pre-trained model that you have provided. Here I am adding the results, can you tell me the reason behind mis-classification. Your help is highly appreciated.

image

image

image

image

MaybeShewill-CV commented 5 years ago

@AhmadShaik I think that's mainly caused by the dataset's distribution. You can train a new model if you have training samples:) By the way the last image which contains two rows is not supported by the model here:)

AhmadShaik commented 5 years ago

@MaybeShewill-CV thank you for the quick response. I understood the problem related to last image. As you suggested I am trying to train a model with a custom dataset. I have the training images, but I am confused with annotations and generating tfrecords. Can you provide some information related to preparing a dataset. Thank you

MaybeShewill-CV commented 5 years ago

@AhmadShaik You may first see synth90k dataset and understand it's format and make yourown dataset reference to their format:)