pytorch-semseg
pytorch-semseg copied to clipboard
ValueError: Expected input batch_size to match target batch_size when running fcn8 on Pascal
Hi! I'm trying python train.py
with default settings on the Pascal dataset with fcn8. After 1000 iterations I get the following error:
Traceback (most recent call last): File "train.py", line 229, in <module> train(cfg, writer, logger) File "train.py", line 159, in train val_loss = loss_fn(input=outputs, target=labels) File "/pytorch-semseg/ptsemseg/loss/loss.py", line 24, in cross_entropy2d input, target, weight=weight, size_average=size_average, ignore_index=250 File "/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 1550, in cross_entropy return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction) File "/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 1405, in nll_loss .format(input.size(0), target.size(0))) ValueError: Expected input batch_size (183000) to match target batch_size (187500).
What could the problem be?
It seems that "labels" in line 15 (train.py) needs to be replaced by "labels_val": val_loss = loss_fn(input=outputs, target=labels_val)
hello i'm facing the same issue. did you find any solution ?
I'm facing the same issue. Did you find any solution?
我已收到,谢谢