[New Feature]add lovasz loss#351
Conversation
|
Task linked: CU-j6umcn Lovász-Softmax loss #351 |
Codecov Report
@@ Coverage Diff @@
## master #351 +/- ##
==========================================
+ Coverage 86.07% 86.14% +0.07%
==========================================
Files 95 96 +1
Lines 4789 4900 +111
Branches 778 798 +20
==========================================
+ Hits 4122 4221 +99
- Misses 519 526 +7
- Partials 148 153 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
| @@ -0,0 +1,296 @@ | |||
| import mmcv | |||
There was a problem hiding this comment.
We may add sth like
Modified from ...
| """Binary Lovasz hinge loss. | ||
|
|
||
| Args: | ||
| probas (torch.Tensor): [B, H, W], logits at each pixel |
There was a problem hiding this comment.
probas is not an ideal abbr.
We may use logits directly.
There was a problem hiding this comment.
In our codebase, logits usually refers to unnormalized energy. prob refers to probability distribution.
| """Multi-class Lovasz-Softmax loss. | ||
|
|
||
| Args: | ||
| probas (torch.Tensor): [P, C], class probabilities at each prediction |
| """Multi-class Lovasz-Softmax loss. | ||
|
|
||
| Args: | ||
| probas (torch.Tensor): [B, C, H, W], class probabilities at each |
|
|
||
| This loss is proposed in `The Lovasz-Softmax loss: A tractable surrogate | ||
| for the optimization of the intersection-over-union measure in neural | ||
| networks <https://openaccess.thecvf.com/content_cvpr_2018/html/Berman_The_LovaSz-Softmax_Loss_CVPR_2018_paper.html>`_. # noqa |
There was a problem hiding this comment.
https://arxiv.org/abs/1705.08790 should be fine.
| # only void pixels, the gradients should be 0 | ||
| return logits.sum() * 0. | ||
| signs = 2. * labels.float() - 1. | ||
| errors = (1. - logits * Variable(signs)) |
There was a problem hiding this comment.
I don't know, it is the original code.
There was a problem hiding this comment.
* add lovasz loss * Modify as comments * Modify paper url * add unittest and remove Var * impove unittest
No description provided.