Open chunniunai220ml opened 4 years ago
I got this problem, then change self.trainable: True in evaluate.py. In my case, it's solved
you set is ture ,but in evaluate.py line 124,class_name is coco name.you shuould conver class_name to tfyolo.names. like me: class_name = self.coco_classes[class_ind] if class_name in self.voc_classes: class_name = class_name else: continue hope its can help you! @chunniunai220ml
Thanks for your sharing! when I evaluate my data with yolov3_coco_demo.ckpt(ReadMe providede the link),I meet some errors that I can not solve by adding tf.global_variables_initializer() and some other ops.
the config file that I have set,and my data just 1 class. the "./data/dataset/tfyolo_test_all.txt" format refer to the readme.md.
C.YOLO.CLASSES = "./data/classes/coco.names" C.YOLO.ANCHORS = "./data/anchors/coco_anchors.txt"
__C.TEST.ANNOT_PATH = "./data/dataset/tfyolo_test_all.txt" __C.TEST.WEIGHT_FILE = './ckpt0/yolov3_coco_demo.ckpt'
the errors as follow:
Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [1,1,512,255] rhs shape= [1,1,512,18] [[{{node save/Assign_93}}]] [[save/RestoreV2/_344]] (1) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [1,1,512,255] rhs shape= [1,1,512,18] [[{{node save/Assign_93}}]] 0 successful operations. 0 derived errors ignored.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1286, in restore {self.saver_def.filename_tensor_name: save_path}) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1370, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [1,1,512,255] rhs shape= [1,1,512,18] [[node save/Assign_93 (defined at evaluate.py:50) ]] [[save/RestoreV2/_344]] (1) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [1,1,512,255] rhs shape= [1,1,512,18] [[node save/Assign_93 (defined at evaluate.py:50) ]] 0 successful operations. 0 derived errors ignored.
Errors may have originated from an input operation. Input Source operations connected to node save/Assign_93: conv_mbbox/weight (defined at /mnt/MountVolume1/xielu/code_hub/codes/gitsfile/tensorflow-yolov3-master/core/common.py:31)
Input Source operations connected to node save/Assign_93: conv_mbbox/weight (defined at /mnt/MountVolume1/xielu/code_hub/codes/gitsfile/tensorflow-yolov3-master/core/common.py:31)
Original stack trace for 'save/Assign_93': File "evaluate.py", line 168, in
if name == 'main': YoloTest().evaluate()
File "evaluate.py", line 50, in init
self.saver = tf.train.Saver() #ema_obj.variables_to_restore()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 825, in init
self.build()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 837, 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 875, in _build
build_restore=build_restore)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 508, in _build_internal
restore_sequentially, reshape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 350, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saving/saveable_object_util.py", line 72, in restore
self.op.get_shape().is_fully_defined())
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/state_ops.py", line 227, in assign
validate_shape=validate_shape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 66, in assign
use_locking=use_locking, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2005, in init
self._traceback = tf_stack.extract_stack()
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "evaluate.py", line 168, in
if name == 'main': YoloTest().evaluate()
File "evaluate.py", line 51, in init
self.saver.restore(self.sess, self.weight_file)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1322, 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:
2 root error(s) found. (0) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [1,1,512,255] rhs shape= [1,1,512,18] [[node save/Assign_93 (defined at evaluate.py:50) ]] [[save/RestoreV2/_344]] (1) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [1,1,512,255] rhs shape= [1,1,512,18] [[node save/Assign_93 (defined at evaluate.py:50) ]] 0 successful operations. 0 derived errors ignored.
Errors may have originated from an input operation. Input Source operations connected to node save/Assign_93: conv_mbbox/weight (defined at /mnt/MountVolume1/xielu/code_hub/codes/gitsfile/tensorflow-yolov3-master/core/common.py:31)
Input Source operations connected to node save/Assign_93: conv_mbbox/weight (defined at /mnt/MountVolume1/xielu/code_hub/codes/gitsfile/tensorflow-yolov3-master/core/common.py:31)
Original stack trace for 'save/Assign_93': File "evaluate.py", line 168, in
if name == 'main': YoloTest().evaluate()
File "evaluate.py", line 50, in init
self.saver = tf.train.Saver() #ema_obj.variables_to_restore()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 825, in init
self.build()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 837, 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 875, in _build
build_restore=build_restore)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 508, in _build_internal
restore_sequentially, reshape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 350, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saving/saveable_object_util.py", line 72, in restore
self.op.get_shape().is_fully_defined())
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/state_ops.py", line 227, in assign
validate_shape=validate_shape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 66, in assign
use_locking=use_locking, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2005, in init
self._traceback = tf_stack.extract_stack()
if I set the config as this: C.YOLO.CLASSES = "./data/classes/tfyolo.names" C.YOLO.ANCHORS = "./data/anchors/tfyolo_anchors.txt"
__C.TEST.ANNOT_PATH = "./data/dataset/tfyolo_test_all.txt" __C.TEST.WEIGHT_FILE = './ckpt0/yolov3_coco_demo.ckpt'
No error in evaluate.py,but the map=0.0%