question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

problem with tf saver

See original GitHub issue

Hi,

I am trying to use your code for a simulation but I will receive the corresponding errors with the tf. I downloaded the New_Tusimple_Lanenet_Model_Weights and put them into a folder named model, and changed the save_path inside the code to the full path of the weights_path and run the following code: python3 test_lanenet.py --is_batch False --batch_size 1 --image_path data/tusimple_test_image/0.jpg --weights_path model/ --use_gpu 1

But I receive the following error:

`I1106 10:41:31.327025 8960 test_lanenet.py:77] 开始读取图像数据并进行预处理 I1106 10:41:31.336418 8960 test_lanenet.py:83] 图像读取完毕, 耗时: 0.00930s INFO:tensorflow:Restoring parameters from /home/mojzar/Desktop/lanenet-lane-detection/model I1106 10:41:32.867822 8960 tf_logging.py:115] Restoring parameters from /home/mojzar/Desktop/lanenet-lane-detection/model Traceback (most recent call last): File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1292, in _do_call return fn(*args) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1277, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1367, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/mojzar/Desktop/lanenet-lane-detection/model: Failed precondition: /home/mojzar/Desktop/lanenet-lane-detection/model; Is a directory: perhaps your file is in a different file format and you need to use a different restore operator? [[{{node save/RestoreV2}} = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, …, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device=“/job:localhost/replica:0/task:0/device:CPU:0”](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “test_lanenet.py”, line 250, in <module> test_lanenet(args.image_path, args.weights_path, args.use_gpu) File “test_lanenet.py”, line 109, in test_lanenet saver.restore(sess=sess, save_path=‘/home/mojzar/Desktop/lanenet-lane-detection/model’) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 1538, in restore {self.saver_def.filename_tensor_name: save_path}) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 887, in run run_metadata_ptr) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1110, in _run feed_dict_tensor, options, run_metadata) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1286, in _do_run run_metadata) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1308, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/mojzar/Desktop/lanenet-lane-detection/model: Failed precondition: /home/mojzar/Desktop/lanenet-lane-detection/model; Is a directory: perhaps your file is in a different file format and you need to use a different restore operator? [[{{node save/RestoreV2}} = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, …, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device=“/job:localhost/replica:0/task:0/device:CPU:0”](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

Caused by op ‘save/RestoreV2’, defined at: File “test_lanenet.py”, line 250, in <module> test_lanenet(args.image_path, args.weights_path, args.use_gpu) File “test_lanenet.py”, line 94, in test_lanenet saver = tf.train.Saver() File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 1094, in init self.build() File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 1106, in build self._build(self._filename, build_save=True, build_restore=True) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 1143, in _build build_save=build_save, build_restore=build_restore) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 787, in _build_internal restore_sequentially, reshape) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 406, in _AddRestoreOps restore_sequentially) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py”, line 854, in bulk_restore return io_ops.restore_v2(filename_tensor, names, slices, dtypes) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py”, line 1466, in restore_v2 shape_and_slices=shape_and_slices, dtypes=dtypes, name=name) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py”, line 787, in _apply_op_helper op_def=op_def) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py”, line 488, in new_func return func(*args, **kwargs) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py”, line 3272, in create_op op_def=op_def) File “/home/mojzar/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py”, line 1768, in init self._traceback = tf_stack.extract_stack()

DataLossError (see above for traceback): Unable to open table file /home/mojzar/Desktop/lanenet-lane-detection/model: Failed precondition: /home/mojzar/Desktop/lanenet-lane-detection/model; Is a directory: perhaps your file is in a different file format and you need to use a different restore operator? [[{{node save/RestoreV2}} = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, …, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device=“/job:localhost/replica:0/task:0/device:CPU:0”](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] ` What is wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MaybeShewill-CVcommented, Nov 9, 2018

@FrancisGee ==! Should be tusimple_lanenet_vgg_2018-10-19-13-33-56.ckpt-200000 not tusimple_lanenet_vgg_2018-10-19-13-33-56.ckpt-200000.data-00000-of-00001. Seems you are not familiar with tensorflow at all ==!

0reactions
MaybeShewill-CVcommented, Nov 9, 2018

@Mojzaar No you have to develop it by yourself:)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with tf.train.Saver() and GPU - TensorFlow
Solved doing this: tf.Session(); model; saver = tf.train.Saver(); with tf.device():. Here an example code with tf.
Read more >
tf.train.Saver and saver.restore do not work when ... - GitHub
The error seems to be due to rgb_to_gray option. Pipeline config file has also subtract_channel_mean and random_horizontal_flip options, however ...
Read more >
tf.compat.v1.train.Saver | TensorFlow v2.11.0
tf.compat.v1.train.Saver is not supported for saving and restoring checkpoints in TF2. Please switch to tf.train.Checkpoint or tf.keras.
Read more >
Save and Restore - Easy TensorFlow
To save and restore your variables, all you need to do is to call the tf.train.Saver() at the end of you graph. #...
Read more >
A quick complete tutorial to save and restore Tensorflow models
Saver () class. saver = tf.train.Saver(). Remember that Tensorflow variables are only alive inside a session. So, you have to save the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found