Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While trying to train this model on my customized dataset it gives an error :InvalidArgumentError (see above for traceback): Incompatible shapes: [1,272,480] vs. [1,1088,1920] [[node sub (defined at /workspace/mscnn/mscnn.py:326) = Sub[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Squeeze, _arg_Placeholder_1_0_1/_111)]] #19

Open
sratandeep16 opened this issue Feb 26, 2019 · 4 comments

Comments

@sratandeep16
Copy link

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [1,272,480] vs. [1,1088,1920]
[[{{node sub}} = Sub[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Squeeze, _arg_Placeholder_1_0_1/_111)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "mscnn_train.py", line 159, in
tf.app.run()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "mscnn_train.py", line 155, in main
train()
File "mscnn_train.py", line 117, in train
_, loss_value = sess.run([train_op, loss], feed_dict={image: np_xs, label: np_ys})
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [1,272,480] vs. [1,1088,1920]
[[node sub (defined at /workspace/mscnn/mscnn.py:326) = Sub[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Squeeze, _arg_Placeholder_1_0_1/_111)]]

Caused by op 'sub', defined at:
File "mscnn_train.py", line 159, in
tf.app.run()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "mscnn_train.py", line 155, in main
train()
File "mscnn_train.py", line 63, in train
loss = mscnn.loss(predicts, label) # 计算损失
File "/workspace/mscnn/mscnn.py", line 326, in loss
l2_loss = tf.reduce_sum((predict - label) * (predict - label))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py", line 866, in binary_op_wrapper
return func(x, y, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 8318, in sub
"Sub", x=x, y=y, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1,272,480] vs. [1,1088,1920]
[[node sub (defined at /workspace/mscnn/mscnn.py:326) = Sub[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Squeeze, _arg_Placeholder_1_0_1/_111)]]

@sratandeep16 sratandeep16 changed the title While trying to train this model on my customized data it gives an error :InvalidArgumentError (see above for traceback): Incompatible shapes: [1,272,480] vs. [1,1088,1920] [[node sub (defined at /workspace/mscnn/mscnn.py:326) = Sub[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Squeeze, _arg_Placeholder_1_0_1/_111)]] While trying to train this model on my customized dataset it gives an error :InvalidArgumentError (see above for traceback): Incompatible shapes: [1,272,480] vs. [1,1088,1920] [[node sub (defined at /workspace/mscnn/mscnn.py:326) = Sub[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Squeeze, _arg_Placeholder_1_0_1/_111)]] Feb 26, 2019
@KASS33
Copy link

KASS33 commented Apr 23, 2019

HELLO,did you handle this problem?I meet the same problem with you,maybe the reason is that the size of our own dataset is different with the given dataset.

@guo-junfu
Copy link

I delete the sentence "predict = tf.squeeze(predict, 3)" in main.py, and it could work in training, and need to add the sentence back while evaluating. But got terrible result in eval, the loss is inf : (

@KASS33
Copy link

KASS33 commented May 18, 2019

you should resize the density map and jpg in dataset to the same size,I succeed in this way

@Richardsh
Copy link

I delete the sentence "predict = tf.squeeze(predict, 3)" in main.py, and it could work in training, and need to add the sentence back while evaluating. But got terrible result in eval, the loss is inf : (

hi, do u know how long did u run the training project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants