Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library path issue in Step 6: Run a simple dataset loader test #206

Open
oztc opened this issue Oct 24, 2019 · 2 comments
Open

library path issue in Step 6: Run a simple dataset loader test #206

oztc opened this issue Oct 24, 2019 · 2 comments

Comments

@oztc
Copy link

oztc commented Oct 24, 2019

when we run pytorch dense correspondence code, we encounter the following issue:


ImportError Traceback (most recent call last)
in ()
1 import dense_correspondence_manipulation.utils.utils as utils
2 utils.add_dense_correspondence_to_python_path()
----> 3 from dense_correspondence.training.training import *
4 import sys
5 import logging

/home/robot/code/dense_correspondence/training/training.py in ()
28 import pytorch_segmentation_detection.models.fcn as fcns
29 import pytorch_segmentation_detection.models.resnet_dilated as resnet_dilated
---> 30 from pytorch_segmentation_detection.transforms import (ComposeJoint,
31 RandomHorizontalFlipJoint,
32 RandomScaleJoint,

/home/robot/code/external/pytorch-segmentation-detection/pytorch_segmentation_detection/transforms.py in ()
5 from PIL import Image, ImageOps
6
----> 7 import torchvision.transforms.functional as F
8
9

ImportError: No module named functional

we have checked in the terminal by using the same code, obviously it is right library path. it is very strange why it is not right in Jupyter notebook.

@manuelli
Copy link
Collaborator

manuelli commented Oct 24, 2019

Hi,

I have just re-run the simple_datasets_test.ipynb on my local machine and confirmed it is working. I think the error you are seeing is because we use a custom fork of torchvision, not the standard pip version. It is important to follow the steps in the tutorial to ensure that this module gets loaded correctly.

As an example showing that import torchvision.transforms.functional as F works try the following in a terminal inside your docker container.

manuelli@paladin-44:~/code$ use_pytorch_dense_correspondence 
using pdc
manuelli@paladin-44:~/code$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dense_correspondence_manipulation.utils.utils as utils
>>> utils.add_dense_correspondence_to_python_path()
>>> import torchvision
>>> print torchvision.__file__
/home/manuelli/code/external/pytorch-segmentation-detection/vision/torchvision/__init__.pyc
>>> import torchvision.transforms.functional as F
>>> print torchvision.transforms.functions.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'functions'
>>> print torchvision.transforms.functional.__file__
/home/manuelli/code/external/pytorch-segmentation-detection/vision/torchvision/transforms/functional.pyc

Note that torchvision points the the submodule of our repo located at external/pytorch-segmentation-detection/vision/torchvision. If instead you see torchvison.__file__ pointing to a system installed copy namely

>>> print torchvision.__file__
/usr/local/lib/python2.7/dist-packages/torchvision/__init__.pyc
>>> 

you have a problem. My guess is that you have this error because you didn't clone down the submodules of our repo. This should have been completed in Step 3 of the tutorial. Hopefully this resolves your issue

@oztc
Copy link
Author

oztc commented Nov 4, 2019

Hi, Manuelli,

  we have already cloned the submodules before we had submitted this issue. we will follow your steps to reproduce your resule, thanks. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants