how to use the guess.py with pre-trained model ?
ucasiggcas opened this issue · 4 comments
ucasiggcas commented
hi,
with simple command ,I can't change the code in mine ,
my ckpt is in ./checkpoints/
and the test pic in the ./pictures/
any one could help me ?
thx
ucasiggcas commented
my codes is as follows
python guess.py --model_dir D:/python/pycode/videodnn/age_gender/pre_models/age_model --filename D:/python/pycode/videodnn/action_net_v1/data/test/calling_13.jpg
but error ups
I1125 21:08:14.692058 20840 saver.py:1280] Restoring parameters from D:/python/pycode/videodnn/age_gender/pre_models/age_model\checkpoint-14999
2019-11-25 21:08:14.721670: W tensorflow/core/framework/op_kernel.cc:1502] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key LeviHassner/conv1/biases not found in checkpoint
Traceback (most recent call last):
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.NotFoundError: Key LeviHassner/conv1/biases not found in checkpoint
[[{{node save/RestoreV2}}]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 1286, in restore
{self.saver_def.filename_tensor_name: save_path})
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
run_metadata_ptr)
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
run_metadata)
File "D:\python\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key LeviHassner/conv1/biases not found in checkpoint
[[node save/RestoreV2 (defined at guess.py:162) ]]
Original stack trace for 'save/RestoreV2':
File "guess.py", line 204, in <module>
tf.app.run()
File "D:\python\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "D:\python\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "D:\python\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "guess.py", line 162, in main
saver = tf.train.Saver()
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 825, in __init__
self.build()
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 837, in build
self._build(self._filename, build_save=True, build_restore=True)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 875, in _build
build_restore=build_restore)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 508, in _build_internal
restore_sequentially, reshape)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 328, in _AddRestoreOps
restore_sequentially)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 575, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "D:\python\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 1779, in restore_v2
name=name)
File "D:\python\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "D:\python\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "D:\python\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "D:\python\lib\site-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 "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 1296, in restore
names_to_keys = object_graph_key_mapping(save_path)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 1614, in object_graph_key_mapping
object_graph_string = reader.get_tensor(trackable.OBJECT_GRAPH_PROTO_KEY)
File "D:\python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 678, in get_tensor
return CheckpointReader_GetTensor(self, compat.as_bytes(tensor_str))
tensorflow.python.framework.errors_impl.NotFoundError: Key _CHECKPOINTABLE_OBJECT_GRAPH not found in checkpoint
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "guess.py", line 204, in <module>
tf.app.run()
File "D:\python\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "D:\python\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "D:\python\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "guess.py", line 163, in main
saver.restore(sess, model_checkpoint_path)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 1302, in restore
err, "a Variable name or other graph key that is missing")
tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Key LeviHassner/conv1/biases not found in checkpoint
[[node save/RestoreV2 (defined at guess.py:162) ]]
Original stack trace for 'save/RestoreV2':
File "guess.py", line 204, in <module>
tf.app.run()
File "D:\python\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "D:\python\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "D:\python\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "guess.py", line 162, in main
saver = tf.train.Saver()
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 825, in __init__
self.build()
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 837, in build
self._build(self._filename, build_save=True, build_restore=True)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 875, in _build
build_restore=build_restore)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 508, in _build_internal
restore_sequentially, reshape)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 328, in _AddRestoreOps
restore_sequentially)
File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 575, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "D:\python\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 1779, in restore_v2
name=name)
File "D:\python\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "D:\python\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "D:\python\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "D:\python\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
self._traceback = tf_stack.extract_stack()
any advice or suggestion will be appreciated.
thx
ucasiggcas commented
if I want to guess the pictures in the directory, any simple step ???
or just use for ... in ...
?
thx
ucasiggcas commented
and I find the func make_multi_image_batch in utils.py,but never be used in the guess.py
So could it be used for many pics ?