我看过这博客文章,其中描述了如何使用谷歌的图像分类模型“盗梦空间”( Inception V3 )在图像中定位对象。
我们可以将8x8x2048表示理解为特征网格,将图像分解为8个水平网格和8个垂直网格方块。
有人能解释我如何在python中访问8x8x2048层的初始空间吗?然后使用1x1卷积将每个向量映射到类标签上?
谢谢!
发布于 2016-11-17 06:36:34
tensorflow回购中的初始模型调用inception.slim.inception_v3函数,在其中您需要修改网络这里,以便为1x1卷积再添加一个层。
更改非常小,您只需遵循它构造其他层的方式即可。简单地说,这一层应该是:
net = ops.conv2d(net, 2048, [1, 1])发布于 2017-06-09 15:02:19
我发现你可以买到8x8x2048
with tf.Session(config=config) as sess:
tensor = sess.graph.get_tensor_by_name('mixed_10/join:0')
for image_to_test in os.listdir(directory):
image = os.path.join(directory, image_to_test)
with tf.gfile.FastGFile(image, 'rb') as f:
image_data = f.read()
decoded={'DecodeJpeg/contents:0': image_data}
predictions = sess.run(tensor, decoded)预测现在有了8x8x2048
然而,我还没有弄清楚如何从"2048“值中得到一个类。
我在努力
import tensorflow.contrib.slim as slim
predictions = sess.run(tensor, decoded)
ppp= slim.conv2d(predictions,2048,[1,1])
x=tf.unstack(ppp)但这会给出一个张量
张量(“Conv/Relu:0”,shape=(1,8,8,2048),dtype=float32,设备=/设备:CPU:0)
https://stackoverflow.com/questions/40633164
复制相似问题