Error when checking model input: expected convolution2d_input_1 to have 4 dimensions, but got array with shape (32, 32, 3)

后端 未结 9 1690
南笙
南笙 2020-12-08 01:28

I want to train a deep network starting with the following layer:

model = Sequential()
model.add(Conv2D(32, 3, 3, input_shape=(32, 32, 3)))

9条回答
  •  没有蜡笔的小新
    2020-12-08 02:22

    it depends on how you actually order your data,if its on a channel first basis then you should reshape your data: x_train=x_train.reshape(x_train.shape[0],channel,width,height)

    if its channel last: x_train=s_train.reshape(x_train.shape[0],width,height,channel)

提交回复
热议问题