Error lúc combined model sử dụng Keras



i’m building model caption_generator for image. when i build model use keras and training it was an error as following : " Error when checking target: expected dense_3 to have 3 dimensions, but got array with shape (47, 86) "

Someone helped me solve this problem I have included image and links code

img_model_in = Input(shape=(4096,)) img_model_out = Dense(EMBEDDING_DIM, input_dim=4096, activation=‘relu’)(img_model_in) img_model_out = RepeatVector(max_length)(img_model_out) img_model = Model(img_model_in, img_model_out)

lang_model_in = Input(shape=(max_length, ))
lang_model_out = Embedding(vocab_size, 256)(lang_model_in)
lang_model_out = LSTM(256, return_sequences=True)(lang_model_out)
lang_model_out = TimeDistributed(Dense(EMBEDDING_DIM))(lang_model_out)
lang_model = Model(lang_model_in, lang_model_out)
model_concat = concatenate([img_model_out, lang_model_out])
model_concat = LSTM(1000, return_sequences=True)(model_concat)
model_concat = Dense(vocab_size, activation='softmax')(model_concat)

model_concat = Activation(‘softmax’)(model_concat)

model = Model([img_model_in, lang_model_in], model_concat) 

model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
return model

// def data_generator(descriptions, photos, tokenizer, max_length): # loop for ever over images while 1: for key, desc_list in descriptions.items(): # retrieve the photo feature photo = photos[key][0] in_img, in_seq, out_word = create_sequences(tokenizer, max_length, desc_list, photo)




        yield [[in_img, in_seq], out_word]
        in_img = []
        in_seq = []
        out_word = []

for i in range(epochs): # create the data generator generator = data_generator(train_descriptions, train_features, tokenizer, max_length)
# fit for one epoch model.fit_generator(generator, epochs=1, steps_per_epoch=steps, verbose=1) # save model‘model_’ + str(i) + ‘.h5’)

thanks all