Ubuntu Yolov3 訓練新的模型後,加載新模型參數出錯

tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]
 

tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]


InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_single_image.py", line 63, in <module>
    saver.restore(sess, args.restore_path)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1759, in restore
    err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]
 

InvalidArgumentError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]

sh-4.2$ python test_single_image.py ./data/demo_data/messi.jpg
/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
2019-08-05 12:20:00.624279: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2019-08-05 12:20:00.886501: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties:
name: Tesla P40 major: 6 minor: 1 memoryClockRate(GHz): 1.531
pciBusID: 0000:2d:00.0
totalMemory: 22.38GiB freeMemory: 22.22GiB
2019-08-05 12:20:01.105373: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 1 with properties:
name: Tesla P40 major: 6 minor: 1 memoryClockRate(GHz): 1.531
pciBusID: 0000:31:00.0
totalMemory: 22.38GiB freeMemory: 22.22GiB
2019-08-05 12:20:01.329225: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 2 with properties:
name: Tesla P40 major: 6 minor: 1 memoryClockRate(GHz): 1.531
pciBusID: 0000:35:00.0
totalMemory: 22.38GiB freeMemory: 22.22GiB
2019-08-05 12:20:01.557915: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 3 with properties:
name: Tesla P40 major: 6 minor: 1 memoryClockRate(GHz): 1.531
pciBusID: 0000:39:00.0
totalMemory: 22.38GiB freeMemory: 22.22GiB
2019-08-05 12:20:01.567523: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0, 1, 2, 3
2019-08-05 12:20:03.119234: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-08-05 12:20:03.119281: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971]      0 1 2 3
2019-08-05 12:20:03.119293: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0:   N Y Y Y
2019-08-05 12:20:03.119299: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 1:   Y N Y Y
2019-08-05 12:20:03.119305: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 2:   Y Y N Y
2019-08-05 12:20:03.119311: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 3:   Y Y Y N
2019-08-05 12:20:03.121385: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 21553 MB memory) -> physical GPU (device: 0, name: Tesla P40, pci bus id: 0000:2d:00.0, compute capability: 6.1)
2019-08-05 12:20:03.364264: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 21553 MB memory) -> physical GPU (device: 1, name: Tesla P40, pci bus id: 0000:31:00.0, compute capability: 6.1)
2019-08-05 12:20:03.607557: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:2 with 21553 MB memory) -> physical GPU (device: 2, name: Tesla P40, pci bus id: 0000:35:00.0, compute capability: 6.1)
2019-08-05 12:20:03.850832: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:3 with 21553 MB memory) -> physical GPU (device: 3, name: Tesla P40, pci bus id: 0000:39:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1278, in _do_call
    return fn(*args)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1263, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1725, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 877, in run
    run_metadata_ptr)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1100, in _run
    feed_dict_tensor, options, run_metadata)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1272, in _do_run
    run_metadata)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1291, 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= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]

Caused by op 'save/Assign_290', defined at:
  File "test_single_image.py", line 62, in <module>
    saver = tf.train.Saver()
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1281, in __init__
    self.build()
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
    build_save=build_save, build_restore=build_restore)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 778, in _build_internal
    restore_sequentially, reshape)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 419, in _AddRestoreOps
    assign_ops.append(saveable.restore(saveable_tensors, shapes))
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 112, in restore
    self.op.get_shape().is_fully_defined())
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 216, in assign
    validate_shape=validate_shape)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign
    use_locking=use_locking, name=name)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
    return func(*args, **kwargs)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
    op_def=op_def)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1717, in __init__
    self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_single_image.py", line 63, in <module>
    saver.restore(sess, args.restore_path)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1759, in restore
    err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]

Caused by op 'save/Assign_290', defined at:
  File "test_single_image.py", line 62, in <module>
    saver = tf.train.Saver()
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1281, in __init__
    self.build()
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
    build_save=build_save, build_restore=build_restore)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 778, in _build_internal
    restore_sequentially, reshape)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 419, in _AddRestoreOps
    assign_ops.append(saveable.restore(saveable_tensors, shapes))
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 112, in restore
    self.op.get_shape().is_fully_defined())
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 216, in assign
    validate_shape=validate_shape)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign
    use_locking=use_locking, name=name)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
    return func(*args, **kwargs)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
    op_def=op_def)
  File "/gpfsssd/anacondas/ana1/anaconda/envs/env2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1717, in __init__
    self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [255] rhs shape= [45]
         [[Node: save/Assign_290 = Assign[T=DT_FLOAT, _class=["loc:@yolov3/yolov3_head/Conv_14/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](yolov3/yolov3_head/Conv_14/biases, save/RestoreV2/_581)]]

sh-4.2$

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章