KittiSeg icon indicating copy to clipboard operation
KittiSeg copied to clipboard

I have trouble in the 'demo.py'

Open myhooo opened this issue 7 years ago • 4 comments

Dear doctor Marvin Teichmann: Thanks for your pretty good work and share. However, when I want to run your code, There are some problems. And I can't find the way to solve it. When I run the 'demo.py', the error message are as following:

Traceback (most recent call last): File "demo.py", line 228, in tf.app.run() File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "demo.py", line 176, in main output = sess.run([softmax], feed_dict=feed) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 778, in run run_metadata_ptr) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 982, in _run feed_dict_string, options, run_metadata) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1032, in _do_run target_list, options, run_metadata) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1052, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value conv1_1/filter [[Node: conv1_1/filter/read = IdentityT=DT_FLOAT, _class=["loc:@conv1_1/filter"], _device="/job:localhost/replica:0/task:0/gpu:0"]] [[Node: Validation/decoder/Softmax/_3 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_42_Validation/decoder/Softmax", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'conv1_1/filter/read', defined at: File "demo.py", line 228, in tf.app.run() File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "demo.py", line 148, in main image=image) File "incl/tensorvision/core.py", line 137, in build_inference_graph logits = modules['arch'].inference(hypes, image, train=False) File "RUNS/KittiSeg_pretrained/model_files/architecture.py", line 27, in inference vgg_fcn.build(images, train=train, num_classes=2, random_init_fc8=True) File "/home/hmy/KittiSeg/incl/tensorflow_fcn/fcn8_vgg.py", line 74, in build self.conv1_1 = self._conv_layer(bgr, "conv1_1") File "/home/hmy/KittiSeg/incl/tensorflow_fcn/fcn8_vgg.py", line 154, in _conv_layer filt = self.get_conv_filter(name) File "/home/hmy/KittiSeg/incl/tensorflow_fcn/fcn8_vgg.py", line 286, in get_conv_filter var = tf.get_variable(name="filter", initializer=init, shape=shape) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1049, in get_variable use_resource=use_resource, custom_getter=custom_getter) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 948, in get_variable use_resource=use_resource, custom_getter=custom_getter) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 356, in get_variable validate_shape=validate_shape, use_resource=use_resource) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 341, in _true_getter use_resource=use_resource) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 714, in _get_single_variable validate_shape=validate_shape) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 197, in init expected_shape=expected_shape) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 316, in _init_from_args self._snapshot = array_ops.identity(self._variable, name="read") File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1338, in identity result = _op_def_lib.apply_op("Identity", input=input, name=name) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op op_def=op_def) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2336, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/hmy/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1228, in init self._traceback = _extract_stack()

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value conv1_1/filter [[Node: conv1_1/filter/read = IdentityT=DT_FLOAT, _class=["loc:@conv1_1/filter"], _device="/job:localhost/replica:0/task:0/gpu:0"]] [[Node: Validation/decoder/Softmax/_3 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_42_Validation/decoder/Softmax", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]] `

Thanks in advance~

myhooo avatar Aug 16 '17 14:08 myhooo

I had a same problem when trying to run the model learned from my data

Bangseongdeok avatar Aug 24 '17 02:08 Bangseongdeok

I'm having the same problem on OSX - I think it's traced to the tensorflow-fcn module and possibly to do with the build of tensorflow you're using (I'm on r1.3). I'll keep digging but any help would be appreciated.

StuvX avatar Sep 19 '17 13:09 StuvX

OK - so my particular problem is that I trained the model on one machine, and then copied it to my other machine, but when you do that the path definitions in the logdir checkpoint record doesn't necessarily point to the right location... I fixed it by updating the paths to the checkpoints and now it works on both machines. I hope that helps anybody else with the same issue.

StuvX avatar Sep 20 '17 10:09 StuvX

I'm confused as well.I have no idea how to organize my code.Any help will be appreciated~

SpyderLord avatar Mar 28 '18 11:03 SpyderLord