-1

I am trying to train satellite images. My training set has 2 folders of input (samples) and ground truth (labels).

Total images are: 496
My X_train shape is: (496,3,256,256)
and y_train shape is: (496,256,256)

For every model, I use I get an error regarding the dense layer.

ValueError: Expected dense to have 2 dimensions, but got an array with shape (496,256,256)
desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

You are feeding images to the Dense Layer. Either flatten the images using .flatten() or use a model with CNN Layers. The shape (496,3,256,256) means you have 496 images of size 256x256 having 3 dimensions(rgb).

Look up on this answer for CNN model.

CNN: Error when checking input: expected dense to have 2 dimensions, but got array with shape (391, 605, 700, 3)

Sharan
  • 691
  • 1
  • 7
  • 16