tensorflow / tensorflow/models
When i want to export my retrained deeplabv3plus model by export_model.py supported by official, i have a difficult problem,please help me!
Open
@aquariusjay is already working on this.
Since Jul 1, 2020.
models:research
type:support
- Dominant language
- Python
- Stars
- 77.7k
- Forks
- 44.8k
- PR merge metrics
- No merged PRs in 30d
Description
When i want to export my retrained model by export_model.py supported by office, i have a difficult problem,please help me!
I run this shell:
python export_model.py \
--checkpoint_path="/home/administrator/diskc/GuanChao/graduationProject/deeplab/deeplabv3+/models/research/deeplab/exp/xception_65_10/train/model.ckpt-10" \
--export_path="home/administrator/diskc/GuanChao/graduationProject/deeplab/deeplabv3+/models/research/deeplab/output_model/cityscapes/frozen_inference_graph.pb" \
--model_variant="xception_65" \
--atrous_rates=6 \
--atrous_rates=12 \
--atrous_rates=18 \
--output_stride=16 \
--decoder_output_stride=4 \
--num_classes=21 \
--crop_size=513 \
--crop_size=513 \
--inference_scales=1.0
and the recall by terminal:
Traceback (most recent call last):
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1312, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun
status, run_metadata)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [1,1,256,21] rhs shape= [1,1,256,19]
[[Node: save/Assign_71 = Assign[T=DT_FLOAT, _class=["loc:@logits/semantic/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](logits/semantic/weights, save/RestoreV2/_3)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "export_model.py", line 169, in <module>
tf.app.run()
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "export_model.py", line 163, in main
initializer_nodes=None)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/tools/freeze_graph.py", line 106, in freeze_graph_with_def_protos
saver.restore(sess, input_checkpoint)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1775, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 905, in run
run_metadata_ptr)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1140, in _run
feed_dict_tensor, options, run_metadata)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
run_metadata)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1340, 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= [1,1,256,21] rhs shape= [1,1,256,19]
[[Node: save/Assign_71 = Assign[T=DT_FLOAT, _class=["loc:@logits/semantic/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](logits/semantic/weights, save/RestoreV2/_3)]]
Caused by op 'save/Assign_71', defined at:
File "export_model.py", line 169, in <module>
tf.app.run()
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "export_model.py", line 151, in main
saver = tf.train.Saver(tf.model_variables())
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1311, in __init__
self.build()
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1320, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1357, in _build
build_save=build_save, build_restore=build_restore)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 809, in _build_internal
restore_sequentially, reshape)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 470, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 162, in restore
self.op.get_shape().is_fully_defined())
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 281, in assign
validate_shape=validate_shape)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 61, in assign
use_locking=use_locking, name=name)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
op_def=op_def)
File "/home/administrator/anaconda3/envs/fastai/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1654, 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= [1,1,256,21] rhs shape= [1,1,256,19]
[[Node: save/Assign_71 = Assign[T=DT_FLOAT, _class=["loc:@logits/semantic/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](logits/semantic/weights, save/RestoreV2/_3)]]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.