Closed qdd1234 closed 2 years ago
如果你的意思是:
loss(out, target) = w1 * func1(out, target) + w2 * func2(out, target)
可以把LOSSES_CFG改成例如如下形式:
LOSSES_CFG = {
'loss_aux': {
'celoss': {'scale_factor': 0.4, 'opts': {'ignore_index': 255, 'reduction': 'mean'}}
},
'loss_cls': {
'celoss': {'scale_factor': 1.0, 'opts': {'ignore_index': 255, 'reduction': 'mean'}},
'diceloss': {'scale_factor': 0.4, 'opts': {'ignore_index': 255, 'reduction': 'mean'}},
},
}
这样的效果为:
loss(out, target) = 1.0 * ce(out, target) + 0.4 * dice(out, target)
您好,如果我想要在训练的时同时使用两种损失函数,那么config文件里面损失函数那块该怎么去写