1

how can turn this error into a warning (ignore_longer_outputs_than_inputs) from my code? [.ipynb]

labels = Input(name='the_labels', shape=[max_label_len], dtype='float32')
input_length = Input(name='input_length', shape=[1], dtype='int64')
label_length = Input(name='label_length', shape=[1], dtype='int64')

def ctc_lambda_func(args):
    y_pred, labels, input_length, label_length = args

    return K.ctc_batch_cost(labels, y_pred, input_length, label_length)


loss_out = Lambda(ctc_lambda_func, output_shape=(1,), name='ctc')([outputs, labels, input_length, label_length])

#model to be used at training time
model = Model(inputs=[inputs, labels, input_length, label_length], outputs=loss_out)

if you want, you can look my full code here: https://colab.research.google.com/drive/1nMRNUsLDNrpgeTxPFQ4mhobnFdpbmwUx

  • See if changing our `K.ctc_batch_cost` to `ctc_loss` from [this](https://www.tensorflow.org/api_docs/python/tf/compat/v1/nn/ctc_loss) helps? This has an argument `ignore_longer_outputs_than_inputs` which you can set. – thushv89 Apr 23 '20 at 22:59
  • from my code, how exactly should I change my CTCLoss code? I still studying about CTCLoss... thanks – Febe Febrita May 08 '20 at 11:41
  • I tried the ctc_loss but it shows error like this: "Expected labels (first argument) to be a SparseTensor" @thushv89 – Febe Febrita May 09 '20 at 09:03

1 Answers1

0

NOTES: it's not the dataset fault, it's because of my architecture's output shape for CTC