我已经从此library实现了roi_pooling。
以roi_pooling身份运行
conv5_3 = net.end_points['conv5_3']
#implement ROI Pooling
input_boxes=tf.dtypes.cast(input_boxes,tf.int32)
pooled_features = roi_pooling(conv5_3, input_boxes, pool_height=5, pool_width=30)
然后pooled_features的形状未知。
(Pdb) p pooled_features
<tf.Tensor 'RoiPooling:0' shape=<unknown> dtype=float32>
我的网络在roi_pooling之后仍然需要通过另一个识别网络。
识别网是
def recognitionnet(inputs, fatness = 64, dilation = True):
"""
backbone net of vgg16
"""
# End_points collect relevant activations for external use.
end_points = {}
# Original VGG-16 blocks.
with slim.arg_scope([slim.conv2d, slim.max_pool2d], padding='SAME'):
# Block1
net = slim.repeat(inputs, 2, slim.conv2d, fatness, [3, 3], scope='conv1')
end_points['conv1_2'] = net
net = slim.max_pool2d(net, [2, 2], scope='pool1')
end_points['pool1'] = net
# Block 2.
net = slim.repeat(net, 2, slim.conv2d, fatness * 2, [3, 3], scope='conv2')
end_points['conv2_2'] = net
net = slim.max_pool2d(net, [2, 2], scope='pool2')
end_points['pool2'] = net
# fc7 as conv
net = slim.conv2d(net, fatness * 16, [1, 1], scope='fc7')
end_points['fc7'] = net
#model_summary()
#from keras.utils.visualize_util import plot
#plot(model, to_file='model.png')
return net, end_points;
但是当pooled_features通过识别网的第一层时,我的错误为
TypeError: TypeErro...neType',)
pooled_features通过net = slim.repeat(inputs, 2, slim.conv2d, fatness, [3, 3], scope='conv1')
传递时可能会出问题。
我该如何解决这个问题?
答案 0 :(得分:0)
我所做的是将两个图分开。 第一个图具有roi_poling实现,第二个图具有识别网。
由于识别网位于单独的图中,因此我们可以使用placeholder
作为识别网图的输入。