【问题标题】:tensorflow tensorflow.contrib.learn.Estimator load trained modeltensorflow tensorflow.contrib.learn.Estimator 负载训练模型
【发布时间】:2017-04-21 04:11:33
【问题描述】:

在我这样调用这个函数之后:

    from tensorflow.contrib import learn
    #----------------------------------------
    #Do some process here
    #----------------------------------------
    classifier = learn.Estimator(model_fn=bag_of_words_model,model_dir='F:/data')
    classifier.fit(feature_train, target_train, steps=1000)

我的文件夹“F:/data”中会有一些文件,如下所示

我想知道我是否有重用这个模型?就像移动到新计算机并使用它来预测新数据一样。对不起,我的英语不好。感谢所有的答案!!希望大家度过愉快的一天。

【问题讨论】:

  • 请在此处粘贴图片
  • 我没有足够的声誉,很抱歉给您带来不便,先生您能帮我解决这个问题吗?

标签: python-3.x tensorflow


【解决方案1】:

在要重用模型的脚本中,再次重新定义/导入bag_of_words_model 并定义

classifier_loaded = learn.Estimator(model_fn=bag_of_words_model, model_dir='F:/data')

Tensorflow 将重新加载图表并将权重导入图表,您可以将其用作

classifier_loaded.predict(input_fn=input_fn)

或继续训练

claissifier_loaded.fit(feature_train, target_train)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-16
    • 1970-01-01
    • 1970-01-01
    • 2020-01-03
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多