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

Train error (different shapes) #60

Open
efyphil opened this issue Dec 6, 2018 · 2 comments
Open

Train error (different shapes) #60

efyphil opened this issue Dec 6, 2018 · 2 comments

Comments

@efyphil
Copy link

efyphil commented Dec 6, 2018

Thanks for work, can you please help me with this issue
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "evaluation.py", line 325, in
main()
File "evaluation.py", line 276, in main
pr_file = create_prediction_file(dataset, dataset_dir)
File "evaluation.py", line 189, in create_prediction_file
saver.restore(session,os.path.join(weights_dir,'snapshot-250000'))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1666, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 889, in run
run_metadata_ptr)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1120, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1317, in _do_run
options, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1336, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [128] rhs shape= [96]
[[Node: save/Assign_22 = Assign[T=DT_FLOAT, _class=["loc:@netDM1/conv3y/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](netDM1/conv3y/bias, save/RestoreV2_22)]]

Caused by op 'save/Assign_22', defined at:
File "evaluation.py", line 325, in
main()
File "evaluation.py", line 276, in main
pr_file = create_prediction_file(dataset, dataset_dir)
File "evaluation.py", line 188, in create_prediction_file
saver = tf.train.Saver()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1218, in init
self.build()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1227, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1263, in _build
build_save=build_save, build_restore=build_restore)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 751, in _build_internal
restore_sequentially, reshape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 439, in _AddRestoreOps
assign_ops.append(saveable.restore(tensors, shapes))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 160, in restore
self.op.get_shape().is_fully_defined())
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/state_ops.py", line 276, in assign
validate_shape=validate_shape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 57, in assign
use_locking=use_locking, 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/framework/ops.py", line 2956, in create_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1470, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [128] rhs shape= [96]
[[Node: save/Assign_22 = Assign[T=DT_FLOAT, _class=["loc:@netDM1/conv3y/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](netDM1/conv3y/bias, save/RestoreV2_22)]]

@ryanhyc2
Copy link

May I ask whether anyone solved this problem? I've created my own RGB-D data set and successfully trained on it but am running into this error.

@ryanhyc2
Copy link

For anyone curious, the answer was using example_v2.py and supplying the checkpoint.

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

2 participants