LiheYoung / UniMatch

[CVPR 2023] Revisiting Weak-to-Strong Consistency in Semi-Supervised Semantic Segmentation
https://arxiv.org/abs/2208.09910
MIT License
476 stars 59 forks source link

训练过程中的问题 #86

Closed m828 closed 1 year ago

m828 commented 1 year ago

你好,非常优秀的工作,我在此基础上,想尝试加一个损失,我在其他模型上尝试成功了,但是在使用unimatch的代码上修改,就有问题,请指教!

output_d = output[:, 1:, :, :].sum(dim=1) output_f = output[:, 0, :, :] outs = torch.stack([output_f, output_d], dim=1)

尝试使用criterion(outs , mask)计算损失,出错: RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1. Compile with TORCH_USE_CUDA_DSA to enable device-side assertions. 同样的损失函数,我在其他模型上可以顺利进行

LiheYoung commented 1 year ago

因为criterion是CrossEntropyLoss,而你的outs在dim-1上只有2维的feature map,如果mask中包含大于1的值就会出现这个错误。