Error when checking target: expected dense_3 to have shape (3,) but got array with shape (1,)

后端 未结 9 1789
不思量自难忘°
不思量自难忘° 2020-12-04 17:26

I am working on training a VGG16-like model in Keras, on a 3 classes subset from Places205, and encountered the following error:

ValueError: Error when chec         


        
9条回答
  •  青春惊慌失措
    2020-12-04 18:16

    The problem is with the shape of the labels of the data "Y".
    The shape you have for the labels are (m,) and this will not work with the:

    loss = "binary_crossentropy"
    

    I believe if you don't want to play with the shape of the labels, then use:

    loss = "sparse_categorical_crossentropy"
    

提交回复
热议问题