Fix final eval bottleneck creation to work in cases where it isn't cached already.
authorSuharsh Sivakumar <suharshs@google.com>
Thu, 5 Apr 2018 18:36:43 +0000 (11:36 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 5 Apr 2018 18:39:03 +0000 (11:39 -0700)
Fixes #17423

PiperOrigin-RevId: 191773001

tensorflow/examples/image_retraining/retrain.py

index 99a7120..fcc1912 100644 (file)
@@ -870,15 +870,16 @@ def run_final_eval(sess, model_info, class_count, image_lists, jpeg_data_tensor,
     resized_image_tensor: The input node of the recognition graph.
     bottleneck_tensor: The bottleneck output layer of the CNN graph.
   """
-  (sess, bottleneck_input, ground_truth_input, evaluation_step,
-   prediction) = build_eval_session(model_info, class_count)
-
   test_bottlenecks, test_ground_truth, test_filenames = (
       get_random_cached_bottlenecks(sess, image_lists, FLAGS.test_batch_size,
                                     'testing', FLAGS.bottleneck_dir,
                                     FLAGS.image_dir, jpeg_data_tensor,
                                     decoded_image_tensor, resized_image_tensor,
                                     bottleneck_tensor, FLAGS.architecture))
+
+  (sess, bottleneck_input, ground_truth_input, evaluation_step,
+   prediction) = build_eval_session(model_info, class_count)
+
   test_accuracy, predictions = sess.run(
       [evaluation_step, prediction],
       feed_dict={