DenseHumanBodyCorrespondences icon indicating copy to clipboard operation
DenseHumanBodyCorrespondences copied to clipboard

ConcatOp : Dimensions of inputs should match

Open wchengad opened this issue 6 years ago • 6 comments

I tried to test the trained model with my synthetic data which is attached in this issue following the instructions, yet with the coming issue

`Extract feature for depth image ./test.png... Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1327, in _do_call return fn(*args) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1306, in _run_fn status, run_metadata) File "/usr/lib/python3.5/contextlib.py", line 66, in exit next(self.gen) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [1,16,20,256] vs. shape[1] = [1,15,20,256] [[Node: feature/decoder/concat = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](feature/decoder/Conv/Elu, feature/encoder/Conv_4/Elu, feature/decoder/concat/axis)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "predict.py", line 90, in output = sess.run(feature, feed_dict={input: depth_img})[0] File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 895, in run run_metadata_ptr) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1124, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1321, in _do_run options, run_metadata) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1340, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [1,16,20,256] vs. shape[1] = [1,15,20,256] [[Node: feature/decoder/concat = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](feature/decoder/Conv/Elu, feature/encoder/Conv_4/Elu, feature/decoder/concat/axis)]]

Caused by op 'feature/decoder/concat', defined at: File "predict.py", line 76, in feature = dhbc.forward(input) File "/home/chengwei/Projects/DenseCorrespondences/net.py", line 40, in forward concat5 = tf.concat([upconv5, skip3], 3) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/array_ops.py", line 1066, in concat name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 493, in _concat_v2 name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2630, in create_op original_op=self._default_original_op, op_def=op_def) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1204, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): ConcatOp : Dimensions of inputs should match: shape[0] = [1,16,20,256] vs. shape[1] = [1,15,20,256] [[Node: feature/decoder/concat = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](feature/decoder/Conv/Elu, feature/encoder/Conv_4/Elu, feature/decoder/concat/axis)]]`

test.png https://drive.google.com/open?id=1y7vjy7ajTWXsaL56SDhUilL3xPK0EFPX

wchengad avatar Mar 12 '18 07:03 wchengad

Hello, wchengad I meet the same problem with you. Did you solve this issue? Can you guide me?

Thank you very much!

Xbbei avatar Jun 09 '18 02:06 Xbbei

Hei, this issue occurs when your input image size [r, c] do not satisfy the two equation, r % 32 == 0 and c % 32 == 0.

Xbbei avatar Jun 10 '18 05:06 Xbbei

@Xbbei Can you please explain your solution further more, what should i change in my code to get rid of this error.

vishal2612200 avatar Jun 13 '19 10:06 vishal2612200

Hello,

Is there any update on this issue?

How do we fix this issue? Even I encountered the same error.

SSMK-wq avatar Jul 09 '19 06:07 SSMK-wq

@SelvaSathappan, This issue is generated when you have different types of format images in the dataset, To solve this problem,you have to first convert all the different format into one single format. for example png image to rgb image. you can find the answer how to convert the images in the given link. https://freshlybuilt.com/question/ques-how-to-convert-png-image-to-jpg-or-rgb-image-in-python/ You have to apply this logic before starting of the training on dataset.

vishal2612200 avatar Jul 16 '19 04:07 vishal2612200

Hei, this issue occurs when your input image size [r, c] do not satisfy the two equation, r % 32 == 0 and c % 32 == 0.

Had the same error, this solution worked for me! Thanks a lot:)

its-jd avatar Mar 16 '21 13:03 its-jd