HKUST-Aerial-Robotics / MVDepthNet

This repository provides PyTorch implementation for 3DV 2018 paper "MVDepthNet: real-time multiview depth estimation neural network"
GNU General Public License v3.0
308 stars 72 forks source link

Problems when running example.py #21

Closed Beniko95J closed 4 years ago

Beniko95J commented 4 years ago

Hi, thank you for the project!

When I run the example.py, I meet the following decoding problem:

Traceback (most recent call last):   File "example.py", line 16, in <module>     sample_datas = pickle.load(fp) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7 in position 1: ordinal not in range(128)

Is the sample images link(https://www.dropbox.com/s/hr59f24byc3x8z3/sample_data.pkl.tar.gz?dl=0) degenerated or should I modify the encoding? (I have tried encoding='utf-8' but still does not work).

Thanks!

WANG-KX commented 4 years ago

hi, are you using python3?

Beniko95J commented 4 years ago

Yes, I am using python3.

WANG-KX commented 4 years ago

the encoding is different between python2 and python3. Check this out: https://stackoverflow.com/questions/28218466/unpickling-a-python-2-object-with-python-3

Beniko95J commented 4 years ago

Thank you for the quick reply and now i can solve this problem.

However, i meet another problem about the version issue of python2 and python3. the error message is as follows, seems to be related to the difference of division in python2 and python3:

/home/benik/Documents/MVDepthNet/MVDepthNet/depthNet_model.py:117: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaimingnormal. init.kaiming_normal(m.weight, mode='fan_out') /home/benik/Documents/MVDepthNet/MVDepthNet/depthNetmodel.py:123: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. init.constant(m.weight, 1) /home/benik/Documents/MVDepthNet/MVDepthNet/depthNetmodel.py:125: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. init.constant(m.bias, 0) /home/benik/Documents/MVDepthNet/MVDepthNet/depthNetmodel.py:120: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. init.constant(m.bias, 0) example.py:39: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. depth_image_cuda = Variable(depth_image_cuda, volatile=True) example.py:42: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. left_image_cuda = Variable(left_image_cuda, volatile=True) example.py:45: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. right_image_cuda = Variable(right_image_cuda, volatile=True) Traceback (most recent call last): File "example.py", line 62, in predict_depths = depthnet(left_image_cuda, right_image_cuda, KRKiUV_cuda_T, KT_cuda_T) File "/home/benik/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, kwargs) File "/home/benik/Documents/MVDepthNet/MVDepthNet/depthNet_model.py", line 173, in forward conv1 = self.conv1(x) File "/home/benik/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/benik/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/home/benik/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, kwargs) File "/home/benik/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 338, in forward self.padding, self.dilation, self.groups) TypeError: conv2d(): argument 'padding' must be tuple of ints, but found element of type float at pos 1

Would you please tell me where should I change your code to make it run under python3?

Thank you very much!

WANG-KX commented 4 years ago

Sorry, I did not test the code in python3. Maybe you need to do it yourself. One hint from the information you provided. Add int to all the padding. https://github.com/HKUST-Aerial-Robotics/MVDepthNet/blob/7a13790369559a365ee0fd914f12cfb3524c759b/depthNet_model.py#L22 to padding = int((kernel_size - 1)/2)

Beniko95J commented 4 years ago

It works, thank you for the replies.

Cheers,