微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ctc 错误 ignore_longer_outputs_than_inputs

如何解决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 举报,一经查实,本站将立刻删除。