D-Nilsson / GRFP

Code for the CVPR 2018 paper "Semantic Video Segmentation by Gated Recurrent Flow Propagation"
MIT License
56 stars 8 forks source link

Is this problem due to tensorflow version? #11

Open wufengbin123 opened 4 years ago

wufengbin123 commented 4 years ago

My server only hava cuda9.0 . Does this mean That I can only use tensorFlow 1.5 and above version? I compiled successfully with tensorFlow1.5,but then when doing evaluating .I meet this problem. I wonder if this problem due to tensorflow version? Anyone use tensorFlow 1.5 and above version run successfully?

Traceback (most recent call last): File "evaluate.py", line 168, in evaluate(args) File "evaluate.py", line 42, in evaluate flow_tensor = flow_network(flow_img0, flow_img1, flip=True) File "/home/wfb/Desktop/GRFR/GRFP/models/flownet2.py", line 28, in call f = self.get_blobs(im0, im1)['predict_flow_final'] File "/home/wfb/Desktop/GRFR/GRFP/models/flownet2.py", line 164, in get_blobs blobs['deconv5'] = tf.nn.conv2d_transpose(blobs['conv6_1'], self.weights['deconv5_w'], output_shape=[batch_size, ADAPTED_HEIGHT/32, ADAPTED_WIDTH/32, 512], strides=[1,2,2,1]) + self.weights['deconv5_b'] File "/usr/local/anaconda3/envs/Deepf/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 1192, in conv2d_transpose outputshape = ops.convert_to_tensor(output_shape, name="output_shape") File "/usr/local/anaconda3/envs/Deepf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 932, in convert_to_tensor as_ref=False) File "/usr/local/anaconda3/envs/Deepf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1022, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/usr/local/anaconda3/envs/Deepf/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1001, in _autopacking_conversion_function return _autopacking_helper(v, inferred_dtype, name or "packed") File "/usr/local/anaconda3/envs/Deepf/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 943, in _autopacking_helper elem)) TypeError: Cannot convert a list containing a tensor of dtype <dtype: 'float64'> to <dtype: 'int32'> (Tensor is: <tf.Tensor 'flow/truediv_445:0' shape=() dtype=float64>)

burhanmudassar commented 3 years ago

Hi,

I was able to solve this problem. You have to call tf.stack on the list. Also the output of ADAPTED_HEIGHT/32 needs to be converted to int32

Before

L159: blobs['deconv5'] = tf.nn.conv2d_transpose(blobs['conv6_1'], self.weights['deconv5_w'], output_shape=[batch_size, ADAPTED_HEIGHT/32, ADAPTED_WIDTH/32, 512]), strides=[1,2,2,1]) + self.weights['deconv5_b']

After

L159: blobs['deconv5'] = tf.nn.conv2d_transpose(blobs['conv6_1'], self.weights['deconv5_w'], output_shape=tf.stack([batch_size, tf.to_int32(ADAPTED_HEIGHT/32), tf.to_int32(ADAPTED_WIDTH/32), 512]), strides=[1,2,2,1]) + self.weights['deconv5_b']