Esempio n. 1
0
def ctc_lambda_func(args):
    """
    Here the actual CTC loss calc occurs despite it not being an internal Keras loss function
    :param args: [y_pred, labels, input_length, label_length]
    :return: ctc_batch_cost
    """
    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)
Esempio n. 2
0
def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    y_pred = y_pred[:, 2:, :]
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)