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