VisualComputingInstitute / triplet-reid

Code for reproducing the results of our "In Defense of the Triplet Loss for Person Re-Identification" paper.
https://arxiv.org/abs/1703.07737
MIT License
764 stars 215 forks source link

ValueError: Can't load save_path when it is None. #66

Closed anilsh closed 5 years ago

anilsh commented 5 years ago

After running embed_detections(opts, detections) I am getting following error:

Restoring from checkpoint: None Traceback (most recent call last): File "embed_detections.py", line 247, in main() File "embed_detections.py", line 208, in main tf.train.Saver().restore(sess, checkpoint) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1534, in restore raise ValueError("Can't load save_path when it is None.") ValueError: Can't load save_path when it is None.

Any hacks to fix it?

Pandoro commented 5 years ago

We do not have a file caled embed_detections.py so I'm going to guess that you actually copied the embed.py and modified it. In that case what you are trying to "fix" doesn't make any sense. The error happens when you load the model. If you do not load a trained model, you are not able to create valid embeddings.

Make sure to train a model or get a pretrained one and load it properly. Aka the "hack" to fix it, is to just use it correctly.

I'm closing this since it does not affect anyone else and there is nothing to really fix here.

anilsh commented 5 years ago

My bad. I am calling embed.py in another project which is using your code for re-identification. The actual error is following, sorry for earlier error (I will modify that too):

Traceback (most recent call last): File "embed.py", line 252, in main() File "embed.py", line 213, in main tf.train.Saver().restore(sess, checkpoint) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1682, in restore raise ValueError("Can't load save_path when it is None.") ValueError: Can't load save_path when it is None.

=> If you do not load a trained model, you are not able to create valid embeddings. Do you mean that I can't train it from scratch? I am providing the pretrained resnet to it.

I am trying tf 1.5.0.

Pandoro commented 5 years ago

You of course can train from scratch, which is typically a good idea when you are using other datasets, however, the embed.py script is not used for this. You will need to train your model with train.py and then specify a checkpoint made during training in order to load that in embed.py. The pretrained ResNet weights do not contain all the weights (added new embedding layers) so you cannot just restore from that in embed.py either.