Exception: Error when checking model target: expected dense_3 to have shape (None, 1000) but got array with shape (32, 2)

后端 未结 2 1633
时光取名叫无心
时光取名叫无心 2020-12-10 09:05

How do I create a VGG-16 sequence for my data?

The data has the following :

model = Sequential() 
model.add(ZeroPadding2D((1, 1), input_shape=(3, img         


        
相关标签:
2条回答
  • 2020-12-10 09:30

    Here instead of 1000 you should have the total number of classes because it's the output layer.

    model.add(Dense(1000, activation='softmax')) 
    

    Also shape of labels (or Y_train/Y_test) should be (total number of classes, total number records).

    This helped me resolve similar kind of error.

    0 讨论(0)
  • 2020-12-10 09:35

    I have 10 species,
    I have solved the problem by
    changing:

    model.add(Dense(1000, activation='softmax'))
    

    to:

    model.add(Dense(10, activation='softmax'))
    

    then it works.

    0 讨论(0)
提交回复
热议问题