遇到问题: ssd训练疵点InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors

网上博客跟我遇到的相同类似问题

https://blog.csdn.net/orangefly0214/article/details/80909755

https://blog.csdn.net/yangfengling1023/article/details/81315612

 

报错

InvalidArgumentError (see above for traceback):
Assign requires shapes of both tensors to match.  lhs shape= [8] rhs shape= [60]

我的报错核心部分

InvalidArgumentError (see above for traceback):
Assign requires shapes of both tensors to match.  lhs shape= [8] rhs shape= [60]
   [ [Node: save/Assign_12 = Assign [T=DT_FLOAT,
                  _class=["loc:@ssd_300_vgg/block11_box/conv_cls/biases"],
                  use_locking=true,
                  validate_shape=true,
                  _device="/job:localhost/replica:0/task:0/device:GPU:0"]
                  (ssd_300_vgg/block11_box/conv_cls/biases, save/RestoreV2/_1) ] ]
详情

hp@hp-X599:~/zjc/nk_PyCharm/PyCharm_project/nk_ssd_defects/SSD-Tensorflow-master/notebooks$ python ssd_notebook.py 
2019-09-14 23:05:36.226873: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-09-14 23:05:36.301739: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:898] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-09-14 23:05:36.302008: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1212] Found device 0 with properties: 
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.733
pciBusID: 0000:01:00.0
totalMemory: 7.92GiB freeMemory: 7.43GiB
2019-09-14 23:05:36.302035: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1312] Adding visible gpu devices: 0
2019-09-14 23:05:36.456839: I tensorflow/core/common_runtime/gpu/gpu_device.cc:993] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7173 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1361, in _do_call
    return fn(*args)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1340, in _run_fn
    target_list, status, run_metadata)
  File "/home/hp/anaconda3/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= [8] rhs shape= [60]
	 [[Node: save/Assign_12 = Assign[T=DT_FLOAT, _class=["loc:@ssd_300_vgg/block11_box/conv_cls/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](ssd_300_vgg/block11_box/conv_cls/biases, save/RestoreV2/_1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ssd_notebook.py", line 61, in <module>
    saver.restore(isess, ckpt_filename)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1755, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1137, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1355, in _do_run
    options, run_metadata)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1374, 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= [8] rhs shape= [60]
	 [[Node: save/Assign_12 = Assign[T=DT_FLOAT, _class=["loc:@ssd_300_vgg/block11_box/conv_cls/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](ssd_300_vgg/block11_box/conv_cls/biases, save/RestoreV2/_1)]]

Caused by op 'save/Assign_12', defined at:
  File "ssd_notebook.py", line 60, in <module>
    saver = tf.train.Saver()
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in __init__
    self.build()
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1302, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1339, in _build
    build_save=build_save, build_restore=build_restore)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 796, in _build_internal
    restore_sequentially, reshape)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 471, in _AddRestoreOps
    assign_ops.append(saveable.restore(saveable_tensors, shapes))
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 161, in restore
    self.op.get_shape().is_fully_defined())
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 280, in assign
    validate_shape=validate_shape)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 58, in assign
    use_locking=use_locking, name=name)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3271, in create_op
    op_def=op_def)
  File "/home/hp/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1650, 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= [8] rhs shape= [60]
	 [[Node: save/Assign_12 = Assign[T=DT_FLOAT, _class=["loc:@ssd_300_vgg/block11_box/conv_cls/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](ssd_300_vgg/block11_box/conv_cls/biases, save/RestoreV2/_1)]]

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

计算机视觉-Archer

图像分割没有团队的同学可加群

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值