Closed flymark2010 closed 7 years ago
I got a similar error when trying to run with the pre-trained model (http://www.cs.cmu.edu/~yuntiand/model.tgz)
File ".../tensorflow/Attention-OCR/src/model/model.py", line 191, in init self.saver_all.restore(self.sess, ckpt.model_checkpoint_path) File "../tensorflow/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1105, in res\ tore ... File ".../tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 728, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [39,20] rhs shape= [39,10]
here's my command
python src/launcher.py --phase=test --visualize --data-path=evaluation_data/svt/test.txt --data-base-dir=evaluation_data/svt --log-path=log.txt --load-model --model-dir=model --output-dir=results
Make sure that the model parameters (such as target embedding size, number of hidden units) are set the same as in the training phase. When loading a model that has different structure from the current paramters, a mismatch of shape would occur.
@da03 I used your pre-model with SVN data to test, i meet a problem when the program run for a short time and stop
Attention-OCR-master/src/model/model.py:381:VisibleDeprecationWarning:using a non-integer number will result in an error in the future
attention_orig[i]=attention[i/4-1]
Attention-OCR-master/src/model/model.py:388:VisibleDeprecationWarning:using a non-integer number will result in an error in the future
attention_orig[i]=attention[i/4-1]
the result has some output but not all, just 200/647
See #12 . Seems that the new keras version is different from the old one. I know that it is really annoying, but both keras and tensorflow have changed their interface since this code was released. I would suggest re-training a model from scratch.
Hi, I've trained a model following the toy example. And using the model to test the iiit5k data. While error happens: "../Attention-OCR/src/model/model.py" line 182, in init self.saver_all = tf.train.Saver(tf.all_variables()) an exception is throwed: tensorflow.python.framework.errors.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shap=[1024] rhs shape=[2048]
When using the author's model trained on Synth 90K to test iiit5k , everythin is ok and finally get "2034.98 out of 3000 correct".
Could anybody explain this? Thanks a lot.