Ugness / PiCANet-Implementation

Pytorch Implementation of PiCANet: Learning Pixel-wise Contextual Attention for Saliency Detection
MIT License
178 stars 40 forks source link

I've met this error at cpu mode #5

Closed bemoregt closed 4 years ago

bemoregt commented 6 years ago

Hi, @pass1825 @Ugness

I've met this error at cpu mode:

RuntimeError: cannot initialize CUDA without ATen_cuda library

What's wrong with me?

from @bemoregt

Ugness commented 6 years ago

Can you explain what code and how did you run?

bemoregt commented 6 years ago

Hi, @pass1825 @Ugness

My Command:

$ python3 image_test.py --cuda 'cpu'

and input image path is changed with ny image path.

What's wrong with me?

MacOS X High Sierra, CPU Only, Python 3.6, Pytorch 0.4

from @bemoregt.

Ugness commented 6 years ago

I think your command should be $ python3 image_test.py --cuda cpu

without quotes. Sorry for making confusion.

bemoregt commented 6 years ago

Same error occured.

RuntimeError: cannot initialize CUDA without ATen_cuda library

and

map_location='cpu'

from @bemoregt.

Ugness commented 6 years ago

Sorry. I found why that error occur. I updated the code. Please download it again. or just modify the code in network.py line 27,

self.decoder.append( DecoderCell(size=cfg['Size'][i], in_channel=cfg['Channel'][i], out_channel=cfg['Channel'][i + 1], mode=cfg['PicaNet'][i]).cuda()) self.decoder.append(DecoderCell(size=cfg['Size'][5], in_channel=cfg['Channel'][5], out_channel=1, mode='C').cuda())

self.decoder.append( DecoderCell(size=cfg['Size'][i], in_channel=cfg['Channel'][i], out_channel=cfg['Channel'][i + 1], mode=cfg['PicaNet'][i])) self.decoder.append(DecoderCell(size=cfg['Size'][5], in_channel=cfg['Channel'][5], out_channel=1, mode='C')) I am really sorry.

bemoregt commented 6 years ago

JI, @Ugness @pass1825

OK, Thanks.

I'll try that one.

MacOS X High Sierra, CPU Only, Python 3.6, Pytorch 0.4

from @bemoregt.

bemoregt commented 6 years ago

Hi, @Ugness @pass1825

It's same.

kerb:Pytorch mun$ kerb:Pytorch mun$ python3 image_test.py Default path : /Users/mun/PiCANet-Implementation/Pytorch Namespace(batch_size=4, cuda='cuda', image_dir='../test', logdir='log/Image_test', model_dir=None) /Users/mun/PiCANet-Implementation/Pytorch Traceback (most recent call last): File "image_test.py", line 30, in model = Unet().to(device) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 370, in to return self._apply(convert) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 176, in _apply module._apply(fn) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 176, in _apply module._apply(fn) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 176, in _apply module._apply(fn) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 182, in _apply param.data = fn(param.data) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 368, in convert return t.to(device, dtype if t.is_floating_point() else None, non_blocking) RuntimeError: cannot initialize CUDA without ATen_cuda library kerb:Pytorch mun$

from @bemoregt

Ugness commented 6 years ago

In the Namespace, you can see your argument for cuda is 'cuda'. Namespace(batch_size=4, cuda='cuda', Can you run the code with --cuda cpu? That dashes are double dash(--). Sorry for asking you to run again. Since my env already have GPU and CUDA, it is hard for me to find error.

or if you can modify the code, please change all of args.cuda to 'cpu'

bemoregt commented 6 years ago

Oh, sheet. I missed, Sorry.

It works, Thank you.

from @bemoregt.

bemoregt commented 6 years ago

HI, @Ugness @pass1825

At this time, tensorboard not works ..

kerb:Pytorch mun$ tensorboard --logdir=./log/Image_test Traceback (most recent call last): File "/usr/local/bin/tensorboard", line 7, in from tensorboard.main import run_main File "/usr/local/lib/python3.6/site-packages/tensorboard/main.py", line 28, in import tensorflow as tf File "/usr/local/lib/python3.6/site-packages/tensorflow/init.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/usr/local/lib/python3.6/site-packages/tensorflow/python/init.py", line 52, in from tensorflow.core.framework.graph_pb2 import * File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_nodedefpb2 File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/node_def_pb2.py", line 16, in from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attrvaluepb2 File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2 File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resourcehandlepb2 File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 41, in options=None, file=DESCRIPTOR), TypeError: init() got an unexpected keyword argument 'file' kerb:Pytorch mun$

What's wrong with me?

from @bemoregt

Ugness commented 6 years ago

Oops, Sorry. I changed the default log directory to Pytorch/log/Image_test. But did not change the message. Please check with tensorboard --logdir=./Pytorch/log/Image_test I'll change the default dir.

bemoregt commented 6 years ago

@Ugness @pass1825 님, 안녕하세요?

현재 Pytorch 경로에서 명령어를 날리고 있으므로 텐서보드 로그경로는 --logdir=./log/Image_test 가 맞을거 같습니다.

경로 문제가 아닌거 같습니다. 아니면, 오히려 Pytorch/ 경로에서 명령어를 날리면 안되는 걸수도 있겠군요.

혹시 PiCANet-Implementation/ 경로에서 텐서보드 명령을 날려야 되는게 아닌지요?

@bemoregt 로부터.

Ugness commented 6 years ago

Thanks for asking with Korean. If you prefer to use Korean, please realize it to me.

I think I do not exactly understand the problem. If the directory is wrong, there will be no error message and just blank page.

I think there is no problem with using tensorboard at PiCANet-Implementation/ or not. If you have same error, I recommend you to use abstract directory. ex: D:/Ugness/Python/PiCANet-Implementation/Pytorch/log/Image_test

or please check your tensorboard version.

or set the port number with --port=12345 (or other port)

Ugness commented 6 years ago

Or I'll make the program to make image file output. Not to use tensorboard. I will add it as soon as possible.

bemoregt commented 6 years ago

Great!

ASAP, Please~

Ugness commented 6 years ago

I uploaded the file output program as image_test_file_output.py. Please check this. Hope to success~

bemoregt commented 6 years ago

Great~!

나의 iPhone에서 보냄

      1. 오후 9:50, Yoo Jaehoon notifications@github.com 작성:

I uploaded the file output program as image_test_file_output.py. Please check this. Hope to success~

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

bemoregt commented 6 years ago

kerb:PiCANet-Implementation mun$ python3 image_test_file_output.py Default path : /Users/mun/PICA2/PiCANet-Implementation Namespace(batch_size=4, cuda='cpu', image_dir='test', logdir='pytorch/images/Image_test', model_dir=None) /Users/mun/PICA2/PiCANet-Implementation Traceback (most recent call last): File "image_test_file_output.py", line 34, in model.load_state_dict(state_dict) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 698, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Unet: Missing key(s) in state_dict: "decoder.0.bn_en.num_batches_tracked", "decoder.0.bn_feature.num_batches_tracked", "decoder.1.bn_en.num_batches_tracked", "decoder.1.bn_feature.num_batches_tracked", "decoder.2.bn_en.num_batches_tracked", "decoder.2.bn_feature.num_batches_tracked", "decoder.3.bn_en.num_batches_tracked", "decoder.3.bn_feature.num_batches_tracked", "decoder.4.bn_en.num_batches_tracked", "decoder.4.bn_feature.num_batches_tracked", "decoder.5.bn_en.num_batches_tracked". kerb:PiCANet-Implementation mun$ ****


I'm using

device = torch.device(args.cuda)
args.model_dir = 'pytorch/models/25epo_210000step.ckpt'
state_dict = torch.load(args.model_dir, map_location='cpu')
Ugness commented 6 years ago

Maybe the error occured because the uploaded model is too old. (before the state_dict commit) Please try with 14epo_123000step.ckpt. or other 2018.09.01 uploaded models. If you want some specific step model, please let me know. I'll upload it.

or

Ugness commented 6 years ago

Did the code work well for other models? And can you explain the map_location='cpu' was necessary for cpu mode? If it is, I'll fix my code.

bemoregt commented 6 years ago

Not, Yet ..

Just a wait ~

Thanks.

bemoregt commented 6 years ago

It's same.

I used 14epo_123000step.ckpt model at this time.

kerb:PiCANet-Implementation mun$ python3 image_test_file_output.py Default path : /Users/mun/PICA2/PiCANet-Implementation Namespace(batch_size=4, cuda='cpu', image_dir='test', logdir='pytorch/images/Image_test', model_dir=None) /Users/mun/PICA2/PiCANet-Implementation Traceback (most recent call last): File "image_test_file_output.py", line 34, in model.load_state_dict(state_dict) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 698, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Unet: Missing key(s) in state_dict: "decoder.0.bn_en.num_batches_tracked", "decoder.0.bn_feature.num_batches_tracked", "decoder.1.bn_en.num_batches_tracked", "decoder.1.bn_feature.num_batches_tracked", "decoder.2.bn_en.num_batches_tracked", "decoder.2.bn_feature.num_batches_tracked", "decoder.3.bn_en.num_batches_tracked", "decoder.3.bn_feature.num_batches_tracked", "decoder.4.bn_en.num_batches_tracked", "decoder.4.bn_feature.num_batches_tracked", "decoder.5.bn_en.num_batches_tracked". kerb:PiCANet-Implementation mun$

May be Pytorch in Windows10 and MacOSX are so different. --;

from @bemoregt.

Ugness commented 6 years ago

I'll test my code again with drive files soon. I remember that those kind of errors with state_dict comes from layer name mismatch. And that error is also case of them. I'll test my code after 8pm(Seoul timezone) (because I have a schedule), but if you want to debug faster, please check the weight names with print(model.state_dict().keys()) and print(loaded_state_dict.keys())

Ugness commented 6 years ago

It works on my environment. It would be OS problem or CUDA problem. Maybe somewhere still need CUDA in my code.

Ugness commented 6 years ago
odict_keys(['encoder.seq.0.weight', 'encoder.seq.0.bias', 'encoder.seq.2.weight', 'encoder.seq.2.bias', 'encoder.seq.5.weight', 'encoder.seq.5.bias', 'encoder.seq.7.weight', 'encoder.seq.7.bias', 'encoder.seq.10.weight', 'encoder.seq.10.bias', 'encoder.seq.12.weight', 'encoder.seq.12.bias', 'encoder.seq.14.weight', 'encoder.seq.14.bias', 'encoder.seq.17.weight', 'encoder.seq.17.bias', 'encoder.seq.19.weight', 'encoder.seq.19.bias', 'encoder.seq.21.weight', 'encoder.seq.21.bias', 'encoder.seq.24.weight', 'encoder.seq.24.bias', 'encoder.seq.26.weight', 'encoder.seq.26.bias', 'encoder.seq.28.weight', 'encoder.seq.28.bias', 'encoder.conv6.weight', 'encoder.conv6.bias', 'encoder.conv7.weight', 'encoder.conv7.bias', 'decoder.0.bn_en.weight', 'decoder.0.bn_en.bias', 'decoder.0.bn_en.running_mean', 'decoder.0.bn_en.running_var', 'decoder.0.conv1.weight', 'decoder.0.conv1.bias', 'decoder.0.picanet.renet.vertical.weight_ih_l0', 'decoder.0.picanet.renet.vertical.weight_hh_l0', 'decoder.0.picanet.renet.vertical.bias_ih_l0', 'decoder.0.picanet.renet.vertical.bias_hh_l0', 'decoder.0.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_ih_l0', 'decoder.0.picanet.renet.horizontal.weight_hh_l0', 'decoder.0.picanet.renet.horizontal.bias_ih_l0', 'decoder.0.picanet.renet.horizontal.bias_hh_l0', 'decoder.0.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.0.picanet.renet.conv.weight', 'decoder.0.picanet.renet.conv.bias', 'decoder.0.conv2.weight', 'decoder.0.conv2.bias', 'decoder.0.bn_feature.weight', 'decoder.0.bn_feature.bias', 'decoder.0.bn_feature.running_mean', 'decoder.0.bn_feature.running_var', 'decoder.0.conv3.weight', 'decoder.0.conv3.bias', 'decoder.1.bn_en.weight', 'decoder.1.bn_en.bias', 'decoder.1.bn_en.running_mean', 'decoder.1.bn_en.running_var', 'decoder.1.conv1.weight', 'decoder.1.conv1.bias', 'decoder.1.picanet.renet.vertical.weight_ih_l0', 'decoder.1.picanet.renet.vertical.weight_hh_l0', 'decoder.1.picanet.renet.vertical.bias_ih_l0', 'decoder.1.picanet.renet.vertical.bias_hh_l0', 'decoder.1.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_ih_l0', 'decoder.1.picanet.renet.horizontal.weight_hh_l0', 'decoder.1.picanet.renet.horizontal.bias_ih_l0', 'decoder.1.picanet.renet.horizontal.bias_hh_l0', 'decoder.1.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.1.picanet.renet.conv.weight', 'decoder.1.picanet.renet.conv.bias', 'decoder.1.conv2.weight', 'decoder.1.conv2.bias', 'decoder.1.bn_feature.weight', 'decoder.1.bn_feature.bias', 'decoder.1.bn_feature.running_mean', 'decoder.1.bn_feature.running_var', 'decoder.1.conv3.weight', 'decoder.1.conv3.bias', 'decoder.2.bn_en.weight', 'decoder.2.bn_en.bias', 'decoder.2.bn_en.running_mean', 'decoder.2.bn_en.running_var', 'decoder.2.conv1.weight', 'decoder.2.conv1.bias', 'decoder.2.picanet.conv1.weight', 'decoder.2.picanet.conv1.bias', 'decoder.2.picanet.conv2.weight', 'decoder.2.picanet.conv2.bias', 'decoder.2.conv2.weight', 'decoder.2.conv2.bias', 'decoder.2.bn_feature.weight', 'decoder.2.bn_feature.bias', 'decoder.2.bn_feature.running_mean', 'decoder.2.bn_feature.running_var', 'decoder.2.conv3.weight', 'decoder.2.conv3.bias', 'decoder.3.bn_en.weight', 'decoder.3.bn_en.bias', 'decoder.3.bn_en.running_mean', 'decoder.3.bn_en.running_var', 'decoder.3.conv1.weight', 'decoder.3.conv1.bias', 'decoder.3.picanet.conv1.weight', 'decoder.3.picanet.conv1.bias', 'decoder.3.picanet.conv2.weight', 'decoder.3.picanet.conv2.bias', 'decoder.3.conv2.weight', 'decoder.3.conv2.bias', 'decoder.3.bn_feature.weight', 'decoder.3.bn_feature.bias', 'decoder.3.bn_feature.running_mean', 'decoder.3.bn_feature.running_var', 'decoder.3.conv3.weight', 'decoder.3.conv3.bias', 'decoder.4.bn_en.weight', 'decoder.4.bn_en.bias', 'decoder.4.bn_en.running_mean', 'decoder.4.bn_en.running_var', 'decoder.4.conv1.weight', 'decoder.4.conv1.bias', 'decoder.4.picanet.conv1.weight', 'decoder.4.picanet.conv1.bias', 'decoder.4.picanet.conv2.weight', 'decoder.4.picanet.conv2.bias', 'decoder.4.conv2.weight', 'decoder.4.conv2.bias', 'decoder.4.bn_feature.weight', 'decoder.4.bn_feature.bias', 'decoder.4.bn_feature.running_mean', 'decoder.4.bn_feature.running_var', 'decoder.4.conv3.weight', 'decoder.4.conv3.bias', 'decoder.5.bn_en.weight', 'decoder.5.bn_en.bias', 'decoder.5.bn_en.running_mean', 'decoder.5.bn_en.running_var', 'decoder.5.conv1.weight', 'decoder.5.conv1.bias', 'decoder.5.conv2.weight', 'decoder.5.conv2.bias'])
odict_keys(['encoder.seq.0.weight', 'encoder.seq.0.bias', 'encoder.seq.2.weight', 'encoder.seq.2.bias', 'encoder.seq.5.weight', 'encoder.seq.5.bias', 'encoder.seq.7.weight', 'encoder.seq.7.bias', 'encoder.seq.10.weight', 'encoder.seq.10.bias', 'encoder.seq.12.weight', 'encoder.seq.12.bias', 'encoder.seq.14.weight', 'encoder.seq.14.bias', 'encoder.seq.17.weight', 'encoder.seq.17.bias', 'encoder.seq.19.weight', 'encoder.seq.19.bias', 'encoder.seq.21.weight', 'encoder.seq.21.bias', 'encoder.seq.24.weight', 'encoder.seq.24.bias', 'encoder.seq.26.weight', 'encoder.seq.26.bias', 'encoder.seq.28.weight', 'encoder.seq.28.bias', 'encoder.conv6.weight', 'encoder.conv6.bias', 'encoder.conv7.weight', 'encoder.conv7.bias', 'decoder.0.bn_en.weight', 'decoder.0.bn_en.bias', 'decoder.0.bn_en.running_mean', 'decoder.0.bn_en.running_var', 'decoder.0.bn_en.num_batches_tracked', 'decoder.0.conv1.weight', 'decoder.0.conv1.bias', 'decoder.0.picanet.renet.vertical.weight_ih_l0', 'decoder.0.picanet.renet.vertical.weight_hh_l0', 'decoder.0.picanet.renet.vertical.bias_ih_l0', 'decoder.0.picanet.renet.vertical.bias_hh_l0', 'decoder.0.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.0.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_ih_l0', 'decoder.0.picanet.renet.horizontal.weight_hh_l0', 'decoder.0.picanet.renet.horizontal.bias_ih_l0', 'decoder.0.picanet.renet.horizontal.bias_hh_l0', 'decoder.0.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.0.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.0.picanet.renet.conv.weight', 'decoder.0.picanet.renet.conv.bias', 'decoder.0.conv2.weight', 'decoder.0.conv2.bias', 'decoder.0.bn_feature.weight', 'decoder.0.bn_feature.bias', 'decoder.0.bn_feature.running_mean', 'decoder.0.bn_feature.running_var', 'decoder.0.bn_feature.num_batches_tracked', 'decoder.0.conv3.weight', 'decoder.0.conv3.bias', 'decoder.1.bn_en.weight', 'decoder.1.bn_en.bias', 'decoder.1.bn_en.running_mean', 'decoder.1.bn_en.running_var', 'decoder.1.bn_en.num_batches_tracked', 'decoder.1.conv1.weight', 'decoder.1.conv1.bias', 'decoder.1.picanet.renet.vertical.weight_ih_l0', 'decoder.1.picanet.renet.vertical.weight_hh_l0', 'decoder.1.picanet.renet.vertical.bias_ih_l0', 'decoder.1.picanet.renet.vertical.bias_hh_l0', 'decoder.1.picanet.renet.vertical.weight_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.weight_hh_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_ih_l0_reverse', 'decoder.1.picanet.renet.vertical.bias_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_ih_l0', 'decoder.1.picanet.renet.horizontal.weight_hh_l0', 'decoder.1.picanet.renet.horizontal.bias_ih_l0', 'decoder.1.picanet.renet.horizontal.bias_hh_l0', 'decoder.1.picanet.renet.horizontal.weight_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.weight_hh_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_ih_l0_reverse', 'decoder.1.picanet.renet.horizontal.bias_hh_l0_reverse', 'decoder.1.picanet.renet.conv.weight', 'decoder.1.picanet.renet.conv.bias', 'decoder.1.conv2.weight', 'decoder.1.conv2.bias', 'decoder.1.bn_feature.weight', 'decoder.1.bn_feature.bias', 'decoder.1.bn_feature.running_mean', 'decoder.1.bn_feature.running_var', 'decoder.1.bn_feature.num_batches_tracked', 'decoder.1.conv3.weight', 'decoder.1.conv3.bias', 'decoder.2.bn_en.weight', 'decoder.2.bn_en.bias', 'decoder.2.bn_en.running_mean', 'decoder.2.bn_en.running_var', 'decoder.2.bn_en.num_batches_tracked', 'decoder.2.conv1.weight', 'decoder.2.conv1.bias', 'decoder.2.picanet.conv1.weight', 'decoder.2.picanet.conv1.bias', 'decoder.2.picanet.conv2.weight', 'decoder.2.picanet.conv2.bias', 'decoder.2.conv2.weight', 'decoder.2.conv2.bias', 'decoder.2.bn_feature.weight', 'decoder.2.bn_feature.bias', 'decoder.2.bn_feature.running_mean', 'decoder.2.bn_feature.running_var', 'decoder.2.bn_feature.num_batches_tracked', 'decoder.2.conv3.weight', 'decoder.2.conv3.bias', 'decoder.3.bn_en.weight', 'decoder.3.bn_en.bias', 'decoder.3.bn_en.running_mean', 'decoder.3.bn_en.running_var', 'decoder.3.bn_en.num_batches_tracked', 'decoder.3.conv1.weight', 'decoder.3.conv1.bias', 'decoder.3.picanet.conv1.weight', 'decoder.3.picanet.conv1.bias', 'decoder.3.picanet.conv2.weight', 'decoder.3.picanet.conv2.bias', 'decoder.3.conv2.weight', 'decoder.3.conv2.bias', 'decoder.3.bn_feature.weight', 'decoder.3.bn_feature.bias', 'decoder.3.bn_feature.running_mean', 'decoder.3.bn_feature.running_var', 'decoder.3.bn_feature.num_batches_tracked', 'decoder.3.conv3.weight', 'decoder.3.conv3.bias', 'decoder.4.bn_en.weight', 'decoder.4.bn_en.bias', 'decoder.4.bn_en.running_mean', 'decoder.4.bn_en.running_var', 'decoder.4.bn_en.num_batches_tracked', 'decoder.4.conv1.weight', 'decoder.4.conv1.bias', 'decoder.4.picanet.conv1.weight', 'decoder.4.picanet.conv1.bias', 'decoder.4.picanet.conv2.weight', 'decoder.4.picanet.conv2.bias', 'decoder.4.conv2.weight', 'decoder.4.conv2.bias', 'decoder.4.bn_feature.weight', 'decoder.4.bn_feature.bias', 'decoder.4.bn_feature.running_mean', 'decoder.4.bn_feature.running_var', 'decoder.4.bn_feature.num_batches_tracked', 'decoder.4.conv3.weight', 'decoder.4.conv3.bias', 'decoder.5.bn_en.weight', 'decoder.5.bn_en.bias', 'decoder.5.bn_en.running_mean', 'decoder.5.bn_en.running_var', 'decoder.5.bn_en.num_batches_tracked', 'decoder.5.conv1.weight', 'decoder.5.conv1.bias', 'decoder.5.conv2.weight', 'decoder.5.conv2.bias'])

In my case, my (saved model) and (model to load) has different keys but the code works well. I upgraded my pytorch version to 0.4.1. So I think it is a problem of pytorch version or OS.

Ugness commented 6 years ago

Please check this issue. It looks similar. https://github.com/pytorch/ELF/issues/15

bemoregt commented 6 years ago

I'm also 0.4.1 upgrded.

Is it a OS Problem ?

--;

Ugness commented 6 years ago

On the other issue, they recommend to install pytorch from source, not pip. But I'm not sure that would work. Or make model to evaluation mode first and then try to load state_dict.

model.eval()
model.load_state_dict(state_dict)
bemoregt commented 6 years ago

Other Pytorch sources working well in MacOSX.

Windows10 's Pytorch is specific? May be...

Ugness commented 6 years ago

Dose the loading error occur in other codes? like train.py or image_test_tensorboard.py

bemoregt commented 6 years ago

Thanks a lot.

2018-09-06 21:38 GMT+09:00, Yoo Jaehoon notifications@github.com:

I am going to simulate your environment

(MacOS X High Sierra, CPU Only, Python 3.6, Pytorch 0.4.1)

in docker. If I solve the problem, I'll send a mail to you. Thanks.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Ugness/PiCANet-Implementation/issues/5#issuecomment-419077657

Ugness commented 6 years ago

I could not find OSX docker image. But when I test the code in Linux env(https://hub.docker.com/r/pytorch/pytorch), code works. I'll try to upload my own docker image ASAP. If you want, you can run the code on pytorch/pytorch:latest docker image.

Ugness commented 6 years ago

Updated. Check readme.md. But, it's my first time to make docker image, the image is very unstable. You can just directly run docker with

docker run --name=torch -it -rm pytorch/pytorch
pip install tensorboardX
pip install datetime
git clone https://github.com/Ugness/PiCANet-Implementation