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

Predicted result strings are empty --> Predicted: ['', '', '', '', '', ''] #216

Open zmtbnv opened 2 years ago

zmtbnv commented 2 years ago

I'm training for Japanese language - fonts, dataset/background generation and training all working with no issues. But recognition using pipeline.recognize(images=[image])[0] returning emtpy strings with correct bounding boxes like:

Actual: 東
北 地
方
の 北 部 ( 北 東 北
) に 所 在 し 、 北 は
青 森 県 、 西 は 秋 田
県 、 南 は 宮 城 県 と
境 界 を 接 し て Predicted: ['', '', '', '', '', '', '', '', '', '', '', '']

6e38e64e-4439-46b4-afff-38558caa314e

recognizer is custom trained model with Japanese full alphabet (hiragana, katakana, kanji, kigo) and its passed to pipeline = keras_ocr.pipeline.Pipeline(detector=detector, recognizer=recognizer).

Also, manually checked the result of self.prediction_model.predict(X, **kwargs), and its returning following:

[[-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

And recognize_from_boxes() resulting in:

[('',
  array([[ 93.747345, 140.20299 ],
         [252.27713 , 131.2296  ],
         [255.75726 , 192.71187 ],
         [ 97.22748 , 201.68526 ]], dtype=float32)),
...

Does anyone known what could be the issue?

Thank you.

Alexqwesa commented 1 year ago

I have similar issue: it trained well, and even recognize images immediately after training, but after i load model from disk - it stop working((

Did your model work immediately after training? (before saving/loading from disk) ?