iduta / pyconv

Pyramidal Convolution: Rethinking Convolutional Neural Networks for Visual Recognition (https://arxiv.org/pdf/2006.11538.pdf)
MIT License
328 stars 53 forks source link

Input dimension doesn't match #10

Closed ZangHuanyu closed 4 years ago

ZangHuanyu commented 4 years ago

Hello all friends,

I run the main.py file, and stop at here:

Epoch: [1][200/225] Time 0.101 ( 0.128) Data 0.031 ( 0.034) Loss 1.9757e+00 (4.1127e+00) Acc@1 21.09 ( 22.09) Acc@5 84.38 ( 83.08) Epoch: [1][210/225] Time 0.103 ( 0.127) Data 0.031 ( 0.034) Loss 1.8720e+00 (4.0051e+00) Acc@1 22.66 ( 22.19) Acc@5 92.19 ( 83.22) Epoch: [1][220/225] Time 0.101 ( 0.126) Data 0.031 ( 0.034) Loss 1.8523e+00 (3.9078e+00) Acc@1 29.69 ( 22.33) Acc@5 89.84 ( 83.33)

Then rised the error:

` Traceback (most recent call last): File "D:/Github_code/Py_pyramidal/Github/main.py", line 509, in main() File "D:/Github_code/Py_pyramidal/Github/main.py", line 122, in main main_worker(args.gpu, ngpus_per_node, args) File "D:/Github_code/Py_pyramidal/Github/main.py", line 324, in main_worker val_acc1, val_acc5, val_loss = validate(PublicTestloader, model, criterion, args) File "D:/Github_code/Py_pyramidal/Github/main.py", line 414, in validate output = model(input) File "C:\Users\zhy34\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, kwargs) File "C:\Users\zhy34\Anaconda3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 153, in forward return self.module(*inputs[0], *kwargs[0]) File "C:\Users\zhy34\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(input, kwargs) File "D:\Github_code\Py_pyramidal\Github\models\resnet.py", line 175, in forward x = self.conv1(x) File "C:\Users\zhy34\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs) File "C:\Users\zhy34\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 353, in forward return self._conv_forward(input, self.weight) File "C:\Users\zhy34\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 350, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: Expected 4-dimensional input for 4-dimensional weight [64, 3, 7, 7], but got 5-dimensional input of size [128, 10, 3, 44, 44] instead

Process finished with exit code 1 `

That's because I used the transform on validation data which is TenCrop, the dimension "10" means tencrop, but how can I add this dimension to the input of architecture?

Is there anyone can help me? Any comments are appreciated.