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

'BatchNorm2d' object has no attribute 'track_running_stats' #10

Closed FedericoBarone994 closed 5 years ago

FedericoBarone994 commented 5 years ago

Hi!! I'm using your network inside my little project (i'm using Pytorch 0.4.0 on GPU), but every time i try to test the pretrained (Ours model) by launching the command: "python test_model_on_NYU.py -num_iter 1000 -prev_model_file ../results/Best_model_period1.pt -mode test -crop 8" (NYU dataset correctly downloaded, command launched in the "src/experiments" directory) this error occurs:

Traceback (most recent call last): File "test_model_on_NYU.py", line 261, in batch_output = model(Variable(_batch_input_cpu).cuda()) File "/home/orobix/miniconda3/envs/fbarone/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, kwargs) File "/home/orobix/projects/fbarone/software/relarive-depth/relative-depth-using-pytorch/src/experiment/models/hourglass.py", line 118, in forward return self.seq(x) File "/home/orobix/miniconda3/envs/fbarone/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "/home/orobix/miniconda3/envs/fbarone/lib/python3.7/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/home/orobix/miniconda3/envs/fbarone/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, kwargs) File "/home/orobix/miniconda3/envs/fbarone/lib/python3.7/site-packages/torch/nn/modules/batchnorm.py", line 56, in forward if self.training and self.track_running_stats: File "/home/orobix/miniconda3/envs/fbarone/lib/python3.7/site-packages/torch/nn/modules/module.py", line 518, in getattr type(self).name, name)) AttributeError: 'BatchNorm2d' object has no attribute 'track_running_stats'

I think it is version related, but i'm not sure. Best regards!

arcchang1236 commented 5 years ago

I met the same problem. How did u solve it?

FedericoBarone994 commented 5 years ago

sry didn't solved, the problem was related to pytorch version. Pytorch 0.1(version of this project) is not compatible with the new one, so i used a different network : https://github.com/iro-cp/FCRN-DepthPrediction which unfortunately is implemented in Tensorflow