jfzhang95 / pytorch-deeplab-xception

DeepLab v3+ model in PyTorch. Support different backbones.
MIT License
2.9k stars 779 forks source link

how to chnage the input h w of image? #216

Open henbucuoshanghai opened 3 years ago

henbucuoshanghai commented 3 years ago

when training has this error

warnings.warn(warning.format(ret)) 0%| | 0/1539 [00:00<?, ?it/s] Traceback (most recent call last): File "train.py", line 304, in main() File "train.py", line 297, in main trainer.training(epoch) File "train.py", line 106, in training loss = self.criterion(output, target) File "/home/Pictures/pytorch-deeplab-xception/utils/loss.py", line 28, in CrossEntropyLoss loss = criterion(logit, target.long()) File "/home//anaconda3/envs/lili/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "/home//anaconda3/envs/lili/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 1120, in forward return F.cross_entropy(input, target, weight=self.weight, File "/home//anaconda3/envs/lili/lib/python3.8/site-packages/torch/nn/functional.py", line 2824, in cross_entropy return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index) RuntimeError: 1only batches of spatial targets supported (3D tensors) but got targets of size: : [2, 513, 513, 3]