Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
tensorflow-如何打印和书写;“预测”;归档?_Tensorflow_Deep Learning - Fatal编程技术网

tensorflow-如何打印和书写;“预测”;归档?

tensorflow-如何打印和书写;“预测”;归档?,tensorflow,deep-learning,Tensorflow,Deep Learning,我尝试了很多方法,但我无法打印或写“预测”。 我想打印模型的测试结果(“预测”)并将其写入aaa.txt,以及如何打印 代码,请参阅: 谢谢。嗨,你找到解决办法了吗?因为我也有同样的问题。谢谢 with tf.Graph().as_default(): ............. ............. ............. image = image_preprocessing_fn(image, eval_image_size, eval_image

我尝试了很多方法,但我无法打印或写“预测”。 我想打印模型的测试结果(“预测”)并将其写入aaa.txt,以及如何打印

代码,请参阅:


谢谢。

嗨,你找到解决办法了吗?因为我也有同样的问题。谢谢
with tf.Graph().as_default():
    .............
    .............
    .............
    image = image_preprocessing_fn(image, eval_image_size, eval_image_size)

    images, labels = tf.train.batch(
        [image, label],
        batch_size=FLAGS.batch_size,
        num_threads=FLAGS.num_preprocessing_threads,
        capacity=5 * FLAGS.batch_size)

    logits, _ = network_fn(images)
    predictions = tf.argmax(logits, 1) ######this predictions!!!!!!!!!!!!!!
    labels = tf.squeeze(labels)

    # Define the metrics:
    names_to_values, names_to_updates = slim.metrics.aggregate_metric_map({
        'Accuracy': slim.metrics.streaming_accuracy(predictions, labels),
        'Predictions': slim.metrics.streaming_precision(predictions, labels),
        'Recall@5': slim.metrics.streaming_recall_at_k(
            logits, labels, 5)
    })

    # Print the summaries to screen.
    for name, value in names_to_values.iteritems():
      summary_name = 'eval/%s' % name
      op = tf.summary.scalar(summary_name, value, collections=[])
      op = tf.Print(op, [value], summary_name)
      tf.add_to_collection(tf.GraphKeys.SUMMARIES, op)