错误集

1.

error:

  File "/Users/jasonjia/miniforge3/envs/pri_tf/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 301, in _constant_eager_impl

    t = convert_to_eager_tensor(value, ctx, dtype)

  File "/Users/jasonjia/miniforge3/envs/pri_tf/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 98, in convert_to_eager_tensor

    return ops.EagerTensor(value, ctx.device_name, dtype)

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list).

reason:

y_train数据没有padding成相同的长度,因此一直报这个错误,这个搞了好久。

2. 

error_info:    input_spec.assert_input_compatibility(self.input_spec, inputs, self.name)

  File "/Users/jasonjia/miniforge3/envs/pri_tf/lib/python3.8/site-packages/tensorflow/python/keras/engine/input_spec.py", line 271, in assert_input_compatibility

    raise ValueError('Input ' + str(input_index) +

ValueError: Input 0 is incompatible with layer model_1: expected shape=(None, 150, 50, 1), found shape=(None, 7168)

reason: x_train 是图像数据,读取成一维的,reshape成二维的就ok了。

  x_train = X.reshape(X.shape[0], height, width, 1)


3.

error_info:

File "/Users/jasonjia/miniforge3/envs/pri_tf/lib/python3.8/site-packages/tensorflow/python/keras/engine/input_spec.py", line 271, in assert_input_compatibility

    raise ValueError('Input ' + str(input_index) +

ValueError: Input 1 is incompatible with layer model_1: expected shape=(None, 9), found shape=(None, 8, 1)

reason: 

输入y_train格式错误 [[1],[2],[3],[4],[5],[6],[7],[8]]  --> [1,2,3,4,5,6,7,8] 然后ok了

4:

error:

tensorflow.python.framework.errors_impl.InvalidArgumentError:  Saw a non-null label (index >= num_classes - 1) following a null label, batch: 1 num_classes: 11 labels: 2,10,8,0,0,0,0,0 labels seen so far: 2

[[node model_1/ctc/CTCLoss (defined at test.py:174) ]] [Op:__inference_train_function_11652]


reason:

有人说要加占位符,也有人说直接“nclass = len(char_set)+1“

我查看了一下原来自己漏了一个类,识别0-10是个大写汉字,共11个,然后+1 nclass=12,我直接写成了11,修改之后,跑起来了,再看看有没有别的错误吧。


5. model跑起来之后出现了告警,不过不影响跑模型。

warning:

WARNING:tensorflow:AutoGraph could not transform and will run it as-is

解决方法参考:https://stackoverflow.com/questions/66986540/warningtensorflowautograph-could-not-transform-function-preprocess-at-0x7f8f

查看了一下自己的gast是0.5.0,按照文中所说的,降到0.3.3告警消失

你可能感兴趣的:(错误集)