Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spatial sizes mismatch #35

Open
aidanaden opened this issue Jul 16, 2018 · 1 comment
Open

spatial sizes mismatch #35

aidanaden opened this issue Jul 16, 2018 · 1 comment

Comments

@aidanaden
Copy link

aidanaden commented Jul 16, 2018

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
Copy link
Owner

isht7 commented Jul 18, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants