0

我收到此错误:'''

InvalidArgumentError:  Not enough time for target transition sequence (required: 138, available: 76)0You can turn this error into a warning by using the flag ignore_longer_outputs_than_inputs
     [[node model_10/ctc/CTCLoss (defined at <ipython-input-211-3c40d9e71078>:3) ]] [Op:__inference_train_function_18256]

'''

这是我正在使用的代码,我可以把这个参数ignore_longer_outputs_than_inputs放在哪里?

'''

def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args
    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)

def add_ctc_loss(input_to_softmax):
    the_labels = Input(name='the_labels', shape=(None,), dtype='float32')
    input_lengths = Input(name='input_length', shape=(1,), dtype='int64')
    label_lengths = Input(name='label_length', shape=(1,), dtype='int64')
    output_lengths = Lambda(input_to_softmax.output_length)(input_lengths)
    # CTC loss is implemented in a lambda layer
    loss_out = Lambda(ctc_lambda_func, output_shape=(1,), name='ctc')(
        [input_to_softmax.output, the_labels, output_lengths, label_lengths])
    model = Model(
        inputs=[input_to_softmax.input, the_labels, input_lengths, label_lengths], 
        outputs=loss_out)
    return model

'''

4

0 回答 0