phoenix104104 / fast_blind_video_consistency

Learning Blind Video Temporal Consistency (ECCV 2018)
http://vllab.ucmerced.edu/wlai24/video_consistency/
Other
415 stars 63 forks source link

No module named 'resample2d_package' #6

Open Angelalgz opened 5 years ago

Min-Sheng commented 5 years ago

I also encounter this problem. Does anyone know why this is happening and how to fix it?

phoenix104104 commented 5 years ago

Can you show the command that you encountered this problem? Note that resampled2d needs to be compiled first by: cd networks/resample2d_package ./make.sh

Min-Sheng commented 5 years ago

I found it's the same problem as Issue #4 and #5 . Just import every modules with from .xxx[module path] import XXX[module name], like from .resample2d_package.modules.resample2d import Resample2d in every python files in networks directory.

Angelalgz commented 5 years ago

Just import every modules with from .xxx[module path] import XXX[module name], like from .resample2d_package.modules.resample2d import Resample2d in every python files in networks directory.

------------------ 原始邮件 ------------------ 发件人: "Min Sheng, Wu"notifications@github.com; 发送时间: 2019年1月9日(星期三) 上午10:20 收件人: "phoenix104104/fast_blind_video_consistency"fast_blind_video_consistency@noreply.github.com; 抄送: "刘光忠"839807254@qq.com; "Author"author@noreply.github.com; 主题: Re: [phoenix104104/fast_blind_video_consistency] No module named'resample2d_package' (#6)

I also encounter this problem. Does anyone know why this is happening and how to fix it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

rodrigosilvafe commented 5 years ago

Thanks for all the hints.

I also have the same issue: ModuleNotFoundError: No module named 'resample2d_package'

I used the make.sh from resample2d_package and still get the same error (this "make .sh step" is not indicated in the readme file on the code page at the github of this work)

I tried with the "import every modules with from .xxx[module path] import XXX[module name]" All the modules of this kind that I found:

from .FlowNet2 import from .vgg import from .TransformNet import *

So I copied all of these to every py file on networks, i get: ModuleNotFoundError: No module named 'ConvLSTM'

Then I tried with:

from .FlowNet2 import from .vgg import from .TransformNet import * from .import FlowNetC from .import FlowNetS from .import FlowNetSD from .import FlowNetFusion

So I copied all of these to every py file on networks, i get:

ModuleNotFoundError: No module named 'submodules'

Finally, I tried:

from .FlowNet2 import from .vgg import from .TransformNet import * from .import FlowNetC from .import FlowNetS from .import FlowNetSD from .import FlowNetFusion

from resample2d_package.modules.resample2d import Resample2d from channelnorm_package.modules.channelnorm import ChannelNorm from submodules import * from correlation_package.modules.correlation import Correlation from ConvLSTM import ConvLSTM from collections import namedtuple from torchvision import models

And get the same error at the beginning

Please note there is not "from .resample2d_package.modules.resample2d import Resample2d" module There is without the dot at the beginning "from resample2d_package.modules.resample2d import Resample2d"

I am working on colab, cuda 10.0, torch 0.4.0.

Any help would be very appreciated Thanks

rodrigosilvafe commented 5 years ago

In the .py files at the networks folder I changed some of the imports:

from resample2d_package.modules.resample2d import Resample2d from channelnorm_package.modules.channelnorm import ChannelNorm from submodules import * from ConvLSTM import ConvLSTM

Basically, I added networks. to the imports

from networks.resample2d_package.modules.resample2d import Resample2d from networks.channelnorm_package.modules.channelnorm import ChannelNorm from networks.submodules import * from networks.ConvLSTM import ConvLSTM

I think this solve the problem of the import

Now I am using Cuda 9.0.176, torch 0.4.0, gcc 6.5.0 and g++ 6.5.0 (on Colab)

Now, when I use the !python test_pretrained.py -dataset DAVIS -task WCT/wave I get TypeError: a bytes-like object is required, not 'str'

Do I have to download some of the dataset? are they neccessary to work on a new video?

Thanks

Angelalgz commented 5 years ago

Could you tell me which line reported an error

------------------ 原始邮件 ------------------ 发件人: "rodrigosilvafe"notifications@github.com; 发送时间: 2019年2月27日(星期三) 凌晨0:24 收件人: "phoenix104104/fast_blind_video_consistency"fast_blind_video_consistency@noreply.github.com; 抄送: "刘光忠"839807254@qq.com; "Author"author@noreply.github.com; 主题: Re: [phoenix104104/fast_blind_video_consistency] No module named'resample2d_package' (#6)

In the .py files at the networks folder I changed some of the imports:

from resample2d_package.modules.resample2d import Resample2d from channelnorm_package.modules.channelnorm import ChannelNorm from submodules import * from ConvLSTM import ConvLSTM

Basically, I added networks. to the imports

from networks.resample2d_package.modules.resample2d import Resample2d from networks.channelnorm_package.modules.channelnorm import ChannelNorm from networks.submodules import * from networks.ConvLSTM import ConvLSTM

I think this solve the problem of the import

Now I am using Cuda 9.0.176, torch 0.4.0, gcc 6.5.0 and g++ 6.5.0 (on Colab)

Now, when I use the !python test_pretrained.py -dataset DAVIS -task WCT/wave I get TypeError: a bytes-like object is required, not 'str'

Do I have to download some of the dataset? are they neccessary to work on a new video?

Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

rodrigosilvafe commented 5 years ago

Thanks for the reply

When I use:

python test_pretrained.py -dataset DAVIS -task WCT/wave

I get:

Namespace(cuda=True, data_dir='data', dataset='DAVIS', gpu=0, list_dir='lists', phase='test', redo=False, size_multiplier=4, task='WCT/wave') Load pretrained_models/ECCV18_blind_consistency_opts.pth Traceback (most recent call last): File "test_pretrained.py", line 48, in model_opts = pickle.load(f) TypeError: a bytes-like object is required, not 'str'

Thanks again

Angelalgz commented 5 years ago

File "test_pretrained.py", line 47,you need change the 'with open(opts_filename, 'r') as f:' into 'with open(opts_filename, 'rb') as f:'

------------------ 原始邮件 ------------------ 发件人: "rodrigosilvafe"notifications@github.com; 发送时间: 2019年2月27日(星期三) 中午11:03 收件人: "phoenix104104/fast_blind_video_consistency"fast_blind_video_consistency@noreply.github.com; 抄送: "刘光忠"839807254@qq.com; "Author"author@noreply.github.com; 主题: Re: [phoenix104104/fast_blind_video_consistency] No module named'resample2d_package' (#6)

Thanks for the reply

When I use:

python test_pretrained.py -dataset DAVIS -task WCT/wave

I get:

Namespace(cuda=True, data_dir='data', dataset='DAVIS', gpu=0, list_dir='lists', phase='test', redo=False, size_multiplier=4, task='WCT/wave') Load pretrained_models/ECCV18_blind_consistency_opts.pth Traceback (most recent call last): File "test_pretrained.py", line 48, in model_opts = pickle.load(f) TypeError: a bytes-like object is required, not 'str'

Thanks again

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

rodrigosilvafe commented 5 years ago

Thanks, that solved the TypeError

luhannan commented 5 years ago

Add " sys.path.append('./networks') " before " ### custom lib " will solve the import error. The author's environment is probably python2, which uses relative path when imports modules. However, python3 uses absolute path, which is the path of "test_pretrained.py".

linshideng commented 2 years ago

Add " sys.path.append('./networks') " before " ### custom lib " will solve the import error. The author's environment is probably python2, which uses relative path when imports modules. However, python3 uses absolute path, which is the path of "test_pretrained.py".

Thank you so much. it did work finally

Ssakura-go commented 2 years ago

Add " sys.path.append('./networks') " before " ### custom lib " will solve the import error. The author's environment is probably python2, which uses relative path when imports modules. However, python3 uses absolute path, which is the path of "test_pretrained.py".

Thank you so much. it did work finally

Hello, dear friend, I'd like to try this model on my data, however, I couldn't get right environment it based on. Therefore, if you are free, could you please share the env setting to me?