tensorflow版本:1.4.0 python版本:2.7
def build_detection(self): self.embeds,self.embeds1 = self.get_image_embedding(self.search_images,重用= True) 使用tf.variable_scope('detection'): def _translation_match(x,z): x = tf.expand_dims(x,0)#[批处理,in_height,in_width,in_channels] z = tf.expand_dims(z,-1)#[filter_height,filter_width,in_channels,out_channels] 返回tf.nn.conv2d(x,z,strides = [1,1,1,1],padding ='VALID',name ='translation_match')
output = tf.map_fn(
lambda x: _translation_match(x[0], x[1]),
(self.embeds, self.templates), dtype=self.embeds.dtype) # of shape [16, 1, 17, 17, 1]
output = tf.squeeze(output, [1, 4]) # of shape e.g. [16, 17, 17]
output1 = tf.map_fn(
lambda x: _translation_match(x[0], x[1]),
(self.embeds1, self.templates1), dtype=self.embeds1.dtype) # of shape [16, 1, 17, 17, 1]
output1 = tf.squeeze(output1, [1, 4])
bias = tf.get_variable('biases', [1],
dtype=tf.float32,
initializer=tf.constant_initializer(0.0, dtype=tf.float32),
trainable=False)
response = self.model_config['adjust_response_config']['scale'] * output + bias
response1 = self.model_config['adjust_response_config']['scale'] * output1 + bias
self.response = response, self.response1 = response1
restore_fn = model.build_graph_from_config(model_config,track_config,检查点) 文件“ /home/xieyangyang/Downloads/SiamFC-TensorFlow-master/scripts/inference/inference_wrapper.py”,第51行,位于build_graph_from_config中 self.build_model(model_config,track_config) 在build_model中的文件“ /home/xieyangyang/Downloads/SiamFC-TensorFlow-master/scripts/inference/inference_wrapper.py”,第82行 self.build_detection() 在build_detection中的文件“ /home/xieyangyang/Downloads/SiamFC-TensorFlow-master/scripts/inference/inference_wrapper.py”中,第229行 self.response =响应,self.response1 = response1 在 iter 中的第505行中的文件“ /home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/tensorflow/python/framework/ops.py” 引发TypeError(“'Tensor'对象不可迭代。”) TypeError:“张量”对象不可迭代。