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

Assign requires shapes of both tensors to match. lhs shape= [13] rhs shape= [150] #128

Open
shakey-cuimiao opened this issue Jul 9, 2020 · 0 comments

Comments

@shakey-cuimiao
Copy link

I have change
restore_var = tf.global_variables()
to
restore_var = [v for v in tf.global_variables() if 'conv6_cls' not in v.name]
Update INPUT_SIZE to '512, 512'
Update NUM_CLASSES to 13
filter_scale=2.
model_type = 'others'
when run python train.py --dataset others ,I get erros:
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [13] rhs shape= [150]
[[node save/Assign_382 (defined at /home/sherry/cuimiao/Fabric_defect_detection/ICNet-tensorflow/network.py:79) ]]

Errors may have originated from an input operation.
Input Source operations connected to node save/Assign_382:
sub24_out/biases (defined at /home/sherry/cuimiao/Fabric_defect_detection/ICNet-tensorflow/network.py:145)

Original stack trace for 'save/Assign_382':
File "train.py", line 167, in
main()
File "train.py", line 146, in main
train_net.restore(cfg.model_weight, restore_var)
File "/home/sherry/cuimiao/Fabric_defect_detection/ICNet-tensorflow/network.py", line 79, in restore
loader = tf.train.Saver(var_list=tf.global_variables())
File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 825, in init
self.build()
File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 837, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 875, in _build
build_restore=build_restore)
File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 508, in _build_internal
restore_sequentially, reshape)
File "/home/sherry/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 350, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_ten

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

1 participant