简体   繁体   中英

Saving model with description in keras

I would like to write out a keras model that contains a description (can be a simple string), so that one can more easily keep track of what a file contains.

Is there any simple way to do this? I can save and load a model with

model.save(filename)
[...]
model = keras.load_model(filename)

what I would like to do, is something to the effect of

model.save(filename, description=string)
[...]
model, description = keras.load_model(filename)

Any ideas on what would be the simplest way of achieving this?

Currently, there is no way to do this with the current version of model.save in the Keras. It just saves the configuration of the model() such as loss function and metrics and load_model just returns what has been saved.

One nasty solution to this problem is manually adding a description variable to the class models.py in Keras and consequently, add the required lines of code to the save_model and load_model functions. Again, this is just a horrible solution!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM