xingyizhou / pytorch-pose-hg-3d

PyTorch implementation for 3D human pose estimation
GNU General Public License v3.0
615 stars 141 forks source link

Demo.py issue: 'ascii' codec can't decode byte 0xc3 in position 875 #28

Closed ma-rv closed 6 years ago

ma-rv commented 6 years ago

Hey, trying to run the demo, I'm receiving the following error. Any suggestions on how to fix it? Thank you!

(base) D:\xx\Pose\src>python demo.py -demo images/h36m_1214.png Traceback (most recent call last): File "demo.py", line 31, in main() File "demo.py", line 15, in main model = torch.load('hgreg-3d.pth').cuda() File "C:\Users\xx\Anaconda3\lib\site-packages\torch\serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "C:\Users\xx\Anaconda3\lib\site-packages\torch\serialization.py", line 469, in _load result = unpickler.load() UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 875: ordinal not in range(128)

DNALuo commented 6 years ago

HI, @marv17 . I have the same problem. Would you mind saying how you solve the problem?

ma-rv commented 6 years ago

Hey, solved it by adding:

from functools import partial
import pickle

pickle.load = partial(pickle.load, encoding="latin1")
pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1")

And changing model load to:

model = torch.load('hgreg-3d.pth', map_location=lambda storage, loc: storage, pickle_module=pickle)
DNALuo commented 6 years ago

@marv17 It solves the problem. Thank you so much.