FailedPreconditionError
Eulsen opened this issue · 5 comments
Hi!
I am pretty sure that I am making a stupid mistake but when I try to run the code on the horse2zebra dataset I get the a FailedPreconditionError, details see below. The dataset is in the correct form in the cycleGan folder ./input/horse2zebra/trainA etc. I have a Windows machine with the recent version of tensorflow installed (I tried both pyton 3.5 and 3.6). I want to try how this cycle Gan implementation worksfor my research, so help would be much appreciated!
Thx!
Here is the full error message:
Traceback (most recent call last):
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1139, in _do_call
return fn(*args)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1121, in _run_fn
status, run_metadata)
File "C:\Users\Eulsen\Anaconda3\lib\contextlib.py", line 88, in exit
next(self.gen)
File "C:\Users\Eulsen\Anaconda3\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.FailedPreconditionError: Attempting to use uninitialized value matching_filenames
[[Node: matching_filenames/read = IdentityT=DT_STRING, _class=["loc:@matching_filenames"], _device="/job:localhost/replica:0/task:0/cpu:0"]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 362, in
main()
File "main.py", line 356, in main
model.train()
File "main.py", line 254, in train
self.input_read(sess)
File "main.py", line 87, in input_read
num_files_A = sess.run(self.queue_length_A)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 789, in run
run_metadata_ptr)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "C:\Users\Eulsen\Anaconda3\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.FailedPreconditionError: Attempting to use uninitialized value matching_filenames
[[Node: matching_filenames/read = IdentityT=DT_STRING, _class=["loc:@matching_filenames"], _device="/job:localhost/replica:0/task:0/cpu:0"]]
Caused by op 'matching_filenames/read', defined at:
File "main.py", line 362, in
main()
File "main.py", line 356, in main
model.train()
File "main.py", line 238, in train
self.input_setup()
File "main.py", line 56, in input_setup
filenames_A = tf.train.match_filenames_once("./input/horse2zebra/trainA/*.jpg")
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\training\input.py", line 69, in match_filenames_once
collections=[ops.GraphKeys.LOCAL_VARIABLES])
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1679, in variable
caching_device=caching_device, name=name, dtype=dtype)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\ops\variables.py", line 200, in init
expected_shape=expected_shape)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\ops\variables.py", line 319, in _init_from_args
self._snapshot = array_ops.identity(self._variable, name="read")
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 1303, in identity
result = _op_def_lib.apply_op("Identity", input=input, name=name)
File "C:\Users\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op
op_def=op_def)
File "C:\Users\Eulsen\Anaconda3\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\Eulsen\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1269, in init
self._traceback = _extract_stack()
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value matching_filenames
[[Node: matching_filenames/read = IdentityT=DT_STRING, _class=["loc:@matching_filenames"], _device="/job:localhost/replica:0/task:0/cpu:0"]]
The problem is match_filenames_once. I use init = ([tf.global_variables_initializer(), tf.local_variables_initializer()]) instead of init = tf.global_variables_initializer().
Great! now it works! Thanks a lot for your quick help, you made my day!
by the way, in an unrelated error I also had to delete the brackets after the .size() commands around line 99 of the code... maybe this still helps someone.
Have you trained the network Eulsen? I've tried horse2zebra dataset, but the output images are just some noises. How about your results?
Same with me. I tried the horse2zebra for 100 epochs but I only got crap.
Nothing even remotely looking like it should.
Not sure whether training is not long enough, I am making any mistakes or if there is something seriously flawed.
Why have you closed this Hardik? Please tell how to solve the issue as many of us are facing the same issue.