PlanarReconstruction: _pickle.UnpicklingError: invalid load key, 'v'.

When I use predict.py to predict on a single image, I put pretrained.pt under ckpt to the root path and run: python predict.py with resume_dir=pretrained.pt image_path=/path/to/image. However, there is an error occur:

[user@bcm PlanarReconstruction]$ python predict.py with resume_dir=pretrained.pt image_path=ImagePath
WARNING - predict - No observers have been added to this run
INFO - predict - Running command 'predict'
INFO - predict - Started
ERROR - predict - Failed after 0:00:01!
Traceback (most recent calls WITHOUT Sacred internals):
  File "predict.py", line 40, in predict
    model_dict = torch.load(cfg.resume_dir, map_location=lambda storage, loc: storage)
  File "/home/user/anaconda2/envs/plane_embed/lib/python3.6/site-packages/torch/serialization.py", line 358, in load
    return _load(f, map_location, pickle_module)
  File "/home/user/anaconda2/envs/plane_embed/lib/python3.6/site-packages/torch/serialization.py", line 532, in _load
    magic_number = pickle_module.load(f)
_pickle.UnpicklingError: invalid load key, 'v'.

Could you give me some advices on what I should do with this error?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 23

Most upvoted comments

Please make sure you download the pre-trained model successfully and give the model path correctly.

thanks a lot! It is due to the incomplete model donwload. Considering that I used the ‘git clone’ command and it tell me download successfully, I think maybe there is something wrong with my git (may need git-lfs)

Please make sure you download the pre-trained model successfully and give the model path correctly.

@AdityaNikhil thanks! I downloaded the model manually and it worked!

@elliestath I fixed it by hosting my model on google drive. (You can host on some other platforms as well) Follow this answer from stackoverflow. Let me know if there’s anything else.