![](/img/trans.png)
[英]input_shape of an 8x8 board game to a Neural Network with Keras
[英]input_shape issue in Neural networks with Keras in Python
我正在尝试使用MNIST数据集在神经网络上完全复制本教程 。 将其复制粘贴到Python编辑器中时,出现以下异常:
Exception: The first layer in a Sequential model must get an `input_shape` or `batch_input_shape` argument.
所以我尝试使用指定输入sheme
model.add(Convolution2D(32, 1, 3, 3, border_mode='same', input_sheme=(1,28,28)))
但我想我做错了。
有人可以帮忙吗?
错字
model.add(Convolution2D(32, 1, 3, 3, border_mode='same', input_sheme=(1,28,28)))
^
应该
model.add(Convolution2D(32, 1, 3, 3, border_mode='same', input_shape=(1,28,28)))
它说的就在那里
例外:顺序模型中的第一层必须获取
input_shape
或batch_input_shape
参数。
我现在将尝试为您分解此错误消息。 下次您自己尝试。
顺序模型的第一层[...]
顺序模型是使用一系列图层从输入生成输出的模型。 我猜想Convolution2D
层实际上是模型中的第一层。
[...]必须获取一个
input_shape
或batch_input_shape
参数。
Keras必须知道输入的形状。 因此,您必须将其提供给第一层或使用具有该形状的Input
层。 您正在提供input_sheme
参数,该参数甚至没有。 尝试改为提供input_shape
。 对于MNIST,通常为(784,)
因为这是28 x 28图像具有的像素数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.