MobilePose-Pi
MobilePose-Pi copied to clipboard
TypeError: load() got an unexpected keyword argument 'encoding'
Dear Sirs, I am able to install Pytorch and all other required libs. My setup - Pi 3, model B, python2.7, OpenCV 3.4. TypeError occurred, however, as shown below -
pi@raspberrypi:~/MobilePose-Pi/mobilepose-pi $ python eval.py --model mobilenet
0
Loading testing dataset, wait...
100%|██████████| 1/1 [00:10<00:00, 10.58s/it]
Traceback (most recent call last):
File "eval.py", line 158, in
I noticed, in ~/MobilePose-Pi/mobilepose-pi/models directory, there is a '.t7' extension for three different models, mobilenetv2_224x224-robust.t7, resnet18_227x227-robust.t7, and shufflenetv2_224x224.t7, which are for Torch not for PyTorch. Is the TypeError due to this? Ref - https://github.com/mdtux89/amr-eager/issues/4
After digging in, I noticed line 99, 100 in ~/MobilePose-Pi/mobilepose-pi/eval.py - pickle.load = partial(pickle.load, encoding="latin1") # code added to interface to python3 pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1") # code added to interface to python3 These codes are for python3? Since I used python2.7 for execution eval.py, are these codes the reason for TypeError? After commenting out line 99, 100, another error occur - AttributeError: 'Conv2d' object has no attribute 'padding_mode' (Details shown below)
pi@raspberrypi:~/MobilePose-Pi/mobilepose-pi $ python eval.py --model mobilenet
0
Loading testing dataset, wait...
100%|██████████| 1/1 [00:09<00:00, 9.28s/it]
==> write./results/mobilenet/result-gt-json.txt
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "eval.py", line 158, in
For executing eval.py on Pi 3 using python2.7, are following codes correct for execution? - # cpu mode pickle.load = partial(pickle.load, encoding="latin1") # code added to interface to python3 pickle.Unpickler = partial(pickle.Unpickler, encoding="latin1") # code added to interface to python3 # model = torch.load(model_file, map_location=lambda storage, loc: storage, pickle_module=pickle) net = Net() net = torch.load(net_path, map_location=lambda storage, loc: storage, pickle_module=pickle) If not, how to modify?