KranthiGV / Pretrained-Show-and-Tell-model

This repository contains pretrained Show and Tell: A Neural Image Caption Generator implemented in Tensorflow.
MIT License
198 stars 45 forks source link

NotFoundError (see above for traceback): Tensor name "InceptionV3/Mixed_7b/Branch_2/Conv2d_0c_1x3/weights" #5

Closed K-Y-J closed 7 years ago

K-Y-J commented 7 years ago

Before ask question , Thanks for your sharing.

  1. I download your model.ckpt-2000000.index

  2. Rename model.ckpt-2000000.index -> model.ckpt-2000000

  3. bazel-bin/im2txt/run_inference \ --checkpoint_path=/my/path/model.ckpt-2000000 \ --vocab_file=${VOCAB_FILE} \ --input_files=${IMAGE_FILE}

  4. I got below error

Traceback (most recent call last): File "/home/nvidia/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 85, in tf.app.run() File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/home/nvidia/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 65, in main restore_fn(sess) File "/home/nvidia/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/inference_utils/inference_wrapper_base.py", line 96, in _restore_fn saver.restore(sess, checkpoint_path) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1428, in restore {self.saver_def.filename_tensor_name: save_path}) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 767, in run run_metadata_ptr) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 965, in _run feed_dict_string, options, run_metadata) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1015, in _do_run target_list, options, run_metadata) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1035, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: Tensor name "InceptionV3/Mixed_7b/Branch_2/Conv2d_0c_1x3/weights" not found in checkpoint files /home/nvidia/models/im2txt/im2txt/model/train/model.ckpt-2000000 [[Node: save/RestoreV2_331 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_331/tensor_names, save/RestoreV2_331/shape_and_slices)]]

Caused by op u'save/RestoreV2_331', defined at: File "/home/nvidia/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 85, in tf.app.run() File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/home/nvidia/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 51, in main FLAGS.checkpoint_path) File "/home/nvidia/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/inference_utils/inference_wrapper_base.py", line 116, in build_graph_from_config saver = tf.train.Saver() File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1040, in init self.build() File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1070, in build restore_sequentially=self._restore_sequentially) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 675, in build restore_sequentially, reshape) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 402, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 242, in restore_op [spec.tensor.dtype])[0]) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 668, in restore_v2 dtypes=dtypes, name=name) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op op_def=op_def) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2327, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1226, in init self._traceback = _extract_stack()

NotFoundError (see above for traceback): Tensor name "InceptionV3/Mixed_7b/Branch_2/Conv2d_0c_1x3/weights" not found in checkpoint files /home/nvidia/models/im2txt/im2txt/model/train/model.ckpt-2000000 [[Node: save/RestoreV2_331 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_331/tensor_names, save/RestoreV2_331/shape_and_slices)]]

Plz tell me how to solve this error. I want just test Captioning ( not training ) . So i down your pre trained...

TF versin : '1.0.1' Ubuntu : 16.04 LTS Python2 : 2.7.12 Architecture : NVIDIA Jetson TX2 ( aarch 64 )

KranthiGV commented 7 years ago

@K-Y-J I notice you misinterpreted the instructions. Please download the model from model.ckpt-2000000.data-00000-of-00001 And download model.ckpt-2000000.index and word_counts.txt from this repository. Put model.ckpt-2000000.index and model.ckpt-2000000.data-00000-of-00001 in the same folder. Later set env variables and execute

bazel-bin/im2txt/run_inference
--checkpoint_path=/my/path/model.ckpt-2000000
--vocab_file=${VOCAB_FILE}
--input_files=${IMAGE_FILE}

/my/path/model.ckpt-2000000 indicates where model.ckpt-2000000.index and model.ckpt-2000000.data-00000-of-00001 are located.

Rename model.ckpt-2000000.index -> model.ckpt-2000000

NOTE: There's no need to rename model.ckpt-2000000.index

K-Y-J commented 7 years ago

After follow your instruction , finally I got caption xD !! I really thank for your very very kind answer.