github代码
https://github.com/ry/tensorflow-vgg16
https://github.com/machrisaa/tensorflow-vgg
预训练模型地址:
测试代码:
test_vgg16.py
import numpy as np
import tensorflow as tf
import vgg16
import utils
img1 = utils.load_image("./test_data/tiger.jpeg")
img2 = utils.load_image("./test_data/puzzle.jpeg")
batch1 = img1.reshape((1, 224, 224, 3))
batch2 = img2.reshape((1, 224, 224, 3))
fo=open('aa','w')
batch = np.concatenate((batch1, batch2), 0)
with tf.device('/gpu:1'):
with tf.Session() as sess:
images = tf.placeholder("float", [2, 224, 224, 3])
feed_dict = {images: batch}
# vgg = vgg16.Vgg16()
# with tf.name_scope("content_vgg"):
# vgg.build(ima