0
$\begingroup$

I am currently working on implementing a weighted binary crossentropy loss function as described in the U-Net paper

def weighted_pixelwise_crossentropy(self, wmap):

    def loss(y_true, y_pred):

         return losses.binary_crossentropy(y_true, y_pred) * wmap

    return loss

Same as in the paper, wmap contains both a weight map for class balancing as well as a weight map to highlight object borders. In the images I use for training, for 1 foreground pixel there are roughly 30 background pixels, so I would have assumed using a weight map should have improved the training and validation accuracy. But I get roughly the same results as when not using any weight map at all. Does anybody have any potential ideas why this might be the case?

$\endgroup$
  • $\begingroup$ surely if the classes are as unbalanced as you say, mean IoU makes more sense than accuracy as a metric $\endgroup$ – shimao Feb 26 at 16:37
  • $\begingroup$ Sorry, I should have been more precise. With accuracy I in fact mean the F1 score (or dice coefficient), which seems not be influenced by using a weight map. $\endgroup$ – disputator1991 Feb 26 at 16:49

Your Answer

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

Browse other questions tagged or ask your own question.