我正在尝试适合我的5类分类的简单keras模型: 你知道吗
model = Sequential()
model.add(Dense(64, input_shape=(6,), activation="relu"))
model.add(Dense(5, activation="softmax"))
此外,我还有以下格式的数据: 你知道吗
>print(features)
[array([155, 22, 159, 57, 247, 88], dtype=uint8),
array([184, 165, 127, 49, 190, 0,], dtype=uint8),
...
array([35, 136, 32, 255, 114, 137], dtype=uint8)]
但当我尝试拟合模型时,我会遇到下一个错误: 你知道吗
Error when checking input: expected input_layer_input to have shape (6,) but got array with shape (1,)
我不明白这个错误的原因是什么。你能帮我拿一下吗
一些附加信息: 你知道吗
>type(features)
numpy.ndarray
>features.shape
(108885,)
>type(features[0])
numpy.ndarray
>features[0].shape
(6,)
您可以将输入数据更改为二维(numpy)数组,也可以将输入形状更改为(1,),具体取决于您要执行的操作。现在你有一个数组。凯拉斯不接受
相关问题 更多 >
编程相关推荐