Tensorflow loads the h5 model and reports an error

Error content

ValueError: Could not interpret optimizer identifier: <tensorflow.python.keras.optimizer_v2.adam.Adam object at 0x000001FB758CCA30>

the code 

 The reason for the error is that this version of TensorFlow and Keras are under tensorflow.python  , and there is no tf.keras path, which causes the python interpreter to directly use the model.load_model under Keras to load the module, resulting in different versions of optimizer and load_model

solution

Just declare the two paths clearly.

 
 

 

Guess you like

Origin blog.csdn.net/qq_35326529/article/details/127153319