0
$\begingroup$

I am trying to implement the weight-cross entropy mentioned in unet paper to counter the class-imbalances. I am not really able to understand how they are exactly implementing the weight-cross entropy. Quoting the paper-

enter image description here

where $\ell: Ω \to {1,...,K}$ is the true label of each pixel and $w : Ω → \mathbb{R}$ is a weight map that we introduced to give some pixels more importance in the training.

I have the calculated weighted function w(x) but I am not really able to understand how the modified cross-entropy is being calculated here.
Is it just by passing now the weighted function instead of the labels in regular cross-entropy or is it by multiplying the weighted function with the output of product of log of target and labels.

$\endgroup$
1
$\begingroup$

The standard unweighted cross-entropy loss is $$ \sum_{\mathbf{x} \in \Omega} \log p_{\ell(\mathbf{x})}(\mathbf{x}). $$ The only difference in the weighted loss $E$ is that you have a set of multiplicative coefficients $w(\mathbf{x})$ that rescale the pointwise log-losses. The overall effect is that some pixels are considered more important to correctly classify.

$\endgroup$
  • $\begingroup$ Thank You, now this may not be the part of the question and I could post another one if you want but how do you suggest I should incorporate w(x) in the loss. I am trying to do in this way - loss = weight_map * criterion(output,target) $\endgroup$ – Bing Dec 9 '19 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.