[英]Trained model cannot be saved tensorflow keras
I cannot save a trained model in tensorflow我无法在 tensorflow 中保存经过训练的 model
i have fitted data我已经拟合了数据
results = model.fit_generator(train_image_gen,epochs=20,validation_data=test_image_gen,callbacks=early_stop)
and imported并进口
from tensorflow.keras.models import load_model
and written a code like this并写了这样的代码
save1= results.history
save1.save('model.h5')
but it throws an error like this但它会引发这样的错误
AttributeError Traceback (most recent call last)
<ipython-input-47-13cfa06fe0cd> in <module>
----> 1 save1.save('model.h5')
AttributeError: 'dict' object has no attribute 'save'
i can't figure out what to do to save this model please also help me how to save this in yaml file我不知道该怎么做才能保存这个 model 请也帮助我如何将它保存在 yaml 文件中
ps:-i am working on kaggle ps:-我正在研究 kaggle
when saving model in TensorFlow
.在 TensorFlow 中保存
TensorFlow
时。 You call the save
method on the model it's self not on the history
object returned from fit or fit_generator
.您在 model 上调用
save
方法,它本身不在从fit or fit_generator
返回的history
object 上。
Kindly use this请用这个
model.save('model.h5')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.