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


Python image_processing.inputs方法代码示例

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


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

示例1: evaluate

# 需要导入模块: from inception import image_processing [as 别名]
# 或者: from inception.image_processing import inputs [as 别名]
def evaluate(dataset):
  """Evaluate model on Dataset for a number of steps."""
  with tf.Graph().as_default():
    # Get images and labels from the dataset.
    images, labels = image_processing.inputs(dataset)

    # Number of classes in the Dataset label set plus 1.
    # Label 0 is reserved for an (unused) background class.
    num_classes = dataset.num_classes() + 1

    # Build a Graph that computes the logits predictions from the
    # inference model.
    logits, _ = inception.inference(images, num_classes)

    # Calculate predictions.
    top_1_op = tf.nn.in_top_k(logits, labels, 1)
    top_5_op = tf.nn.in_top_k(logits, labels, 5)

    # Restore the moving average version of the learned variables for eval.
    variable_averages = tf.train.ExponentialMovingAverage(
        inception.MOVING_AVERAGE_DECAY)
    variables_to_restore = variable_averages.variables_to_restore()
    saver = tf.train.Saver(variables_to_restore)

    # Build the summary operation based on the TF collection of Summaries.
    summary_op = tf.summary.merge_all()

    graph_def = tf.get_default_graph().as_graph_def()
    summary_writer = tf.summary.FileWriter(FLAGS.eval_dir,
                                            graph_def=graph_def)

    while True:
      _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op)
      if FLAGS.run_once:
        break
      time.sleep(FLAGS.eval_interval_secs) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:38,代码来源:inception_eval.py

示例2: evaluate

# 需要导入模块: from inception import image_processing [as 别名]
# 或者: from inception.image_processing import inputs [as 别名]
def evaluate(dataset):
  """Evaluate model on Dataset for a number of steps."""
  with tf.Graph().as_default():
    # Get images and labels from the dataset.
    images, labels, filenames = image_processing.inputs(dataset,batch_size=FLAGS.batch_size)
    # Number of classes in the Dataset label set plus 1.
    # Label 0 is reserved for an (unused) background class.
    num_classes = dataset.num_classes() + 1

    # Build a Graph that computes the logits predictions from the
    # inference model.
    logits, _ = inception.inference(images, num_classes)
    # Calculate predictions.
    #top_1_op = tf.nn.in_top_k(logits, labels, 1)
    top_1_op = tf.argmax(logits, 1)
    #top_1_op = logits
    #top_1_op = tf.nn.softmax(logits)
    
    # Restore the moving average version of the learned variables for eval.
    variable_averages = tf.train.ExponentialMovingAverage(
        inception.MOVING_AVERAGE_DECAY)
    variables_to_restore = variable_averages.variables_to_restore()
    saver = tf.train.Saver(variables_to_restore)


    graph_def = tf.get_default_graph().as_graph_def()

    while True:
      _eval_once(saver, top_1_op, filenames,labels)
      break 
开发者ID:Cyber-Neuron,项目名称:inception_v3,代码行数:32,代码来源:inception_predict.py

示例3: evaluate

# 需要导入模块: from inception import image_processing [as 别名]
# 或者: from inception.image_processing import inputs [as 别名]
def evaluate(dataset):
  """Evaluate model on Dataset for a number of steps."""
  with tf.Graph().as_default():
    # Get images and labels from the dataset.
    images, labels, _ = image_processing.inputs(dataset)

    # Number of classes in the Dataset label set plus 1.
    # Label 0 is reserved for an (unused) background class.
    num_classes = dataset.num_classes() + 1

    # Build a Graph that computes the logits predictions from the
    # inference model.
    logits, _ = inception.inference(images, num_classes)

    # Calculate predictions.
    top_1_op = tf.nn.in_top_k(logits, labels, 1)
    top_5_op = tf.nn.in_top_k(logits, labels, 5)
    
    # Restore the moving average version of the learned variables for eval.
    variable_averages = tf.train.ExponentialMovingAverage(
        inception.MOVING_AVERAGE_DECAY)
    variables_to_restore = variable_averages.variables_to_restore()
    saver = tf.train.Saver(variables_to_restore)

    # Build the summary operation based on the TF collection of Summaries.
    summary_op = tf.merge_all_summaries()

    graph_def = tf.get_default_graph().as_graph_def()
    summary_writer = tf.train.SummaryWriter(FLAGS.eval_dir,
                                            graph_def=graph_def)

    while True:
      _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op)
      if FLAGS.run_once:
        break
      time.sleep(FLAGS.eval_interval_secs) 
开发者ID:Cyber-Neuron,项目名称:inception_v3,代码行数:38,代码来源:inception_eval.py

示例4: evaluate

# 需要导入模块: from inception import image_processing [as 别名]
# 或者: from inception.image_processing import inputs [as 别名]
def evaluate(dataset):
  """Evaluate model on Dataset for a number of steps."""
  with tf.Graph().as_default():
    # Get images and labels from the dataset.
    images, labels = image_processing.inputs(dataset)

    # Number of classes in the Dataset label set plus 1.
    # Label 0 is reserved for an (unused) background class.
    num_classes = dataset.num_classes() + 1

    # Build a Graph that computes the logits predictions from the
    # inference model.
    logits, _ = inception.inference(images, num_classes)

    # Calculate predictions.
    top_1_op = tf.nn.in_top_k(logits, labels, 1)
    top_5_op = tf.nn.in_top_k(logits, labels, 5)

    # Restore the moving average version of the learned variables for eval.
    variable_averages = tf.train.ExponentialMovingAverage(
        inception.MOVING_AVERAGE_DECAY)
    variables_to_restore = variable_averages.variables_to_restore()
    saver = tf.train.Saver(variables_to_restore)

    # Build the summary operation based on the TF collection of Summaries.
    summary_op = tf.merge_all_summaries()

    graph_def = tf.get_default_graph().as_graph_def()
    summary_writer = tf.train.SummaryWriter(FLAGS.eval_dir,
                                            graph_def=graph_def)

    while True:
      _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op)
      if FLAGS.run_once:
        break
      time.sleep(FLAGS.eval_interval_secs) 
开发者ID:awslabs,项目名称:deeplearning-benchmark,代码行数:38,代码来源:inception_eval.py

示例5: evaluate

# 需要导入模块: from inception import image_processing [as 别名]
# 或者: from inception.image_processing import inputs [as 别名]
def evaluate(dataset):
  """Evaluate model on Dataset for a number of steps."""
  with tf.Graph().as_default(), tf.device(FLAGS.device):
  #with tf.Graph().as_default():
    # Get images and labels from the dataset.
    images, labels = image_processing.inputs(dataset)

    # Number of classes in the Dataset label set plus 1.
    # Label 0 is reserved for an (unused) background class.
    if FLAGS.dataset_name == 'imagenet':
      num_classes = dataset.num_classes() + 1
    else:
      num_classes = dataset.num_classes()

    # Build a Graph that computes the logits predictions from the
    # inference model.
    logits, _ = inception.inference(images, num_classes, net=FLAGS.net)

    # Calculate predictions.
    top_1_op = tf.nn.in_top_k(logits, labels, 1)
    top_5_op = tf.nn.in_top_k(logits, labels, 5)

    if FLAGS.restore_avg_var:
      # Restore the moving average version of the learned variables for eval.
      variable_averages = tf.train.ExponentialMovingAverage(
        inception.MOVING_AVERAGE_DECAY)
      variables_to_restore = variable_averages.variables_to_restore()
      saver = tf.train.Saver(variables_to_restore)
      if FLAGS.tower>=0:
        var_dic = {}
        for _name, _var in variables_to_restore.items():
          _var_name = '%s_%d' % (inception.TOWER_NAME, FLAGS.tower) + '/' + _name
          var_dic[_var_name] = _var
        saver = tf.train.Saver(var_dic)
    else:
      saver = tf.train.Saver()
      if FLAGS.tower>=0:
        var_dic = {}
        _vars = tf.global_variables()
        for _var in _vars:
          _var_name = '%s_%d' % (inception.TOWER_NAME, FLAGS.tower) + '/' + _var.op.name
          var_dic[_var_name] = _var
        saver = tf.train.Saver(var_dic)

    # Build the summary operation based on the TF collection of Summaries.
    summaries = tf.get_collection(tf.GraphKeys.SUMMARIES)
    summary_op = tf.summary.merge(summaries)

    last_eval_step = -1
    summary_writer = tf.summary.FileWriter(FLAGS.eval_dir,
      graph=tf.get_default_graph())
    while True:
      last_eval_step = _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op, last_eval_step)
      if FLAGS.run_once:
        break
      time.sleep(FLAGS.eval_interval_secs) 
开发者ID:wenwei202,项目名称:terngrad,代码行数:58,代码来源:inception_eval.py


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