imagenet_eval.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright 2016 Google Inc. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ==============================================================================
  15. """A binary to evaluate Inception on the flowers data set.
  16. Note that using the supplied pre-trained inception checkpoint, the eval should
  17. achieve:
  18. precision @ 1 = 0.7874 recall @ 5 = 0.9436 [50000 examples]
  19. See the README.md for more details.
  20. """
  21. from __future__ import absolute_import
  22. from __future__ import division
  23. from __future__ import print_function
  24. import tensorflow as tf
  25. from inception import inception_eval
  26. from inception.imagenet_data import ImagenetData
  27. FLAGS = tf.app.flags.FLAGS
  28. def main(unused_argv=None):
  29. dataset = ImagenetData(subset=FLAGS.subset)
  30. assert dataset.data_files()
  31. if tf.gfile.Exists(FLAGS.eval_dir):
  32. tf.gfile.DeleteRecursively(FLAGS.eval_dir)
  33. tf.gfile.MakeDirs(FLAGS.eval_dir)
  34. inception_eval.evaluate(dataset)
  35. if __name__ == '__main__':
  36. tf.app.run()