无论对架构或超参数进行什么更改,丢失历史记录CTC都是相同的

问题描述

我正在尝试用3D-2D-CNN BLSTM-HMM and word-CTC models

中描述的体系结构训练口头阅读网络

但是无论我做了什么更改,我都面临着问题-网络架构,激活,超参数,改组-我一遍又一遍地面临着相同的损失历史:

enter image description here

我的nn的体系结构如下:

enter image description here

我的输入是112x112x1图像的序列,我的标签是大小为35(空白标记为+1)的字典的字符序列

这是我建立模型的方式:

with strategy.scope():
    optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001)
    model = build_model()
    model.compile(
        optimizer=optimizer,loss=CTCLoss(),)

这是我的损失:

class CTCLoss(tf.keras.losses.Loss):
    def __init__(self,logits_time_major=False,reduction=tf.keras.losses.Reduction.NONE,name='ctc'):
        super().__init__(reduction=reduction,name=name)
        self.logits_time_major = logits_time_major

    def call(self,y_true,y_pred):
        y_true = tf.cast(y_true,tf.int32)
        logit_length = tf.fill([tf.shape(y_pred)[0]],tf.shape(y_pred)[1])
        label_length = tf.fill([tf.shape(y_true)[0]],tf.shape(y_true)[1])
        loss = tf.nn.ctc_loss(
            labels=y_true,logits=y_pred,label_length=label_length,logit_length=logit_length,logits_time_major=self.logits_time_major,blank_index=0)
        return loss

我在做什么错?我认为这可能与损失有关,但看不到错误

解决方法

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

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

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