mileyan / AnyNet

(ICRA) Anytime Stereo Image Depth Estimation on Mobile Devices
https://mileyan.github.io/AnyNet/
MIT License
491 stars 125 forks source link

RuntimeError: Dimension out of range (expected to be in range of [-1, 0], but got 1) #5

Closed yellowYuga closed 5 years ago

yellowYuga commented 5 years ago

My python version is 3.7.0 Pytorch version is 0.4.1 When I follow README.md and train the network,the error is:

[2019-01-23 20:42:14 main.py:65] INFO     channels_3d: 4
[2019-01-23 20:42:14 main.py:65] INFO     datapath: /disk1/hyj/hyj/
[2019-01-23 20:42:14 main.py:65] INFO     epochs: 10
[2019-01-23 20:42:14 main.py:65] INFO     growth_rate: [4, 1, 1]
[2019-01-23 20:42:14 main.py:65] INFO     init_channels: 1
[2019-01-23 20:42:14 main.py:65] INFO     layers_3d: 4
[2019-01-23 20:42:14 main.py:65] INFO     loss_weights: [0.25, 0.5, 1.0, 1.0]
[2019-01-23 20:42:14 main.py:65] INFO     lr: 0.0005
[2019-01-23 20:42:14 main.py:65] INFO     maxdisp: 192
[2019-01-23 20:42:14 main.py:65] INFO     maxdisplist: [12, 3, 3]
[2019-01-23 20:42:14 main.py:65] INFO     nblocks: 2
[2019-01-23 20:42:14 main.py:65] INFO     print_freq: 5
[2019-01-23 20:42:14 main.py:65] INFO     resume: None
[2019-01-23 20:42:14 main.py:65] INFO     save_path: /disk1/hyj/Anytime
[2019-01-23 20:42:14 main.py:65] INFO     spn_init_channels: 8
[2019-01-23 20:42:14 main.py:65] INFO     test_bsize: 4
[2019-01-23 20:42:14 main.py:65] INFO     train_bsize: 4
[2019-01-23 20:42:14 main.py:65] INFO     with_spn: True
[2019-01-23 20:42:16 main.py:74] INFO     Number of model parameters: 43269
[2019-01-23 20:42:16 main.py:90] INFO     Not Resume
[2019-01-23 20:42:16 main.py:94] INFO     This is 0-th epoch
/home/hyj/anaconda3/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:225: UserWarning: nn.UpsamplingBilinear2d is deprecated. Use nn.functional.interpolate instead.
  warnings.warn("nn.UpsamplingBilinear2d is deprecated. Use nn.functional.interpolate instead.")
/home/hyj/anaconda3/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:122: UserWarning: nn.Upsampling is deprecated. Use nn.functional.interpolate instead.
  warnings.warn("nn.Upsampling is deprecated. Use nn.functional.interpolate instead.")
Traceback (most recent call last):
  File "/home/hyj/code/AnyNet/main.py", line 196, in <module>
    main()
  File "/home/hyj/code/AnyNet/main.py", line 96, in main
    train(TrainImgLoader, model, optimizer, log, epoch)
  File "/home/hyj/code/AnyNet/main.py", line 125, in train
    outputs = model(imgL, imgR)
  File "/home/hyj/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/hyj/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 121, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/hyj/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/hyj/code/AnyNet/models/anynet.py", line 142, in forward
    self.maxdisplist[scale], stride=1)
  File "/home/hyj/code/AnyNet/models/anynet.py", line 107, in _build_volume_2d
    cost[:, i//stride, :, :i] = feat_l[:, :, :, :i].abs().sum(1)
RuntimeError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

Process finished with exit code 1

thanks

yellowYuga commented 5 years ago

When I change pytorch to 0.4.0 version,the problem solved.