Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Input 0 is incompatible with layer model_1 #13

Open
islamshahil opened this issue Mar 1, 2021 · 2 comments
Open

ValueError: Input 0 is incompatible with layer model_1 #13

islamshahil opened this issue Mar 1, 2021 · 2 comments

Comments

@islamshahil
Copy link

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]
@urmikakasi
Copy link

Did you find a solution to this?

@fronos
Copy link

fronos commented Oct 10, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants