handwriting-ocr icon indicating copy to clipboard operation
handwriting-ocr copied to clipboard

Word-CTC classifier not training

Open tosi-n opened this issue 5 years ago • 8 comments

Anytime I try to train the CTC model it comes back with a value error

ValueError: Cannot evaluate tensor using eval(): No default session is registered.

Tried setting a default session with this,

with sess.as_default():
    tf.global_variables_initializer().run()

doesn't work still. Would appreciate a guide through this, Thank you

tosi-n avatar Jun 16 '19 15:06 tosi-n

Hi, I am sorry. I forget about this error. Basically, you have to replace all occurrences of .eval(). For example this:

accTrain = accuracy.eval(fd)

Must be changed into this:

accTrain = accuracy.eval(fd, session=sess)

That is same as sess.run(accuracy, feed_dict=fd) Feel free to send pull request with the changes to fix this bug.

Breta01 avatar Jun 16 '19 15:06 Breta01

Thanks for the quick response. I would definitely make a pull request in order to commit changes, had to current some bugs in mlhelpers.py also.

Currently having problems with accuracy under training. Apparently It is not defined

accTest = accuracy.eval(fd_test, session = sess)

tosi-n avatar Jun 16 '19 16:06 tosi-n

I see. I haven't implemented it yet, there were some issues with matching the correct output lengths. You can use label_err_rate instead of accuracy it is kinda similar, but less is better.

Breta01 avatar Jun 16 '19 16:06 Breta01

Currently got it to work, I would make a pull request once I am done editing. What least parameters would you recommend training the IAM dataset on considering the usage of Tesla K80 GPU on colab

tosi-n avatar Jun 16 '19 18:06 tosi-n

Great, I would be really thankful for that. I am not really sure about the parameters. Just experiment and you will see.

Breta01 avatar Jun 17 '19 08:06 Breta01

Yeah, I finally trained the model with the default parameters, It was faster than I expected. Can you have a look at the characters script when you're less busy, can't seem to import it into OCR.ipynb because it's finding it hard to locate gap-clas/CNN-CG model and gap-clas/RNN/Bi-RNN-new

tosi-n avatar Jun 17 '19 11:06 tosi-n

Sorry to bother you, I just fixed it. Would make updated changes available soon enough.

And finally, what alternative function can i use to recognise using CTC model. The current function does not seem to predict correctly?

tosi-n avatar Jun 17 '19 12:06 tosi-n

tosi-n, were you able to train CTC model? if so please see my 145th ticket

chandanramesh30 avatar Sep 24 '21 15:09 chandanramesh30