ctc 错误 ignore_longer_outputs_than_inputs

问题描述

我收到此错误: '''

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,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',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,input_lengths,label_lengths],outputs=loss_out)
    return model

'''

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)