Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inference验证多张图片使用for循环会报错 #12

Open
qtzfh opened this issue May 25, 2017 · 0 comments
Open

inference验证多张图片使用for循环会报错 #12

qtzfh opened this issue May 25, 2017 · 0 comments

Comments

@qtzfh
Copy link

qtzfh commented May 25, 2017

修改后的代码:
for root, sub_folder, file_list in os.walk("../image/fonts/test/"):
for file_path in file_list:
image_file = root + file_path
final_predict_val, final_predict_index = inference(image_file)
错误信息:
Traceback (most recent call last):
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1039, in _do_call
return fn(*args)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1021, in _run_fn
status, run_metadata)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\contextlib.py", line 66, in exit
next(self.gen)
File "C:\Users\ucmed\AppData\Local\Programs\Python\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: Key fully_connected_19/biases/Adam not found in checkpoint
[[Node: save_1/RestoreV2_109 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_109/tensor_names, save_1/RestoreV2_109/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\pydevd.py", line 1585, in
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\pydevd.py", line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/ucmed-python/tensorflow_learning/chinese_font_flip/fonts_main.py", line 303, in
run()
File "D:/ucmed-python/tensorflow_learning/chinese_font_flip/fonts_main.py", line 297, in run
final_predict_val, final_predict_index = inference(image_file)
File "D:/ucmed-python/tensorflow_learning/chinese_font_flip/fonts_main.py", line 209, in inference
saver.restore(sess, ckpt)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1457, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 778, in run
run_metadata_ptr)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 982, in _run
feed_dict_string, options, run_metadata)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1032, in _do_run
target_list, options, run_metadata)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1052, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key fully_connected_19/biases/Adam not found in checkpoint
[[Node: save_1/RestoreV2_109 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_109/tensor_names, save_1/RestoreV2_109/shape_and_slices)]]

Caused by op 'save_1/RestoreV2_109', defined at:
File "D:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\pydevd.py", line 1585, in
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\pydevd.py", line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/ucmed-python/tensorflow_learning/chinese_font_flip/fonts_main.py", line 303, in
run()
File "D:/ucmed-python/tensorflow_learning/chinese_font_flip/fonts_main.py", line 297, in run
final_predict_val, final_predict_index = inference(image_file)
File "D:/ucmed-python/tensorflow_learning/chinese_font_flip/fonts_main.py", line 206, in inference
saver = tf.train.Saver()
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1056, in init
self.build()
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1086, in build
restore_sequentially=self._restore_sequentially)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 691, in build
restore_sequentially, reshape)
File "C:\Users\ucmed\AppData\Local\Programs\Python\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\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 247, in restore_op
[spec.tensor.dtype])[0])
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 669, in restore_v2
dtypes=dtypes, name=name)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 768, in apply_op
op_def=op_def)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2336, in create_op
original_op=self._default_original_op, op_def=op_def)
File "C:\Users\ucmed\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1228, in init
self._traceback = _extract_stack()

NotFoundError (see above for traceback): Key fully_connected_19/biases/Adam not found in checkpoint
[[Node: save_1/RestoreV2_109 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save_1/Const_0, save_1/RestoreV2_109/tensor_names, save_1/RestoreV2_109/shape_and_slices)]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant