Closed kelisiya closed 3 years ago
I have not seen loss like that, maybe you can implement that directly with pytorch operators.
yes, I want to design a loss use pytorch , but I don't know how to deal when value is 0 or 1 and 0-1 ; I think it's like smoothL1,but I use pytorch unskilled.
Maybe you can try torch.where
to switch between the two losses according to the input conditions.
Thanks your reply,but how to del 0 or 1 ? torch don't have logit or ?
what do you mean by "del 0 or 1" ?
Emmm,I want to use L1 loss in label=0 and label=1,use L2 loss in label =[0-1] like 0.5,i dont know how to use torch.where in label =0 and label =1
---Original--- From: "CoinCheung"<notifications@github.com> Date: Wed, Jan 8, 2020 19:25 PM To: "CoinCheung/pytorch-loss"<pytorch-loss@noreply.github.com>; Cc: "kelisiya"<402124496@qq.com>;"Author"<author@noreply.github.com>; Subject: Re: [CoinCheung/pytorch-loss] How do I design my loss fuction like smoothL1? (#3)
what do you mean by "del 0 or 1" ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
As far as I know, we do not need to consider single points when we compute loss in practice. You need continuous loss funtions to compute the gradient, it will not be meaningful if your loss function has singular points that cannot compute the graident.
《A Late Fusion CNN for Digital Matting》,http://openaccess.thecvf.com/content_CVPR_2019/papers/Zhang_A_Late_Fusion_CNN_for_Digital_Matting_CVPR_2019_paper.pdfthe formula <4>
I want to design a loss fuction when GT is [0,1] use L2 loss ;[0-1] use L1 loss ; How to achieve it use pytorch? Thanks