Image-Captioning
Image-Captioning copied to clipboard
ValueError: Input 0 is incompatible with layer model_1
Received the below error while running eval_model.py
raise ValueError('Input ' + str(input_index) +
ValueError: Input 0 is incompatible with layer model_1: expected shape=(None, 4096), found shape=(None, 1000)
The error is on:
File "eval_model.py", line 134, in <module>
captions = generate_desc(model, tokenizer, photo, index_word, max_length)
File "eval_model.py", line 56, in generate_desc
y_pred = model.predict([photo,sequence], verbose=0)[0]
Did you find a solution to this?
This issue can be fixed by changing line at eval_model.py to model = Model(inputs=model.inputs, outputs=model.layers[-2].output) We need feature vector from fully connected layer that goes as input to the last layer of VGG model.