Image-Captioning icon indicating copy to clipboard operation
Image-Captioning copied to clipboard

ValueError: Input 0 is incompatible with layer model_1

Open islamshahil opened this issue 3 years ago • 2 comments

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]

islamshahil avatar Mar 01 '21 17:03 islamshahil

Did you find a solution to this?

urmikakasi avatar Jan 20 '22 23:01 urmikakasi

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.

fronos avatar Oct 10 '22 07:10 fronos