Keras Error

DenseNet gives this error
TypeError: <class ‘keras.src.layers.convolutional.conv2d.Conv2D’> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by get_config() are explicitly deserialized in the model’s from_config() method.

and Mobilenet gives this error
TypeError: <class ‘keras.src.layers.normalization.batch_normalization.BatchNormalization’> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by get_config() are explicitly deserialized in the model’s from_config() method.


Hi @AnkushMallick and welcome to the Streamlit community! :raised_hands:

May I just check that you’ve verified the versions of Keras and TensorFlow to ensure they are compatible with the model you’re trying to load? If there have been any recent upgrades or version changes, that could be the cause of that problem.

Best,
Charly

I have figured the problem. This error arises because of the version. I have downgraded the version of both keras and tensorflow to 2.15.0. After doing this, the website works perfectly.

Glad it sorted the issue you were facing, @AnkushMallick! :raised_hands:

Happy Streamlining! :balloon:

Charly

Hey can you tell me where did you downgrade the versions in model training or in streamlit??And also i cant afford to retrain the model with downgraded versions again as I have no time to do it so what should i do now??

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.