this error happened everytime i run main.py
Traceback (most recent call last):
File "/home/mohamed/SUSTechPOINTS/main.py", line 21, in
from algos import pre_annotate
File "/home/mohamed/SUSTechPOINTS/algos/pre_annotate.py", line 23, in
rotation_model = tf.keras.models.load_model(model_file)
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 189, in load_model
return legacy_h5_format.load_model_from_hdf5(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 133, in load_model_from_hdf5
model = saving_utils.model_from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
return serialization.deserialize_keras_object(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 495, in deserialize_keras_object
deserialized_obj = cls.from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/models/model.py", line 521, in from_config
return functional_from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/models/functional.py", line 477, in functional_from_config
process_layer(layer_data)
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/models/functional.py", line 457, in process_layer
layer = saving_utils.model_from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
return serialization.deserialize_keras_object(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 473, in deserialize_keras_object
(cls, cls_config) = class_and_config_for_serialized_keras_object(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 354, in class_and_config_for_serialized_keras_object
raise ValueError(
ValueError: Unknown layer: 'TensorFlowOpLayer'. Please ensure you are using a keras.utils.custom_object_scope and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.
i think it is due versions error but i have upgraded both i have now
tensorflow version 2.16.2
tf.keras version 3.4.1
For anyone having the same error I have solved it by uninstalling TF and download TF version 2.10.0, after install it makes sure that both TF version and tf.Keras version are the same == 2.10.0
this error happened everytime i run main.py Traceback (most recent call last): File "/home/mohamed/SUSTechPOINTS/main.py", line 21, in
from algos import pre_annotate
File "/home/mohamed/SUSTechPOINTS/algos/pre_annotate.py", line 23, in
rotation_model = tf.keras.models.load_model(model_file)
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 189, in load_model
return legacy_h5_format.load_model_from_hdf5(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 133, in load_model_from_hdf5
model = saving_utils.model_from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
return serialization.deserialize_keras_object(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 495, in deserialize_keras_object
deserialized_obj = cls.from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/models/model.py", line 521, in from_config
return functional_from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/models/functional.py", line 477, in functional_from_config
process_layer(layer_data)
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/models/functional.py", line 457, in process_layer
layer = saving_utils.model_from_config(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
return serialization.deserialize_keras_object(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 473, in deserialize_keras_object
(cls, cls_config) = class_and_config_for_serialized_keras_object(
File "/home/mohamed/.local/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 354, in class_and_config_for_serialized_keras_object
raise ValueError(
ValueError: Unknown layer: 'TensorFlowOpLayer'. Please ensure you are using a
keras.utils.custom_object_scope
and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.i think it is due versions error but i have upgraded both i have now tensorflow version 2.16.2 tf.keras version 3.4.1