githubharald / SimpleHTR

Handwritten Text Recognition (HTR) system implemented with TensorFlow.
https://towardsdatascience.com/2326a3487cd5
MIT License
1.96k stars 885 forks source link

Error on WordBeamSearch Inference #136

Closed j-paris closed 2 years ago

j-paris commented 2 years ago

Hello,

I am encountering some problems in running the code in Inference Mode and specifically with the decoder type 'wordbeamsearch'. I have successfully cloned the repository CTCWordBeamSearch (https://github.com/githubharald/CTCWordBeamSearch) and the test script attached correctly runs.

However, when I try to make inference on the provided test image (word.png) with the given net weights, I get the following error:

Traceback (most recent call last): File "main.py", line 194, in <module> main() File "main.py", line 190, in main infer(model, args.img_file) File "main.py", line 133, in infer recognized, probability = model.infer_batch(batch, True) File "/opt/notebooks/HTR/SimpleHTR/src/model.py", line 294, in infer_batch loss_vals = self.sess.run(eval_list, feed_dict) File "/root/.conda/envs/MXNetGPU/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 968, in run run_metadata_ptr) File "/root/.conda/envs/MXNetGPU/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1167, in _run (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (0,) for Tensor 'Placeholder_1:0', which has shape '(None, 2)' Segmentation fault (core dumped)

Please notice that there may some inconsistence on the code lines number only due to a few simple comments I have written in the script.

Can someone provide me some hints to solve this problem? Thank you in advance.

Regards Jacopo Paris

githubharald commented 2 years ago

this already happens before even calling the word beam search decoder. Can you checkout exactly the code version as it is on github and then just run python main.py?

j-paris commented 2 years ago

Thank you Harald, I have recloned the repository from scratch and now it seems to be working!

Thank you for the support. Jacopo Paris