张量流的广泛和深入模型中的评估代码理解

时间:2018-07-25 03:35:36

标签: python tensorflow deep-learning

在培训和评估代码部分。 ({Complete code参见此处):

<dependencies>
    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20180130</version>
    </dependency>
    </dependencies>

JSONObject cannot be resolved to a type
The import org.json cannot be resolved

我有2个问题:

    train_hooks = hooks_helper.get_train_hooks( flags_obj.hooks, model_dir=flags_obj.model_dir, batch_size=flags_obj.batch_size, tensors_to_log=tensors_to_log) # Train and evaluate the model every `flags.epochs_between_evals` epochs. for n in range(flags_obj.train_epochs // flags_obj.epochs_between_evals): model.train(input_fn=train_input_fn, hooks=train_hooks) results = model.evaluate(input_fn=eval_input_fn) # Display evaluation metrics tf.logging.info('Results at epoch %d / %d', (n + 1) * flags_obj.epochs_between_evals, flags_obj.train_epochs) tf.logging.info('-' * 60) for key in sorted(results): tf.logging.info('%s: %s' % (key, results[key])) benchmark_logger.log_evaluation_result(results) if early_stop and model_helpers.past_stop_threshold( flags_obj.stop_threshold, results['accuracy']): break
  1. 默认设置为2,但是如何在训练后每2个时期评估1个时代?显然每个epochs_between_evals之后有一个model.evaluate(),不是吗?
    也许model.train()控制着train_hooks中的内容每隔两个纪元中断一次,但是model.train()的参数不包含train_hooksnum_epochs。我有点困惑。

  2. epochs_between_evals的实际作用是什么?当我检查源代码时,似乎只是获得评估输出的转发途径。还有其他工作吗?

0 个答案:

没有答案