当前位置: 首页>>代码示例>>Python>>正文


Python model_helpers.apply_clean方法代码示例

本文整理汇总了Python中official.utils.misc.model_helpers.apply_clean方法的典型用法代码示例。如果您正苦于以下问题:Python model_helpers.apply_clean方法的具体用法?Python model_helpers.apply_clean怎么用?Python model_helpers.apply_clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在official.utils.misc.model_helpers的用法示例。


在下文中一共展示了model_helpers.apply_clean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from official.utils.misc import model_helpers [as 别名]
# 或者: from official.utils.misc.model_helpers import apply_clean [as 别名]
def main(_):
  model_helpers.apply_clean(flags.FLAGS)
  with logger.benchmark_context(flags.FLAGS):
    return run(flags.FLAGS) 
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:6,代码来源:ctl_imagenet_main.py

示例2: main

# 需要导入模块: from official.utils.misc import model_helpers [as 别名]
# 或者: from official.utils.misc.model_helpers import apply_clean [as 别名]
def main(_):
  model_helpers.apply_clean(flags.FLAGS)
  with logger.benchmark_context(flags.FLAGS):
    stats = run(flags.FLAGS)
  logging.info('Run stats:\n%s', stats) 
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:7,代码来源:resnet_imagenet_main.py

示例3: main

# 需要导入模块: from official.utils.misc import model_helpers [as 别名]
# 或者: from official.utils.misc.model_helpers import apply_clean [as 别名]
def main(_):
  model_helpers.apply_clean(flags.FLAGS)
  stats = run(flags.FLAGS)
  logging.info('Run stats:\n%s', stats) 
开发者ID:tensorflow,项目名称:models,代码行数:6,代码来源:resnet_imagenet_main.py

示例4: main

# 需要导入模块: from official.utils.misc import model_helpers [as 别名]
# 或者: from official.utils.misc.model_helpers import apply_clean [as 别名]
def main(_):
  model_helpers.apply_clean(FLAGS)
  stats = run(flags.FLAGS)
  logging.info('Run stats:\n%s', stats) 
开发者ID:tensorflow,项目名称:models,代码行数:6,代码来源:mnist_main.py

示例5: run_loop

# 需要导入模块: from official.utils.misc import model_helpers [as 别名]
# 或者: from official.utils.misc.model_helpers import apply_clean [as 别名]
def run_loop(name, train_input_fn, eval_input_fn, model_column_fn,
             build_estimator_fn, flags_obj, tensors_to_log, early_stop=False):
  """Define training loop."""
  model_helpers.apply_clean(flags.FLAGS)
  model = build_estimator_fn(
      model_dir=flags_obj.model_dir, model_type=flags_obj.model_type,
      model_column_fn=model_column_fn,
      inter_op=flags_obj.inter_op_parallelism_threads,
      intra_op=flags_obj.intra_op_parallelism_threads)

  run_params = {
      'batch_size': flags_obj.batch_size,
      'train_epochs': flags_obj.train_epochs,
      'model_type': flags_obj.model_type,
  }

  benchmark_logger = logger.get_benchmark_logger()
  benchmark_logger.log_run_info('wide_deep', name, run_params,
                                test_id=flags_obj.benchmark_test_id)

  loss_prefix = LOSS_PREFIX.get(flags_obj.model_type, '')
  tensors_to_log = {k: v.format(loss_prefix=loss_prefix)
                    for k, v in tensors_to_log.items()}
  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

  # Export the model
  if flags_obj.export_dir is not None:
    export_model(model, flags_obj.model_type, flags_obj.export_dir,
                 model_column_fn) 
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:54,代码来源:wide_deep_run_loop.py


注:本文中的official.utils.misc.model_helpers.apply_clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。