datitran / face2face-demo

pix2pix demo that learns from facial landmarks and translates this into a face
https://medium.com/@datitran/face2face-a-pix2pix-demo-that-mimics-the-facial-expression-of-the-german-chancellor-b6771d65bf66
MIT License
1.44k stars 423 forks source link

Error: Key generator/encoder_8/conv/filter not found in checkpoint #13

Closed lionawurscht closed 6 years ago

lionawurscht commented 6 years ago

Hey, I just finished training for ~2 days and now tried to continue with your instructions. Since that step isn't described: I guessed I had to copy the face2face-model folder over to the root of your projects folder and then ran: python reduce_model.py --model-input face2face-model --model-output face2face-reduced-model Unfortunately that led to a big error message:

Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1323, in _do_call return fn(*args) File "/usr/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1302, in _run_fn status, run_metadata) File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: Key generator/encoder_8/conv/filter not found in checkpoint [[Node: save/RestoreV2_43 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_43/tensor_names, save/RestoreV2_43/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "reduce_model.py", line 215, in saver.restore(sess, checkpoint) File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1666, in restore {self.saver_def.filename_tensor_name: save_path}) File "/usr/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 889, in run run_metadata_ptr) File "/usr/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1120, in _run feed_dict_tensor, options, run_metadata) File "/usr/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1317, in _do_run options, run_metadata) File "/usr/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1336, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.NotFoundError: Key generator/encoder_8/conv/filter not found in checkpoint [[Node: save/RestoreV2_43 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_43/tensor_names, save/RestoreV2_43/shape_and_slices)]]

Caused by op 'save/RestoreV2_43', defined at: File "reduce_model.py", line 214, in saver = tf.train.Saver() File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1218, in init self.build() File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1227, in build self._build(self._filename, build_save=True, build_restore=True) File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1263, in _build build_save=build_save, build_restore=build_restore) File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 751, in _build_internal restore_sequentially, reshape) File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 427, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "/usr/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 267, in restore_op [spec.tensor.dtype])[0]) File "/usr/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1021, in restore_v2 shape_and_slices=shape_and_slices, dtypes=dtypes, name=name) File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2956, in create_op op_def=op_def) File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): Key generator/encoder_8/conv/filter not found in checkpoint [[Node: save/RestoreV2_43 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_43/tensor_names, save/RestoreV2_43/shape_and_slices)]]

I have to admit that I never worked with tensorflow and used the version 1.4.1. I tried downgrading to 1.2.1 but that led to another error. Should I retrain with the older version of tensorflow or am I missing something else?

allenanswerzq commented 6 years ago

The problem here is that pix2pix has been updated after trained this demo. So you can reset back to April version that everything will be work. Hope this can help you.

lionawurscht commented 6 years ago

Thanks, that solved it :)