當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。