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

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值