Tensorflow: restoring a graph and model then running evaluation on a single image

前端 未结 4 1412
后悔当初
后悔当初 2020-12-07 10:32

I think it would be immensely helpful to the Tensorflow community if there was a well-documented solution to the crucial task of testing a single new image against the model

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 10:55

    got it working with this

    softmax = gn.inference(image)
    saver = tf.train.Saver()
    ckpt = tf.train.get_checkpoint_state(FLAGS.checkpoint_dir)
    with tf.Session() as sess:
      saver.restore(sess, ckpt.model_checkpoint_path)
      softmaxval = sess.run(softmax)
      print(softmaxval)
    

    output

    [[  6.73550041e-03   4.44930716e-04   9.92570221e-01   1.00681427e-06
        3.05406687e-08   2.38927707e-04   1.89839399e-12   9.36238484e-06
        1.51646684e-09   3.38977535e-09]]
    

提交回复
热议问题