0
我有一个尺寸为32 * 32 * 3的输入图像,其中3是输入/颜色通道的数量。我正在尝试卷积和最大化结果。输出时尺寸不匹配
spatial_glimpse_layer.py
class SGN(object):
def __init__(self, w=32, filter_size=5, num_filters=96):
self.input_x = tf.placeholder(tf.float32, [None, w, w, 3], name="X_train")
print(self.input_x)
现在在我的控制我传递一个图像到SGN和看到的结果。
controller.py
import read_data
import tensorflow as tf
import numpy as np
import spatial_glimpse_network
data = read_data.read()
img = next(data)
img = np.expand_dims(np.resize(img, (32, 32, 3)), 0)
with tf.Graph().as_default():
sess = tf.Session()
with sess.as_default():
cnn = spatial_glimpse_network.SGN()
sess.run(tf.global_variables_initializer())
pool = sess.run([cnn.input_x], feed_dict={cnn.input_x:img})
print(img.shape)
print(np.array(pool).shape)
输出如下: -
Tensor("X_train:0", shape=(?, 32, 32, 3), dtype=float32)
(1, 32, 32, 3)
(1, 1, 32, 32, 3)
正如我们可以看到,输入是形式的1 * 32 * 32 * 3,其中1 =无批次
不应该最后输出的形式是(1,32,32,3)?
有人可以帮忙吗?
在此先感谢。
谢谢,它的工作:) – wadhwasahil