我有一个模型,可以预测使用喀拉拉邦。但是keras给了我不正确的形状错误。
expected dense_1_input to have shape (13,) but got array with shape (1,)
代码如下:
model.summary()
print(seq)
print(seq.shape)
location_onehot = model.predict(seq)
输出:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense_1 (Dense) (None, 2) 28
_________________________________________________________________
dense_2 (Dense) (None, 2) 6
_________________________________________________________________
dense_3 (Dense) (None, 2) 6
_________________________________________________________________
dense_4 (Dense) (None, 2) 6
_________________________________________________________________
dense_5 (Dense) (None, 320) 960
=================================================================
Total params: 1,006
Trainable params: 1,006
Non-trainable params: 0
_________________________________________________________________
[ 1 5 6 2 2 3 20 3 3 3 1 1 1]
(13,)
Traceback (most recent call last):
File "infer.py", line 78, in <module>
dompath_loc_infer_all()
File "infer.py", line 11, in dompath_loc_infer_all
print('location:', predict_loc(i), '\n')
File "/mnt/c/Users/psharma/Desktop/TADigital/dom/decode.py", line 13, in predict_loc
location_onehot = model.predict(seq)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1149, in predict
x, _, _ = self._standardize_user_data(x)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 751, in _standardize_user_data
exception_prefix='input')
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_utils.py", line 138, in standardize_input_data
str(data_shape))
ValueError: Error when checking input: expected dense_1_input to have shape (13,) but got array with shape (1,)