papulke / face-of-art

Code for "The Face of Art: Landmark Detection and Geometric Style in Portraits"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NotFoundError and DataLossError: model_foa/deep_heatmaps-60000

AnnTap opened this issue · comments

Thank you for sharing the code, this is exactly what I need! I must get facial landmarks on art portraits. But I'm struggling to get it working since a week.
I´m using Python=2.7, menpo=0.8.1. Installing compatible packages was already a challenge but now I´m getting this error when I try to run predict_landmarks.py::

NotFoundError (see above for traceback): Tensor name "heatmaps_network/conv_1/conv/bias" not found in checkpoint files ./model_foa/deep_heatmaps-60000.data-00000-of-00001
         [[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)]]

and

tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file ./model_foa/deep_heatmaps-60000.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 = 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)]]

I downloaded the model weights from this link and put it into the model_foa folder. I´m not even sure if this is correct?

However there is no deep_heatmaps-60000 and the downloaded files do not work. I get the above error when using the .meta, .index file or .data... file from dropbox.

I guess the correct file is missing? what is it supposed to be or where do I get it?

here´s the full error message:

Traceback (most recent call last):
  File "predict_landmarks.py", line 59, in <module>
    reuse=reuse, map_to_input_size=map_landmarks_to_original_image)
  File "/home/taphorna/thesis/foa_py2/deep_heatmaps_model_fusion_net.py", line 795, in get_landmark_predictions
    saver.restore(sess, self.test_model_path)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1775, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1140, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    run_metadata)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Tensor name "heatmaps_network/conv_1/conv/bias" not found in checkpoint files ./model_foa/deep_heatmaps-60000.index
         [[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 u'save/RestoreV2', defined at:
  File "predict_landmarks.py", line 59, in <module>
    reuse=reuse, map_to_input_size=map_landmarks_to_original_image)
  File "/home/taphorna/thesis/foa_py2/deep_heatmaps_model_fusion_net.py", line 794, in get_landmark_predictions
    saver = tf.train.Saver()
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1311, in __init__
    self.build()
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1320, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1357, in _build
    build_save=build_save, build_restore=build_restore)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 809, in _build_internal
    restore_sequentially, reshape)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 448, in _AddRestoreOps
    restore_sequentially)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 860, in bulk_restore
    return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1458, in restore_v2
    shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
    op_def=op_def)
  File "/home/taphorna/miniconda3/envs/foa/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1654, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

NotFoundError (see above for traceback): Tensor name "heatmaps_network/conv_1/conv/bias" not found in checkpoint files ./model_foa/deep_heatmaps-60000.index
         [[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)]]

After struggling for days, I finally found out the mistake was somewhere else:
I had model_path = './model_foa/deep_heatmaps-60000' instead of model_path = 'model_foa/deep_heatmaps-60000'. that´s it... now it works :D

I created the two folders by myself