dBeker / Faster-RCNN-TensorFlow-Python3

Tensorflow Faster R-CNN for Windows/Linux and Python 3 (3.5/3.6/3.7)
MIT License
612 stars 329 forks source link

Tensor name "vgg_16/rpn_conv/3x3/weights" not found in checkpoint files #73

Closed ai1361720220000 closed 5 years ago

ai1361720220000 commented 5 years ago

Hello dBeker, I download the vgg16_faster_rcnn_iter_70000.ckpt from Intenet and run demo.py. However, there exists some errors.

Traceback (most recent call last): File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\client\session.py", line 1139, in _do_call return fn(*args) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\client\session.py", line 1121, in _run_fn status, run_metadata) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\contextlib.py", line 66, in exit next(self.gen) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.NotFoundError: Tensor name "vgg_16/rpn_conv/3x3/weights" not found in checkpoint files output\vgg16\voc_2007_trainval+voc_2012_trainval\default\vgg16_faster_rcnn_iter_70000.ckpt [[Node: save/RestoreV2_39 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_39/tensor_names, save/RestoreV2_39/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:/Faster-RCNN-TensorFlow-Python3.5-master/demo.py", line 149, in saver.restore(sess, tfmodel) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\training\saver.py", line 1548, in restore {self.saver_def.filename_tensor_name: save_path}) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\client\session.py", line 789, in run run_metadata_ptr) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\client\session.py", line 997, in _run feed_dict_string, options, run_metadata) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\client\session.py", line 1132, in _do_run target_list, options, run_metadata) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\client\session.py", line 1152, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: Tensor name "vgg_16/rpn_conv/3x3/weights" not found in checkpoint files output\vgg16\voc_2007_trainval+voc_2012_trainval\default\vgg16_faster_rcnn_iter_70000.ckpt [[Node: save/RestoreV2_39 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_39/tensor_names, save/RestoreV2_39/shape_and_slices)]]

Caused by op 'save/RestoreV2_39', defined at: File "F:/Faster-RCNN-TensorFlow-Python3.5-master/demo.py", line 148, in saver = tf.train.Saver(write_version=saver_pb2.SaverDef.V1) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\training\saver.py", line 1139, in init self.build() File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\training\saver.py", line 1170, in build restore_sequentially=self._restore_sequentially) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\training\saver.py", line 691, in build restore_sequentially, reshape) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\training\saver.py", line 407, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\training\saver.py", line 247, in restore_op [spec.tensor.dtype])[0]) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 640, in restore_v2 dtypes=dtypes, name=name) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op op_def=op_def) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2506, in create_op original_op=self._default_original_op, op_def=op_def) File "C:\Users\Alxendx\Anaconda3\envs\python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1269, in init self._traceback = _extract_stack()

NotFoundError (see above for traceback): Tensor name "vgg_16/rpn_conv/3x3/weights" not found in checkpoint files output\vgg16\voc_2007_trainval+voc_2012_trainval\default\vgg16_faster_rcnn_iter_70000.ckpt [[Node: save/RestoreV2_39 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_39/tensor_names, save/RestoreV2_39/shape_and_slices)]]

It seems the ckpt file does not match the vgg_16_faster_rcnn net, but i did not do anything on the net. Hope you can help me! thanks!

morpheusthewhite commented 5 years ago

You should first run train.py since it modifies the net and then saves it. Use that saving and the demo will work

ai1361720220000 commented 5 years ago

Thank you ! the ckpt files does not match the net, i use the file produced by train.py and it works. Thanks!

morpheusthewhite commented 5 years ago

You're welcome!