warmspringwinds / tf-image-segmentation

Image Segmentation framework based on Tensorflow and TF-Slim library
MIT License
549 stars 188 forks source link

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value fcn_8s/pool3_fc/biases [[Node: fcn_8s/pool3_fc/biases/read = Identity[T=DT_FLOAT, _class=["loc:@fcn_8s/pool3_fc/biases"], _device="/job:localhost/replica:0/task:0/cpu:0"](fcn_8s/pool3_fc/biases)]] #34

Closed caxton closed 6 years ago

caxton commented 6 years ago

saver = tf.train.import_meta_graph('./fcn_8s_checkpoint/model_fcn8s_final.ckpt.meta') saver.restore(sess,"./fcn_8s_checkpoint/model_fcn8s_final.ckpt")

Got an error on TF 1.3.0 without GPU, any idea?

FailedPreconditionError Traceback (most recent call last)

in () 60 saver.restore(sess,"./fcn_8s_checkpoint/model_fcn8s_final.ckpt") 61 ---> 62 image_np, pred_np = sess.run([image_tensor, pred], feed_dict=feed_dict_to_use) 63 64 io.imshow(image_np) /usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata) 893 try: 894 result = self._run(None, fetches, feed_dict, options_ptr, --> 895 run_metadata_ptr) 896 if run_metadata: 897 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr) /usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata) 1122 if final_fetches or final_targets or (handle and feed_dict_tensor): 1123 results = self._do_run(handle, final_targets, final_fetches, -> 1124 feed_dict_tensor, options, run_metadata) 1125 else: 1126 results = [] /usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1319 if handle is None: 1320 return self._do_call(_run_fn, self._session, feeds, fetches, targets, -> 1321 options, run_metadata) 1322 else: 1323 return self._do_call(_prun_fn, self._session, handle, feeds, fetches) /usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _do_call(self, fn, *args) 1338 except KeyError: 1339 pass -> 1340 raise type(e)(node_def, op, message) 1341 1342 def _extend_graph(self): FailedPreconditionError: Attempting to use uninitialized value fcn_8s/pool3_fc/biases [[Node: fcn_8s/pool3_fc/biases/read = Identity[T=DT_FLOAT, _class=["loc:@fcn_8s/pool3_fc/biases"], _device="/job:localhost/replica:0/task:0/cpu:0"](fcn_8s/pool3_fc/biases)]] Caused by op u'fcn_8s/pool3_fc/biases/read', defined at: File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py", line 16, in app.launch_new_instance() File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 658, in launch_instance app.start() File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelapp.py", line 477, in start ioloop.IOLoop.instance().start() File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/ioloop.py", line 177, in start super(ZMQIOLoop, self).start() File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 888, in start handler_func(fd_obj, events) File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 277, in null_wrapper return fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events self._handle_recv() File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv self._run_callback(callback, msg) File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback callback(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 277, in null_wrapper return fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher return self.dispatch_shell(stream, msg) File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell handler(stream, idents, msg) File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request user_expressions, allow_stdin) File "/usr/local/lib/python2.7/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/usr/local/lib/python2.7/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2718, in run_cell interactivity=interactivity, compiler=compiler, result=result) File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2822, in run_ast_nodes if self.run_code(code, result): File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 49, in is_training=False) File "tf_image_segmentation/utils/inference.py", line 53, in new_network_definition all_outputs = network_definition(*args, **kwargs) File "tf_image_segmentation/models/fcn_8s.py", line 151, in FCN_8s scope='pool3_fc') File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args return func(*args, **current_args) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1027, in convolution outputs = layer.apply(inputs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/base.py", line 503, in apply return self.__call__(inputs, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/base.py", line 443, in __call__ self.build(input_shapes[0]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/convolutional.py", line 144, in build dtype=self.dtype) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/base.py", line 383, in add_variable trainable=trainable and self.trainable) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 1065, in get_variable use_resource=use_resource, custom_getter=custom_getter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 962, in get_variable use_resource=use_resource, custom_getter=custom_getter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 360, in get_variable validate_shape=validate_shape, use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1561, in layer_variable_getter return _model_variable_getter(getter, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1553, in _model_variable_getter custom_getter=getter, use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args return func(*args, **current_args) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 261, in model_variable use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args return func(*args, **current_args) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 216, in variable use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 352, in _true_getter use_resource=use_resource) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 725, in _get_single_variable validate_shape=validate_shape) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 199, in __init__ expected_shape=expected_shape) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 330, in _init_from_args self._snapshot = array_ops.identity(self._variable, name="read") File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1400, in identity result = _op_def_lib.apply_op("Identity", input=input, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2630, in create_op original_op=self._default_original_op, op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1204, in __init__ self._traceback = self._graph._extract_stack() # pylint: disable=protected-access **FailedPreconditionError (see above for traceback): Attempting to use uninitialized value fcn_8s/pool3_fc/biases** [[Node: fcn_8s/pool3_fc/biases/read = Identity[T=DT_FLOAT, _class=["loc:@fcn_8s/pool3_fc/biases"], _device="/job:localhost/replica:0/task:0/cpu:0"](fcn_8s/pool3_fc/biases)]]
sarthakahuja11 commented 6 years ago

@caxton how did you solve it? I have got a similar issue.

Senyao-Han commented 5 years ago

I got this issue too. Do you solve this problem and how?