vgsl_eval.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright 2016 The TensorFlow Authors. 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. """Model eval separate from training."""
  16. from tensorflow import app
  17. from tensorflow.python.platform import flags
  18. import vgsl_model
  19. flags.DEFINE_string('eval_dir', '/tmp/mdir/eval',
  20. 'Directory where to write event logs.')
  21. flags.DEFINE_string('graph_def_file', None,
  22. 'Output eval graph definition file.')
  23. flags.DEFINE_string('train_dir', '/tmp/mdir',
  24. 'Directory where to find training checkpoints.')
  25. flags.DEFINE_string('model_str',
  26. '1,150,600,3[S2(4x150)0,2 Ct5,5,16 Mp2,2 Ct5,5,64 Mp3,3'
  27. '([Lrys64 Lbx128][Lbys64 Lbx128][Lfys64 Lbx128])S3(3x0)2,3'
  28. 'Lfx128 Lrx128 S0(1x4)0,3 Do Lfx256]O1c134',
  29. 'Network description.')
  30. flags.DEFINE_integer('num_steps', 1000, 'Number of steps to run evaluation.')
  31. flags.DEFINE_integer('eval_interval_secs', 60,
  32. 'Time interval between eval runs.')
  33. flags.DEFINE_string('eval_data', None, 'Evaluation data filepattern')
  34. flags.DEFINE_string('decoder', None, 'Charset decoder')
  35. FLAGS = flags.FLAGS
  36. def main(argv):
  37. del argv
  38. vgsl_model.Eval(FLAGS.train_dir, FLAGS.eval_dir, FLAGS.model_str,
  39. FLAGS.eval_data, FLAGS.decoder, FLAGS.num_steps,
  40. FLAGS.graph_def_file, FLAGS.eval_interval_secs)
  41. if __name__ == '__main__':
  42. app.run()