0

I have to train a cnn using as loss function mse. I normalized the labels between 0-1 but when I train I get

expected dense_2 to have shape (1,) but got array with shape (7,)

The last layer is x = Dense(1, activation='linear')(x)

and when I compile and train:

model.compile(loss=keras.losses.mean_squared_error, optimizer=Adam(lr=0.001),metrics=['mse'])


model_details=model.fit(X_train, Y_train)
Sebastian Dengler
  • 1,258
  • 13
  • 30
fpi
  • 313
  • 1
  • 5
  • 15

1 Answers1

0

I resized the Y_train matrix to 1D vector: each component of the vector is the label to the respective image.

fpi
  • 313
  • 1
  • 5
  • 15