We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Traceback (most recent call last): File "train.py", line 142, in train(net, train_loader, loss_dict, optimizer, scheduler,logger, epoch, metric_dict, cfg.dataset) File "train.py", line 30, in train loss = calc_loss(loss_dict, results, logger, global_step, epoch) File "/root/Ultra-Fast-Lane-Detection-v2-master/utils/common.py", line 274, in calc_loss loss_cur = loss_dict['op']i File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 1174, in forward return F.cross_entropy(input, target, weight=self.weight, File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/functional.py", line 3029, 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, 3, 320, 800]
经过我的检查我发现,模型会直接返回seghead结构的输出,然后将其与其的标签放入cross_entropy_loss函数,但关键是cross_entropy_loss函数要求的输入是batch_size*C,两者的形状不符所以发生了错误,但我想不应该是你的代码发生了错误,所以问题出在哪呢
The text was updated successfully, but these errors were encountered:
你好 想问一下问题解决了嘛
Sorry, something went wrong.
v2版本没有使用seghead结构,这可能是上一版本的遗留代码,不要启动它
No branches or pull requests
Traceback (most recent call last):
File "train.py", line 142, in
train(net, train_loader, loss_dict, optimizer, scheduler,logger, epoch, metric_dict, cfg.dataset)
File "train.py", line 30, in train
loss = calc_loss(loss_dict, results, logger, global_step, epoch)
File "/root/Ultra-Fast-Lane-Detection-v2-master/utils/common.py", line 274, in calc_loss
loss_cur = loss_dict['op']i
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 1174, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/functional.py", line 3029, 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, 3, 320, 800]
经过我的检查我发现,模型会直接返回seghead结构的输出,然后将其与其的标签放入cross_entropy_loss函数,但关键是cross_entropy_loss函数要求的输入是batch_size*C,两者的形状不符所以发生了错误,但我想不应该是你的代码发生了错误,所以问题出在哪呢
The text was updated successfully, but these errors were encountered: