qjadud1994 / CRNN-Keras

CRNN (CNN+RNN) for OCR using Keras / License Plate Recognition
MIT License
521 stars 191 forks source link

Quesion about Predection.py file #22

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi, in the line

out_best = list(np.argmax(out[0, 2:], axis=1)) # get max index -> len = 32

why you used

2:0

in the out varibale.

qjadud1994 commented 5 years ago

If you look at "Model.py", it seems to be helpful.


def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    # the 2 is critical here since the first couple outputs of the RNN
    # tend to be garbage:
    y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)