有两处报错位置,如下:
if __name__ == '__main__':
ssd = SSDNet()
ssd.net(tf.compat.v1.placeholder(dtype=tf.float32, shape=[5, 304, 304, 3]))
ssd = SSDNet()
predictions, localisations, _, _ =\
ssd.net(image_4d, is_training=False)
相关代码,如下:
def net(self, input_data, weight_decay, update_feat_shapes=True, is_training=True):
with slim.arg_scope(self._ssd_arg_scope(weight_decay)):
output = self._ssd_net(input_data, is_training=is_training)
# Update feature shapes (try at least!)
if update_feat_shapes:
feat_shapes = []
# 获取各个中间层shape(不含0维),如果含有None则返回默认的feat_shapes
for l in output[0]:
if isinstance(l, np.ndarray):
shape = l.shape
else:
shape = l.get_shape().as_list()
shape = shape[1:4]
if None in shape:
feat_shapes = self.params.feat_shapes
break
else:
feat_shapes.append(shape)
self.params = self.params._replace(feat_shapes=feat_shapes)
sys.stdout.write('[*] Report: variable feat_shapes is {}\n'.format(self.params.feat_shapes))
return output
# ssd的网络结构
def _ssd_net(self, inputs,
scope='ssd_net',
reuse=False,
is_training=True,
dropout_keep_prob=0.5):
with tf.compat.v1.variable_scope(scope, 'ssd_net', [inputs], reuse=reuse) as sc:
end_points_collection = sc.original_name_scope + '_end_points'
请问我要如何改正两处报错位置,才能正常运行。谢谢!