0

Tensorflow Beginner here. I got this error message and I have no clue what to do, where to look or what to change? Can someone guide me into the right direction?

Code: https://github.com/niconielsen32/NeuralNetworks/blob/main/OCRcaptchas.ipynb

    ValueError: Exception encountered when calling layer "ctc_loss" "                 f"(type CTCLayer).

in user code:

    File "C:\Users\guowe\PycharmProjects\ocr_gas\ocr.py", line 135, in call  *
        label_length = tf.cast(tf.shape(y_true)[1], dtype="int64")

    ValueError: slice index 1 of dimension 0 out of bounds. for '{{node ocr_model_v1/ctc_loss/strided_slice_2}} = StridedSlice[Index=DT_INT32, T=DT_INT32, begin_mask=0, ellipsis_mask=0, end_mask=0, new_axis_mask=0, shrink_axis_mask=1](ocr_model_v1/ctc_loss/Shape_2, ocr_model_v1/ctc_loss/strided_slice_2/stack, ocr_model_v1/ctc_loss/strided_slice_2/stack_1, ocr_model_v1/ctc_loss/strided_slice_2/stack_2)' with input shapes: [1], [1], [1], [1] and with computed input tensors: input[1] = <1>, input[2] = <2>, input[3] = <1>.


Call arguments received by layer "ctc_loss" "                 f"(type CTCLayer):
  • y_true=tf.Tensor(shape=(None,), dtype=float32)
  • y_pred=tf.Tensor(shape=(None, 50, 12), dtype=float32)
daniel guo
  • 45
  • 1
  • 7

0 Answers0