mpatacchiola/deepgaze

cnn_head_pose_estimation: problems with restoring checkpoint

michavdherik opened this issue · 10 comments

Dear mpatacchiola & anyone reading this,

I am using your program in order to determine the head pose estimation. However I get an error which reads as follows:

NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for /home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/pitch/./cnn_cccdd_30k
[[Node: save_1/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, 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_1/Const_0_0, save_1/RestoreV2/tensor_names, save_1/RestoreV2/shape_and_slices)]]

So the checkpoint file is recognized, however it seems that it can't find cnn_cccdd_30k from the contents of 'checkpoint'

model_checkpoint_path: "./cnn_cccdd_30k"
all_model_checkpoint_paths: "./cnn_cccdd_30k"

I tried changing the paths by removing the dot in front of it (same error), by adding .meta or .tf, but that didn't work and I still get errors, albeit different one:

NotFoundError (see above for traceback): Tensor name "conv1p_b" not found in checkpoint files /home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/pitch/./cnn_cccdd_30k.tf
[[Node: save_1/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, 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_1/Const_0_0, save_1/RestoreV2/tensor_names, save_1/RestoreV2/shape_and_slices)]]

I also tried shuffling around with forward slashes to see whether that could be the problem, but to no avail. I also tried putting the absolute path to cnn_cccdd_30k.tf in the original file, but this didn't work in combination with checkpoint_dir in tf.train.get_checkpoint_state.

This is my code to call CnnHeadPoseEstimator:

yawFP = "/home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/yaw"
pitchFP = "/home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/pitch"
HPE = CnnHeadPoseEstimator(yawFP, pitchFP)

This is the relevant code I changed the code in cnn_head_pose_estimator.py a little bit so I could work with a different checkpoint file, keeping the normal one as backup: (ps, this doesn't change the error when I work with the original code in cnn_head_pose_estimator.py)

y_ckpt = tf.train.get_checkpoint_state(checkpoint_dir=YawFilePath, latest_filename='checkpoint_2')
p_ckpt = tf.train.get_checkpoint_state(checkpoint_dir=PitchFilePath, latest_filename='checkpoint_2')

When I print these variables y_ckpt and p_ckpt, I get this, which I believe is correct.

model_checkpoint_path: "/home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/yaw/./cnn_cccdd_30k"
all_model_checkpoint_paths: "/home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/yaw/./cnn_cccdd_30k"

&

model_checkpoint_path: "/home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/pitch/cnn_cccdd_30k"
all_model_checkpoint_paths: "/home/micha/Desktop/BEP/NEW/deepgaze/etc/tensorflow/head_pose/pitch/cnn_cccdd_30k"

Hopefully somebody would be able to help me!

Thanks in advance,

Micha

Dear @michaaaaaaa

Did you try one of the official examples?
For instance, try one of the python files in the folder: deepgaze/examples/ex_cnn_head_pose_estimation_images.

They are ready to run. So you can simply call from terminal:

python ex_cnn_head_pose_estimation_images.py

This example works on my system (with Tensorflow 1.5 and Python 2.7). I think the error may be caused by the fact that you are using the old class to access the tensorflow checkpoints.

Thanks for the quick response! I can't access my code right now unfortunately.

However, I remember that inside the CnnHeadPoseEstimator class, there isn't a return yaw from the end of the example code:

my_head_pose_estimator.return_yaw(image)

I only remember a return_yaw_probability, and the same for pitch. I could be wrong, but as I mentioned I can not test my code right now.

I'm pretty sure that I'm using the right Python & Tensorflow versions though, I will definitely check those later to be sure.

Hi,
I'm facing the same issue of restoring the checkpoint while running the ex_cnn_head_pose_estimation_axes.py example.
The file didn't load the pitch and roll variables so I added

my_head_pose_estimator.load_roll_variables(os.path.realpath("../../etc/tensorflow/head_pose/roll/cnn_cccdd_30k.tf")) my_head_pose_estimator.load_pitch_variables(os.path.realpath("../../etc/tensorflow/head_pose/pitch/cnn_cccdd30k.tf"))
Even after loading the variable I faced the error
ValueError: [DEEPGAZE] CnnHeadPoseEstimator(load_pitch_variables): the pitch file path is incorrect.

Hi @shashvatshah9

Which version of Python and Tensorflow are you using? Did you try using the absolute path to the files?

@mpatacchiola I'm using it with python 3.6 and tensorflow -v 1.8.0.
I'm able to load the yaw tf model file which is at the same relative path.

Hi @shashvatshah9

That's quite wired. Both pitch and yaw checkpoints are checked by this line of code:

if(os.path.isfile(pitchFilePath)==False): raise ValueError('[DEEPGAZE] CnnHeadPoseEstimator(load_pitch_variables): the pitch file path is incorrect.')

It is quite strange that in one case it works and in the other it does not. Can you please try to load the checkpoints using the absolute path? You can also try to remove the extension .tf from the relative path:

my_head_pose_estimator.load_pitch_variables(os.path.realpath("../../etc/tensorflow/head_pose/pitch/cnn_cccdd30k"))

Lately I update the name of the checkpoints to have this extension and this may cause the issue in some way.

Yeah, issue got resolved, it works with absolute path on my machine. Had made some changes to the file structure of the project, which caused the issue. Thanks.

Great!

Hi @mpatacchiola
I'm facing the same error
am using your program in order to determine the head pose estimation. and im facing this error while im running the ex_cnn_head_pose_estimation:
my_head_pose_estimator.load_roll_variables(os.path.realpath("../../etc/tensorflow/head_pose/roll/cnn_cccdd_30k.tf"))
my_head_pose_estimator.load_pitch_variables(os.path.realpath("../../etc/tensorflow/head_pose/pitch/cnn_cccdd_30k.tf"))
my_head_pose_estimator.load_yaw_variables(os.path.realpath("../../etc/tensorflow/head_pose/yaw/cnn_cccdd_30k.tf"))
it give me this error
ValueError: [DEEPGAZE] CnnHeadPoseEstimator(load_roll_variables): the roll file path is incorrect.
can you help me to handle this error ?
NOTE: im using python Python 3.6.9 and tensorflow 1.14
@shashvatshah9 how do you solve your error i facing the same

Dear mpatacchiola & anyone reading this,

I am using your program in order to determine the head pose estimation. and im facing this error while im running the ex_cnn_head_pose_estimation:
my_head_pose_estimator.load_roll_variables(os.path.realpath("../../etc/tensorflow/head_pose/roll/cnn_cccdd_30k.tf"))
my_head_pose_estimator.load_pitch_variables(os.path.realpath("../../etc/tensorflow/head_pose/pitch/cnn_cccdd_30k.tf"))
my_head_pose_estimator.load_yaw_variables(os.path.realpath("../../etc/tensorflow/head_pose/yaw/cnn_cccdd_30k.tf"))
it give me this error
ValueError: [DEEPGAZE] CnnHeadPoseEstimator(load_roll_variables): the roll file path is incorrect.
i try to delete tf and i try too to add a point but dosent works
can you help me to handle this error ?

NOTE: im using python Python 3.6.9 and tensorflow 1.14