我一直试图在完全卷积神经网络的基础上试验这个semantic segmentation code。但是,运行此代码会生成由
引起的以下错误消息fcn32model = fcn32_blank(image_size)
我没有更改代码中的任何内容,并且对于导致此错误的原因感到困惑。
Using Theano backend.
Traceback (most recent call last):
File "train.py", line 20, in <module>
fcn32model = fcn32_blank(image_size)
File "/home/FCN/fcn16s/utils.py", line 78, in fcn32_blank
(extra_margin/2, extra_margin/2))) ) # INFO : cropping as deconv gained pixels
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/Keras-1.2.1-py3.4.egg/keras/models.py", line 332, in add
output_tensor = layer(self.outputs[0])
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/Keras-1.2.1-py3.4.egg/keras/engine/topology.py", line 572, in __call__
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/Keras-1.2.1-py3.4.egg/keras/engine/topology.py", line 635, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/Keras-1.2.1-py3.4.egg/keras/engine/topology.py", line 166, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/Keras-1.2.1-py3.4.egg/keras/layers/convolutional.py", line 1817, in call
self.cropping[1][0]:-self.cropping[1][1]]
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/tensor/var.py", line 540, in __getitem__
return theano.tensor.subtensor.advanced_subtensor(self, *args)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/gof/op.py", line 604, in __call__
node = self.make_node(*inputs, **kwargs)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/tensor/subtensor.py", line 2140, in make_node
index = tuple(map(as_index_variable, index))
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/tensor/subtensor.py", line 2081, in as_index_variable
return make_slice(idx)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/gof/op.py", line 604, in __call__
node = self.make_node(*inputs, **kwargs)
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/tensor/type_other.py", line 39, in make_node
list(map(as_int_none_variable, inp)),
File "/devl/tensorflow/tf_0.12/lib/python3.4/site-packages/theano/tensor/type_other.py", line 20, in as_int_none_variable
raise TypeError('index must be integers')
TypeError: index must be integers
答案 0 :(得分:-1)
将其转换为int
:
(int(extra_margin/2), int(extra_margin/2))