如何保存和恢复在 TensorFlow python 中训练的 DNNClassifier;虹膜示例 [英] How to save&restore DNNClassifier trained in TensorFlow python; iris example

查看:29
本文介绍了如何保存和恢复在 TensorFlow python 中训练的 DNNClassifier;虹膜示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 TensorFlow 的新手,几天前才开始学习.我已经完成了本教程(https://www.tensorflow.org/versions/r0.9/tutorials/tflearn/index.html#tf-contrib-learn-quickstart)并将完全相同的想法应用于我自己的数据集.(结果非常好!)

I'm new to TensorFlow, just started learning a few days ago. I've completed this tutorial(https://www.tensorflow.org/versions/r0.9/tutorials/tflearn/index.html#tf-contrib-learn-quickstart) and applied the exact same idea to my own data set. (which came out pretty good!)

现在我想保存并恢复经过训练的 DNNClassifier 以供进一步使用.如果有人知道如何做到这一点,请使用上面链接中的 iris 示例代码让我知道.提前感谢您的帮助!

Now I'd like to save&restore the trained DNNClassifier for further use. If anyone know how to do that, please let me know by using the iris example code in the link above. Thanks for your help in advance!

推荐答案

找到解决方案了吗?如果您没有这样做,您可以在创建 DNNClassifier 时在构造函数上指定 model_dir 参数,这将在此目录中创建所有检查点和文件(保存步骤).当您想要执行恢复步骤时,您只需创建另一个 DNNClassifier 传递相同的 model_dir 参数(恢复阶段),这将从第一次创建的文件中恢复模型.

found the solution to this? In case you didn't you can do this specifying the model_dir parameter on the constructor when creating the DNNClassifier, this will create all the checkpoints and files in this directory(the saving step). When you want to do the restore step, you just create another DNNClassifier passing the same model_dir parameter(restore phase) , this will restore the model from the files created the first time.

希望对你有帮助.

这篇关于如何保存和恢复在 TensorFlow python 中训练的 DNNClassifier;虹膜示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆