简体   繁体   English

加载和检查 Keras 序列模型的总损失/验证准确性

[英]Load and Check Total Loss / Validation accuracy of Keras Sequential Model

I didn't find any answers to the following question:我没有找到以下问题的任何答案:

Is there a way to print the trained model accuracy, total model loss and model evaluation accuracy after loading the saved trained Keras model?加载保存的训练好的 Keras 模型后,有没有办法打印训练后的模型准确度、模型总损失和模型评估准确度?

from keras.models import load_model
m = load_model.load("lstm_model_01.hd5") 

I checked all the callable methods of m but didn't find what I was looking for.我检查了m所有可调用方法,但没有找到我要找的东西。

Model is really a graph with weights and that's all that gets saved.模型实际上是一个带有权重的图,这就是保存的全部内容。 You have to evaluate the restored model on data to get predictions and from that you'll obtain an accuracy.您必须在数据上评估恢复的模型以获得预测,并从中获得准确性。

Pleas save your model fit results as follows:请按如下方式保存您的模型拟合结果:

history = model.fit(input_train, y_train,
                    epochs=10,
                    batch_size=128,
                    validation_split=0.2)

And use pickle to dump it (ie history) out.并使用泡菜将其(即历史)转储出来。 There you will see the training loss or validation accuracy from the model.在那里,您将看到模型的训练损失或验证准确性。 You can load it back anytime.您可以随时加载它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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