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

我在运行train.py时出现了以下报错 #356

Open
ZzhhzZ12345679 opened this issue Nov 8, 2023 · 3 comments
Open

我在运行train.py时出现了以下报错 #356

ZzhhzZ12345679 opened this issue Nov 8, 2023 · 3 comments

Comments

@ZzhhzZ12345679
Copy link

我在运行train.py时出现了以下报错:
Traceback (most recent call last):
File "train.py", line 152, in
train(net, train_loader, loss_dict, optimizer, scheduler,logger, epoch, metric_dict, cfg.use_aux)
File "train.py", line 68, in train
loss = calc_loss(loss_dict, results, logger, global_step)
File "train.py", line 47, in calc_loss
loss_cur = loss_dict['op']i
File "D:\anaconda\envs\lane\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "D:\anaconda\envs\lane\lib\site-packages\torch\nn\modules\loss.py", line 1176, in forward
label_smoothing=self.label_smoothing)
File "D:\anaconda\envs\lane\lib\site-packages\torch\nn\functional.py", line 3026, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of size: : [32, 36, 100, 3]

@xings-sdnu
Copy link

chane the use_aux to False can work:
parser.add_argument('--use_aux', default='False', type=str2bool)

@lz06787
Copy link

lz06787 commented Jan 12, 2024

我也遇到了这个问题,应该是因为CULane的seg label是个1通道的png,我的数据集的seg label是个3通道的,调整一下label维度就好了

@ZzhhzZ12345679
Copy link
Author

怎么调整这个维度

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

3 participants