You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from tensorflow import keras
new_model = keras.models.load_model('yolo4_weight.h5')
Error occurred:
Traceback (most recent call last):
File "/home/source/keras-yolo4/mytest.py", line 13, in <module>
new_model = keras.models.load_model(h5)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/saving/save.py", line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 212, in load_model_from_hdf5
custom_objects=custom_objects)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/saving/model_config.py", line 55, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
printable_module_name='layer')
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
list(custom_objects.items())))
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1121, in from_config
process_layer(layer_data)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1105, in process_layer
layer = deserialize_layer(layer_data, custom_objects=custom_objects)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
printable_module_name='layer')
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 181, in deserialize_keras_object
config, module_objects, custom_objects, printable_module_name)
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 166, in class_and_config_for_serialized_keras_object
raise ValueError('Unknown ' + printable_module_name + ': ' + class_name)
ValueError: Unknown layer: Mish
The text was updated successfully, but these errors were encountered:
shangdibufashi
changed the title
"Unknown layer: Mish" while converting to loading model from yolo4_weight.h5
"Unknown layer: Mish" while loading converted model from "yolo4_weight.h5"
Apr 29, 2020
You can try the following code:
import keras
from yolo4.model import Mish
mish = Mish()
infer_model = keras.models.load_model('yolo4_weight.h5',custom_objects={'Mish': mish})
Source code
Error occurred:
The text was updated successfully, but these errors were encountered: