yifjiang / relative-depth-using-pytorch

Depth from a single RGB image using crowd-sourcing relative-depth datasets. The pytorch implementation of the NIPS paper: Single-Image Depth Perception in the Wild.
72 stars 14 forks source link

UpsamplingNearest2d' object has no attribute 'mode' #9

Open IConquer96 opened 6 years ago

IConquer96 commented 6 years ago

run the test_on_one_image.py

Processing sample ../../data/4.png /usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py:133: UserWarning: nn.UpsamplingNearest2d is deprecated. Use nn.Upsample instead. warnings.warn("nn.UpsamplingNearest2d is deprecated. Use nn.Upsample instead.") Traceback (most recent call last): File "test_on_one_image.py", line 73, in main() File "test_on_one_image.py", line 43, in main batch_output = (model(_processed_input)).float() File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 118, in forward return self.seq(x) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, *kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(input, kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 101, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, *kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 77, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(input, kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 52, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, *kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(input, kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 27, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, *kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py", line 134, in forward return super(UpsamplingNearest2d, self).forward(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py", line 79, in forward return F.upsample(input, self.size, self.scale_factor, self.mode) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 398, in getattr type(self).name, name)) AttributeError: 'UpsamplingNearest2d' object has no attribute 'mode'

Lvhhhh commented 5 years ago

hi,have u solve it?

King-Hell commented 4 years ago

I think this may be a version issue. I solved it by adding some parameters which not exisit in Pytorch 0.3 or lower. Perhaps this will help you. Or you can just change your version to 0.3.