def evaluate():
"""Eval BBBC006 for a number of steps."""
with tf.Graph().as_default() as g:
# Get images and labels for BBBC006.
eval_data = FLAGS.eval_data == 'test'
images, labels = bbbc006.inputs(eval_data=eval_data)
# Build a Graph that computes the logits predictions from the
# inference model.
c_fuse, s_fuse = bbbc006.inference(images, train=False)
dice_op = bbbc006.dice_op(c_fuse, s_fuse, labels)
# Restore the moving average version of the learned variables for eval.
variable_averages = tf.train.ExponentialMovingAverage(
bbbc006.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()
summary_writer = tf.summary.FileWriter(FLAGS.eval_dir, g)
while True:
eval_once(saver, dice_op, summary_writer, summary_op)
if FLAGS.run_once:
break
time.sleep(FLAGS.eval_interval_secs)
评论列表
文章目录