cardwing / Codes-for-Lane-Detection

Learning Lightweight Lane Detection CNNs by Self Attention Distillation (ICCV 2019)
MIT License
1.04k stars 333 forks source link

Unable to load pretrained model #320

Closed sandeepnmenon closed 2 years ago

sandeepnmenon commented 3 years ago

As per SCNN-Tensorflow readme I downloaded the pretrained model and am running the code

CUDA_VISIBLE_DEVICES="0" python test_lanenet.py --weights_path ../model_culane-71-3/culane_lanenet_vgg_2018-12-01-14-38-37.ckpt-10000.data-00000-of-00001 --image_path ../test_data/list/data_test_one.txt

However I am getting a loading error

Traceback (most recent call last):
  File "test_lanenet.py", line 121, in <module>
    test_lanenet(args.image_path, args.weights_path, args.use_gpu, img_name, args.batch_size, save_dir)
  File "test_lanenet.py", line 79, in test_lanenet
    saver.restore(sess=sess, save_path=weights_path)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1560, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1124, in _run
    feed_dict_tensor, options, run_metadata)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    options, run_metadata)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file ../model_culane-71-3/culane_lanenet_vgg_2018-12-01-14-38-37.ckpt-10000.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
     [[Node: save/RestoreV2_58 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_58/tensor_names, save/RestoreV2_58/shape_and_slices)]]
     [[Node: save/RestoreV2_12/_151 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_324_save/RestoreV2_12", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]()]]

I see three files in the pretrained model zip

  1. culane_lanenet_vgg_2018-12-01-14-38-37.ckpt-10000.data-00000-of-00001
  2. culane_lanenet_vgg_2018-12-01-14-38-37.ckpt-10000.index
  3. culane_lanenet_vgg_2018-12-01-14-38-37.ckpt-10000.meta

As per the size the first file should be the model weights, however the above error is thrown. (I tried giving the other files as parameter as well)

fahadchauhan4 commented 3 years ago

use path like this: "culane_lanenet_vgg_2018-12-01-14-38-37.ckpt-10000" without ".data-00000-of-00001"