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

Layer count mismatch when loading weights from file #5

Open
bastianspirek opened this issue Jan 4, 2025 · 0 comments
Open

Layer count mismatch when loading weights from file #5

bastianspirek opened this issue Jan 4, 2025 · 0 comments

Comments

@bastianspirek
Copy link

When running main.py I get the following error:

ValueError: Layer count mismatch when loading weights from file. Model expected 29 layers, found 30 saved layers.

I checked if I can reproduce the error when removing all other code and simply trying to load the model, and it still occurs:

from keras.models import load_model
from utils import GlobalWeightedAveragePooling2D

model_filepath = 'Melnyk-Net.hdf5'

model = load_model(model_filepath, custom_objects={"GlobalWeightedAveragePooling2D": GlobalWeightedAveragePooling2D})
model.summary()

I'm running Python 3.12. Thanks for the help!

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

1 participant