本文主要是介绍Tensorflow的tf.nn.ctc_loss经常遇到的两个问题:,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.CTC Loss Error: invalidArgumentError: Not Enough time for target transition sequence.
—— 标签的长度大于sequence length,比如ocr识别中原始图像经过卷积倍,池化后time step 维度减小,小于标签的长度。例如,输入矩阵长度为4,你得标签文本为‘world’长度为5,矩阵最多只能包含4个字符。甚至当标签文本包含重复的字符时,如‘pizza’,ctc算法必须插入一个特殊字符(空格)在之间,被允许的标签长度甚至减1。
https://stackoverflow.com/questions/50654740/ctc-loss-error-invalidargumenterror-not-enough-time-for-target-transition-seque
2.CTC Loss Error: InvalidArgumentError: sequence_length(b) <= time
In this case b is each example in a minibatch. sequence_length(b) is the number of time stamps you have for that example. This is specified in the sequence_length argument passed to tf.nn.ctc_loss which is a 1-d tensor of sequence lengths.
sequence length 的维度为一维batchsize大小的向量,要求sequence length 中的每一个样例长度都要小于max time step,这里错误的原因就是数据的sequence 比lstm的step还长,如果数据直接进入lstm那么step等于数据补齐后的最长sequence,但例如ocr问题在进入rnn前先进行卷积,所以sequence的长度要考虑cnn的shape.
——https://www.cnblogs.com/yuetz/p/6762501.html
3.ctc_loss error “No valid path found.”
“It turns out that the ctc_loss requires that the label lengths be shorter than the input lengths. If the label lengths are too long, the loss calculator cannot unroll completely and therefore cannot compute the loss.”
——https://stackoverflow.com/questions/45130184/ctc-loss-error-no-valid-path-found
这篇关于Tensorflow的tf.nn.ctc_loss经常遇到的两个问题:的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!