isht7 / pytorch-deeplab-resnet

DeepLab resnet v2 model in pytorch
MIT License
602 stars 116 forks source link

spatial sizes mismatch #35

Open aidanaden opened 6 years ago

aidanaden commented 6 years ago

The spatial sizes of the output of the model and the target labels aren't matching for some of the inputs/targets. Does anyone know how to fix this? Thanks a lot. Error message below

C:\Users\Aidan\Documents\DL_Practice\pytorch-deeplab-resnet-master>python train.py --lr 0.00025 --wtDecay 0.0005 --maxIter 20000 --GTpath data/gt --IMpath data/img --LISTpath data/list/train_aug.txt {'--GTpath': 'data/gt', '--IMpath': 'data/img', '--LISTpath': 'data/list/train_aug.txt', '--NoLabels': '21', '--gpu0': '0', '--help': False, '--iterSize': '10', '--lr': '0.00025', '--maxIter': '20000', '--wtDecay': '0.0005'} C:\Users\Aidan\Anaconda3\lib\site-packages\torch\nn\modules\upsampling.py:221: UserWarning: nn.UpsamplingBilinear2d is deprecated. Use nn.Upsample instead. warnings.warn("nn.UpsamplingBilinear2d is deprecated. Use nn.Upsample instead.") C:\Users\Aidan\Anaconda3\lib\site-packages\torch\nn\modules\loss.py:198: UserWarning: NLLLoss2d has been deprecated. Please use NLLLoss instead as a drop-in replacement and see http://pytorch.org/docs/master/nn.html#torch.nn.NLLLoss for more details. warnings.warn("NLLLoss2d has been deprecated. " train.py:132: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument. out = m(out) Traceback (most recent call last): File "train.py", line 227, in loss = loss + loss_calc(out[i+1],label[i+1],gpu0) File "train.py", line 134, in loss_calc return criterion(out,label) File "C:\Users\Aidan\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call result = self.forward(*input, **kwargs) File "C:\Users\Aidan\Anaconda3\lib\site-packages\torch\nn\modules\loss.py", line 193, in forward self.ignore_index, self.reduce) File "C:\Users\Aidan\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1334, in nll_loss return torch._C._nn.nll_loss2d(input, target, weight, size_average, ignore_index, reduce) RuntimeError: input and target batch or spatial sizes don't match: target [1 x 27 x 27], input [1 x 21 x 26 x 26] at c:\users\administrator\downloads\new-builder\win-wheel\pytorch\aten\src\thcunn\generic/SpatialClassNLLCriterion.cu:24

isht7 commented 6 years ago

Are you using Pascal voc to train? Have you modified any part of the code? Note that this repository is written in Python 2.x