titu1994 / keras-coordconv

Keras implementation of CoordConv for all Convolution layers
MIT License
148 stars 33 forks source link

Error while using CoordinateChannel2D. #11

Open lewisazhe opened 5 years ago

lewisazhe commented 5 years ago

Hi, I am using the following code ip = Input(shape=(224, 224, 3)) x = CoordinateChannel2D()(ip) When i try to train the model. I got the following error: Traceback (most recent call last): File "train.py", line 288, in train(args)
File "train.py", line 241, in train model = SegNet(n_label, input_height=img_h, input_width=img_w)
File "train.py", line 169, in SegNet x = CoordinateChannel2D()(ip)#data_format="channels_last" File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/keras/engine/topology.py", line 603, in call output = self.call(inputs, kwargs) File "/home/azhe/projects/kinect/coord.py", line 92, in call xx_ones = K.ones(K.stack([batch_shape, dim2]), dtype='int32') File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 708, in ones return variable(tf.constant_initializer(1., dtype=tf_dtype)(shape), File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow/python/ops/init_ops.py", line 203, in call verify_shape=verify_shape) File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 373, in make_tensor_proto if shape is not None and np.prod(shape, dtype=np.int64) == 0: File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2498, in prod out=out, kwargs) File "/home/azhe/anaconda3/envs/python3/lib/python3.6/site-packages/numpy/core/_methods.py", line 35, in _prod return umr_prod(a, axis, dtype, out, keepdims) ValueError: setting an array element with a sequence. Can you help me to solve this error? Thankyou