Res2Net-PretrainedModels icon indicating copy to clipboard operation
Res2Net-PretrainedModels copied to clipboard

数组越界

Open shezhi opened this issue 4 years ago • 4 comments

Traceback (most recent call last): File "train.py", line 160, in main() File "train.py", line 66, in main train(train_loader, model, optimizer, epoch) File "train.py", line 94, in train output = model(image) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/root/Revisiting_Single_Depth_Estimation-master/models/net.py", line 28, in forward x_block1, x_block2, x_block3, x_block4 = self.E(x) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/root/Revisiting_Single_Depth_Estimation-master/models/modules.py", line 62, in forward x_block1 = self.layer1(x) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/root/Revisiting_Single_Depth_Estimation-master/models/resnet.py", line 162, in forward sp = self.relu(self.bnsi) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 101, in getitem raise IndexError('index {} is out of range'.format(idx)) IndexError: index 2 is out of range

shezhi avatar Apr 14 '21 17:04 shezhi

我把resnet50中bottleblock替换成bottle2block,然后运行过后出现这种错误,请问什么原因呢?

shezhi avatar Apr 14 '21 17:04 shezhi

https://github.com/Res2Net/Res2Net-PretrainedModels/blob/master/res2net_v1b.py 你可以直接参照我们的代码。我们的代码也是根据resnet50改的。从你给的信息我无法判断出来,一般原因可能是参数没传对。

gasvn avatar Apr 15 '21 02:04 gasvn

好的,我试试

shezhi avatar Apr 15 '21 02:04 shezhi

width = int(math.floor(planes * (baseWidth/64.0)))您好,这一行代码我一直没太弄明白,请问有人知道么

shezhi avatar Apr 19 '21 01:04 shezhi

width = int(math.floor(planes * (baseWidth/64.0)))您好,这一行代码我一直没太弄明白,请问有人知道么

这只是为了方便跟resnet对齐参数量写的一行代码。

gasvn avatar Sep 01 '22 04:09 gasvn

已收到!

shezhi avatar Sep 01 '22 04:09 shezhi