MATLAB: Getting this error: “Error using importKerasNetwork (line 93) Unable to import layers from file ‘model.h5’ because it contains no ‘model_config’ attribute.”

Deep Learning Toolboxerror using importkerasnetworkunable to import layers from file 'model.h5'

When Iam trying to import a custom model file 'model.h5' created using keras – model.save_weights()
Please help

Best Answer

It's a file that contains weights only, without the architecture. You need to create it using model.save(), not model.save_weights().