faustomorales / keras-ocr

A packaged and flexible version of the CRAFT text detector and Keras CRNN recognition model.
https://keras-ocr.readthedocs.io/
MIT License
1.39k stars 360 forks source link

Spaces not recognized with Keras-Ocr recognizer #180

Open Farah-Oubelkas opened 3 years ago

Farah-Oubelkas commented 3 years ago

Hello,

I'm running into a problem with Keras-ocr, I want to recognize also the space in the sentence. I tried to change the alphabet parameter by :


import keras_ocr

DEFAULT_ALPHABET = '\t\n!"#$\'/()*+.,-0123456789:;=?<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz{}~¢¥µñÑΩ€'
recognizer = keras_ocr.recognition.Recognizer(alphabet=DEFAULT_ALPHABET)
print(recognizer.alphabet)
recognizer.compile()

image_filepath='/home/farah/Downloads/image.png' 
predicted = recognizer.recognize(image_filepath)
print(f'Predicted: {predicted}')
_ = plt.imshow(keras_ocr.tools.read(image_filepath))

Keras-ocr with the default alphabet could recognize the text in my image, however, it fails to recognize the space between the two words. But when specifying the alphabet parameter, I don't get the right result, just a series of alphabets.

Any help?