Giter Club home page Giter Club logo

mobilepose-pi's People

Contributors

ba-san avatar savageyusuff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mobilepose-pi's Issues

[Question] What version of Python does this run on?

I'm a bit confused on what version of Python this runs on.

The guide on how to install PyTorch compiles it using Python 3.6. However, the OpenCV Guide is only for Python 2.7 and Python 3.5. Then when you run the final pip command to install the requirements, by default, it would be for Python 2.7. And finally, when you run the execution for either mobilenet or reset, it's run using just plain python, which would be 2.7.

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
eval_coco(full_name, os.path.join(PATH_PREFIX, 'result-gt-json.txt'), os.path.join(PATH_PREFIX, 'result-pred-json.txt'))
File "eval.py", line 103, in eval_coco
net = torch.load(net_path, map_location=lambda storage, loc: storage, pickle_module=pickle)
File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 385, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 562, in _load
magic_number = pickle_module.load(f, **pickle_load_args)
TypeError: load() got an unexpected keyword argument 'encoding'

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 - mdtux89/amr-eager#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
eval_coco(full_name, os.path.join(PATH_PREFIX, 'result-gt-json.txt'), os.path.join(PATH_PREFIX, 'result-pred-json.txt'))
File "eval.py", line 138, in eval_coco
output = net(Variable(sample_data['image'],volatile=True))
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/home/pi/MobilePose-Pi/mobilepose-pi/mobilenetv2.py", line 108, in forward
x = self.features(x)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 97, in forward
input = module(input)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 97, in forward
input = module(input)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/conv.py", line 332, in forward
if self.padding_mode == 'circular':
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 537, in getattr
type(self).name, name))
AttributeError: 'Conv2d' object has no attribute 'padding_mode'

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?

Torchvision install guide might be a bit misleading.

After installing PyTorch using your guide, I proceeded to install torchvision. I followed the repo you linked and I used the following commands:

cd ~
mkdir torchvision_install && cd torchvision_install
git clone https://github.com/pytorch/vision
cd vision

And since you suggested we install from source, I followed the repo's guide and ran:

python setup.py install

The installation stops, because I don't have permissions in a certain folder that the setup.py is trying to write to. This is the log:

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/test-easy-install-4269.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python3.5/dist-packages/

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

So instead of just python setup.py install, I do:

sudo python setup.py install

However, I got this error:

RuntimeError: PyTorch does not currently provide packages for PyPI (see status at pytorch/pytorch#566).
Please follow the instructions at http://pytorch.org/ to install with miniconda instead.

I tried

sudo python3 setup.py install

Which would make sense. Torchvision requires PyTorch, and PyTorch was installed in python3, as per your guide.

But it seems that I need to have Pillow installed first.

I'll try to go through installing torchvision using python3.5. But it's a bit worrying because in your requirements, you mentioned that the environment is Python 2.7, but so far, the installations seem to be in Python 3.5. Even the OpenCV Install guide for the Raspberry Pi installs it on Python 3.5.

I'll keep this updated as I work on installing torchvision.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.