def testRestoredModelPerformance(self):
checkpoint_path = os.path.join(self.get_temp_dir(), 'model.ckpt')
log_dir = os.path.join(self.get_temp_dir(), 'log_dir1/')
# First, save out the current model to a checkpoint:
init_op = tf.group(tf.initialize_all_variables(),
tf.initialize_local_variables())
saver = tf.train.Saver()
with self.test_session() as sess:
sess.run(init_op)
saver.save(sess, checkpoint_path)
# Next, determine the metric to evaluate:
value_op, update_op = slim.metrics.streaming_accuracy(
self._predictions, self._labels)
# Run the evaluation and verify the results:
accuracy_value = slim.evaluation.evaluate_once(
'',
checkpoint_path,
log_dir,
eval_op=update_op,
final_op=value_op)
self.assertAlmostEqual(accuracy_value, self._expected_accuracy)
评论列表
文章目录