# 引入模块
import Vgg_utils
import numpy as np
import tensorflow as tf
from nets import Vgg_

# 读取图片
img1 = Vgg_utils.load_image("./test_date/dog.jpg")
# 将图片进行 resize 使其 shope 满足（-1,224,224,3）
inputs = tf.placeholder(tf.float32, [None, None, 3])
resize_img = Vgg_utils.reize_image(input, 224, 224)
# 建立网络结构
predictions = Vgg_.Vgg_16(resize_img)
# 载入模型
sess = tf.Session()
ckpt_filname = './model/vgg16.ckpt'
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, ckpt_filname)
# 对结果进行 softmax 预测
pro = tf.softmax(predictions)
pre = sess.run(pro, feed_dict={inputs: img1})
# 输出预测结果
print("result:")
Vgg_utils.print_prob[0], './synset.txt'

1fc9c9eb5b9ef1907cb5172942a430c11d384396
<mask token>

<mask token>
sess.run(tf.global_variables_initializer())
<mask token>
saver.restore(sess, ckpt_filname)
<mask token>
print('result:')
Vgg_utils.print_prob[0], './synset.txt'

<mask token>
img1 = Vgg_utils.load_image('./test_date/dog.jpg')
inputs = tf.placeholder(tf.float32, [None, None, 3])
resize_img = Vgg_utils.reize_image(input, 224, 224)
predictions = Vgg_.Vgg_16(resize_img)
sess = tf.Session()
ckpt_filname = './model/vgg16.ckpt'
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, ckpt_filname)
pro = tf.softmax(predictions)
pre = sess.run(pro, feed_dict={inputs: img1})
print('result:')
Vgg_utils.print_prob[0], './synset.txt'

import Vgg_utils
import numpy as np
import tensorflow as tf
from nets import Vgg_
img1 = Vgg_utils.load_image('./test_date/dog.jpg')
inputs = tf.placeholder(tf.float32, [None, None, 3])
resize_img = Vgg_utils.reize_image(input, 224, 224)
predictions = Vgg_.Vgg_16(resize_img)
sess = tf.Session()
ckpt_filname = './model/vgg16.ckpt'
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, ckpt_filname)
pro = tf.softmax(predictions)
pre = sess.run(pro, feed_dict={inputs: img1})
print('result:')
Vgg_utils.print_prob[0], './synset.txt'

# 引入模块
import Vgg_utils
import numpy as np
import tensorflow as tf
from nets import Vgg_

# 读取图片
img1 = Vgg_utils.load_image("./test_date/dog.jpg")
# 将图片进行 resize 使其 shope 满足（-1,224,224,3）
inputs = tf.placeholder(tf.float32, [None, None, 3])
resize_img = Vgg_utils.reize_image(input, 224, 224)
# 建立网络结构
predictions = Vgg_.Vgg_16(resize_img)
# 载入模型
sess = tf.Session()
ckpt_filname = './model/vgg16.ckpt'
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, ckpt_filname)
# 对结果进行 softmax 预测
pro = tf.softmax(predictions)
pre = sess.run(pro, feed_dict={inputs: img1})
# 输出预测结果
print("result:")
Vgg_utils.print_prob[0], './synset.txt'
