test.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:facial-emotion-detection-dl 作者: dllatas 项目源码 文件源码
def test():
    with tf.Graph().as_default():
        image, label = input.get_input(LABEL_PATH, LABEL_FORMAT, IMAGE_PATH, IMAGE_FORMAT)
        logits = model.inference(image)
        top_k_op = tf.nn.in_top_k(logits, label, 1)

        variable_averages = tf.train.ExponentialMovingAverage(MOVING_AVERAGE_DECAY)
        variables_to_restore = variable_averages.variables_to_restore()
        saver = tf.train.Saver(variables_to_restore)

        # Get summaries for TENSOR BOARD
        summary_op = tf.merge_all_summaries()
        graph_def = tf.get_default_graph().as_graph_def()
        summary_writer = tf.train.SummaryWriter(input.FLAGS.eval_dir, graph_def=graph_def)

        while True:
            evaluate_model(saver, summary_writer, top_k_op, summary_op)
            if input.FLAGS.run_once:
                break
            time.sleep(input.FLAGS.eval_interval_secs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号