Reputation: 39
I have loaded images to train my model on recognizing one feature in those images.
(1380,200,200,3 )
containing 1380 images sized 200 by 200pixels in RGB formatYtrain has targets. shape (1380,2)
When I train my model (model.fit(Xtrain,Ytrain)
) I seem to get a value error on everyone of the layers. As if the input was both Xtrain
then Ytrain
...
ValueError: Error when checking target: expected
batch_normalization_24
to have 4 dimensions, but got array with shape(1380, 2)
Image:
Upvotes: 2
Views: 128
Reputation: 5000
The shape of Keras's batch normalizer layer's output is the same as its input. Since you have only two labels, your final layer in a Sequential model should generate two outputs. You can consider adding a Dense
layer like:
model.add(Dense(2), activation='relu')
I also recommend to check your model's architecture using print(model.summary())
and make sure that inputs and outputs match with your dataset and vice versa.
Upvotes: 2