ilovin / lstm_ctc_ocr

Use CTC + tensorflow to OCR
https://ilovin.github.io/2017-04-06/tensorflow-lstm-ctc-ocr/
354 stars 140 forks source link

ValueError: zero-size array to reduction operation maximum which has no identity #8

Closed Naruto-Sasuke closed 7 years ago

Naruto-Sasuke commented 7 years ago

I try code of master branch, and it errors like this: =============================begin training============================= Traceback (most recent call last): File "./standard/lstm_ocr.py", line 203, in train(train_dir='../train',val_dir='../val') File "./standard/lstm_ocr.py", line 142, in train val_inputs,val_seq_len,val_labels=val_feeder.input_index_generate_batch() File "/home/yan/lstm_ctc_ocr-master/standard/utils.py", line 112, in input_index_generate_batch batch_labels = sparse_tuple_from_label(label_batch) File "/home/yan/lstm_ctc_ocr-master/standard/utils.py", line 143, in sparse_tuple_from_label shape = np.asarray([len(sequences), np.asarray(indices).max(0)[1]+1], dtype=np.int64) File "/home/yan/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py", line 26, in _amax return umr_maximum(a, axis, None, out, keepdims) ValueError: zero-size array to reduction operation maximum which has no identity

ilovin commented 7 years ago

maybe the sequence length = 0? does the 'train' and the 'val' folder has the correct path?

Naruto-Sasuke commented 7 years ago

Aha, my bad. I run it in the path of lstm_ocr and when I change ../train to ./train, it turns out fine.

ilovin commented 7 years ago

if you don't have further questions, plz close the issue