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

TypeError: Could not locate class 'Sequential' #3

Closed
keveinliu opened this issue Jun 9, 2024 · 1 comment
Closed

TypeError: Could not locate class 'Sequential' #3

keveinliu opened this issue Jun 9, 2024 · 1 comment

Comments

@keveinliu
Copy link

Greetings,

Thanks for sharing!
I'm using this repo, and I got the following error:

TypeError: Could not locate class 'Sequential'. Make sure custom classes are decorated with `@keras.saving.register_keras_serializable()`. Full object config: {'class_name': 'Sequential', 'config': {'name': 'sequential', 'layers': [{'class_name': 'Conv2D', 'config': {'name': 'conv2d', 'trainable': True, 'batch_input_shape': [None, 48, 48, 1], 'dtype': 'float32', 'filters': 64, 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'activation': 'linear', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'BatchNormalization', 'config': {'name': 'batch_normalization', 'trainable': True, 'dtype': 'float32', 'axis': [3], 'momentum
...omitted....

And my tf version is tensorflow-2.16.1.
Is the version incompatible with your code?
Thank you!

@dipsikhade
Copy link
Owner

Hey!

The tensorflow version which was used to train the model is 2.10 .0, ever since 2.16 was introduced , tensorflow uses keras 3 instead of keras 2. To check the differences between them, you can look through this link!

If you want the code to work, you will need to retrain the model with the current keras version. Hope this helps!

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

2 participants