weinman / cnn_lstm_ctc_ocr

Tensorflow-based CNN+LSTM trained with CTC-loss for OCR
GNU General Public License v3.0
498 stars 170 forks source link

python validate.py problem #35

Closed gydlcc closed 5 years ago

gydlcc commented 5 years ago

hi there! when i type python validate.py and i type 1.jpg i got follow error

2018-08-02 15-42-18

how could i solve this, thanks

weinman commented 5 years ago

The validate script is tied to the MJsynth data, which is only 31 pixels high. Thus the raw data's placeholder is (31,?,1) and the tensor gets expanded to 32 pixels high in the _preprocess_image function.

If you delete line 65

image = tf.concat([first_row, image], 0)

and change line 74 in _get_input to to create a 32-pixel high value instead,

image = tf.placeholder(tf.uint8, shape=[32, None, 1])

it should work for your data, which seems to be 32 pixels high already.

gydlcc commented 5 years ago

oh oh thanks pretty much ! ! so if i use the data trained the model, and if i use another data which has different size from the train data to validate the trained model, is that possible?

weinman commented 5 years ago

The width is variable, but the height is ostensibly fixed, unless perhaps you introduce a new pooling operation. See #33 for more.

gydlcc commented 5 years ago

alright, thank you very much ! ! !